-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch_analyze.py
More file actions
executable file
·59 lines (48 loc) · 1.82 KB
/
batch_analyze.py
File metadata and controls
executable file
·59 lines (48 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import pandas as pd
#import h5py
#import plotly
#import plotly.express as px
#import chart_studio
#import chart_studio.plotly as py
#import plotly.graph_objs as go
import csv
import sys
import numpy as np
#from collections import Counter
NumASICchannels = 64
ShowPlots = False
def selectFile(defaultFile):
filetypes = (('csv files','*.csv'),('text files','*.txt'),('All files','*.*'))
filename = fd.askopenfilename(
title='Select netsummary<batch>.csv file name',
initialdir='./data/',
initialfile=defaultFile,
filetypes=filetypes,
multiple=False)
return filename
# if we get a parameter, assume that is the filename we will use, otherwise we'll pop up the tk dialog
print(sys.argv)
if len(sys.argv) >= 1 : #We got some arguments passed to our python code, it should be the input file
inputCSVfile=sys.argv[1]
print("Using input file ",inputCSVfile)
listlen=1
else:
from tkinter import filedialog as fd
inputCSVfile=selectFile('')
listlen=len(inputCSVfile)
print('listlen=',listlen)
print('inputCSVfiles=',inputCSVfiles)
if listlen<1:
exit("Must enter one or more (with ctrl-click) files to use")
# read in the netconfig results (tuples) with each SN in the batch
netsummaryFrame = pd.read_csv(inputCSVfile,header=None,names=['ChipSN','nettesttime','netresult'])
#print(netsummaryFrame)
# read in the bps-summary csv file
bpsresultsfilename=inputCSVfile.replace("netsummary","bps-results")
bpsresultsFrame=pd.read_csv(bpsresultsfilename,header=None,names=['ChipSN','bpstesttime','bpsresult'])
#print(bpsresultsFrame)
overallresults=pd.merge(netsummaryFrame,bpsresultsFrame,on='ChipSN',how='outer')
print(overallresults)
outfilename=inputCSVfile.replace("netsummary","batchsummary")
overallresults.to_csv(outfilename,index=False)
print('Wrote overall results to ',outfilename)