编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

利用R语言爬取PROBE设备的spd文件并存到数据库

wxchong 2024-10-11 19:11:24 开源技术 8 ℃ 0 评论

测试机台生存的Yield(Rdson/leakage)以.spd格式保存到本地硬盘,工程师会从本地查找需要的数据进行分析和追踪良率,

如果能写个脚本,自动获取硬盘,并存到数据库,可以很方便。

下面是利用R进行log的导入合并和存到数据库,不过还是无法通过网络涂胶去获取数据。

Code:

# probe log分析:

library(dplyr)

library(tidyr)

library(RODBC)

library(readr)

#访问DB:fdc/fdc

con<-odbcConnect("FDC","fdc","fdc") #连接b1fdcrpt

# 查询数据库中的数据表

tablelist<-sqlTables(con,as.is=TRUE)

#输出MappingYield表中的内容

# AOI<-sqlFetch(con,"MappingYield")

# 从数据表中查询符合的字段

# data<-sqlQuery(con,"select * from MappingYield where LotID='MP%'")

# 路径设置:

path<-"F:/6-数据分析/Probe/Log"

filename<-dir(path)

filelist<-paste(path,filename,sep="/")

# information get:

lot<-read.table(filelist[1],header=F,sep=",",quote="",nrows=1,skip=2)

lot<-data.frame(lot[,2])

names(lot)<-c("lot")

time<-read.table(filelist[1],header=F,sep=",",quote="",nrows=1,skip=5)

time<-data.frame(time[,2])

names(time)<-c("date")

lot_infor<-data.frame(lot,time)

data<-read_csv(filelist[1],col_names =TRUE,skip=11)

data<-data%>%select(`Bin#`,nA)

data<-data.frame(min(data$nA),mean(data$nA),max(data$nA))

names(data)<-c("min","average","max")

data<-cbind(lot_infor,data)

for(t in 2:length(filelist)){

# lot ID:

lot_new<-read.table(filelist[t],header=F,sep=",",quote="",nrows=1,skip=2)

lot_new<-data.frame(lot_new[,2])

names(lot_new)<-c("lot")

lot<-rbind(lot,lot_new)

# time handle:

time_new<-read.table(filelist[t],header=F,sep=",",quote="",nrows=1,skip=5)

time_new<-data.frame(time_new[,2])

names(time_new)<-c("date")

time<-rbind(time,time_new)

lot_infor_new<-data.frame(lot_new,time_new)

#读取nA数据:

data_new<-read_csv(filelist[t],col_names=TRUE,skip=11)

data_new<-select(data_new,`Bin#`,nA)

data_new<-data.frame(min(data_new$nA),mean(data_new$nA),max(data_new$nA))

names(data_new)<-c("min","average","max")

data_new<-cbind(lot_infor_new,data_new)

data<-rbind(data,data_new)

}

probe_leakage<-data

probe_leakage<-separate(probe_leakage,lot,c("Lot","Wafer"),remove=FALSE)

probe_leakage<-probe_leakage[,-1]

probe_leakage%>%unite(wafer,Lot,Wafer,sep=".",remove=FALSE)->probe_leakage

probe_leakage<-probe_leakage[,-3]

# probe_leakage 表格写入数据库里

sqlSave(con,probe_leakage,"probe_leakage",rowsname=FALSE,append=TRUE)

# 在保存表格时RStudio 闪退,不知道为什么?

#删除表格

# sqlDrop(con,"Probe")

# 关闭数据库

odbcClose(conn)

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表