-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
92 lines (81 loc) · 3.81 KB
/
Copy pathmain.py
File metadata and controls
92 lines (81 loc) · 3.81 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from module.calc import calc
from module.RecordData import Record
from module.io_op import IO
from core.ui_operation import window_op
import sys,threading
from PyQt5 import QtWidgets
class Main(window_op):
def __init__(self):
super(Main, self).__init__()
self.io = IO()
self.calc = calc()
self.NIDATA = ''
self.blank_stdev = 0.0
self.SignalMeanData = []
self.FinalTimeData =[]
self.NormalizeData = []
def makeMeanList_and_getTime(self):
Rec = Record(self.NIDATA,self.Numpoint,)
MeanValue = Rec.GetMean()
Stdev = Rec.Getstdev()
Time = float(Rec.GetFinalTime())
self.SignalMeanData.append(MeanValue)
self.FinalTimeData.append(Time)
return MeanValue,Time,Stdev
def RecordTime_WriteData(self):
super(Main, self).RecordTime_WriteData()
if self.Blank_button.isEnabled():
return
if self.SampleMW == None or self.SampleMW <= 0.0:
return
sampleMean, Time, _ = self.makeMeanList_and_getTime()
self.WriteDatathread = threading.Thread(target=self.io.write_conc_with_x_point,
args=(self.NIDATA, self.Conclist[-1], self.FinalTimeData[-1]))
self.Console.appendPlainText("Samplemean Data write : %s with time %s" % (sampleMean, Time))
self.WriteDatathread.start()
self.RecordTime.setText(str(Time))
y_point = self.calc.normalize(self.SignalMeanData)
self.NormalizeData.append(y_point)
# plot
logconc = self.plot(self.Conclist,self.NormalizeData,self.SampleName_input.text(),self.blank_stdev,self.SampleMW)
self.io.plotDataWrite(self.NIDATA,logconc,self.NormalizeData)
self.WriteDatathread.join()
def record_blank(self):
super(Main, self).record_blank()
if self.NIDATA == '':
if self.io.find_latest_file(self.NIdir) != None:
self.NIDATA = self.io.find_latest_file(self.NIdir)
self.Console.appendPlainText("Latest NI recorded File %s Locked"%self.NIDATA)
self.WriteData_button.setEnabled(True)
else:
self.Console.appendPlainText("Please select correct Directory")
self.Blank_button.setEnabled(True)
self.WriteData_button.setEnabled(False)
self.WriteData_button.setStyleSheet("background-color:red")
return
if self.Numpoint == 0:
return
if self.conc_combo.currentText() =='':
self.Console.appendPlainText("Please add conc")
self.WriteData_button.setEnabled(False)
return
blankMean,Time, self.blank_stdev = self.makeMeanList_and_getTime()
self.WriteDatathread = threading.Thread(target=self.io.write_conc_with_x_point,
args=(self.NIDATA, 'blank', self.FinalTimeData[-1]))
self.WriteDatathread.start()
self.Console.appendPlainText("blankmean Data write : %s with time %s"%(blankMean,Time))
self.RecordTime.setText(str(Time))
self.WriteDatathread.join()
def remove_plot_data(self):
remove_index = self.Conclist.index(eval(self.data_combo.currentText()))
remove_conc_data = self.Conclist.pop(remove_index)
remove_data = self.NormalizeData.pop(remove_index)
self.data_combo.removeItem(self.data_combo.findText(self.data_combo.currentText()))
self.Console.appendPlainText("plot data remove conc %s with data %s"%(remove_conc_data,remove_data))
super(Main, self).remove_plot_data()
self.plot(self.Conclist, self.NormalizeData, self.SampleName_input.text(), self.blank_stdev,self.SampleMW)
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
w = Main()
w.show()
sys.exit(app.exec_())