Commit 88363c7c authored by tiagof's avatar tiagof
Browse files

Cryoscopy: add red line to identify trigger Resistance

parent 721364d7
......@@ -445,7 +445,7 @@ More trouble with this program? Contact Tiago Neves!
#keeptime = self.datatimenow
#self.saveDialog.savedata(self.dockWidget.intervallbox.value(),self.dockWidget.scalebox.currentText(), self.channel, self.x, self._lib.ydata, self._lib.ydatastr)
if self.saveDialog.savedata(self.dockWidget.intervallbox.value(), self.dockWidget.scalebox.currentText(),
self.channel, self.x, self.y, self.i, self.myWidget):
self.channel, view.dockWidget.triggerresistance.value() ,self.x, self.y, self.i, self.myWidget):
self.setWindowTitle(self.program_name + " [SAVED:" + self.saveDialog.filename + "]")
#self.dataissaved = True
#else:
......@@ -467,10 +467,12 @@ More trouble with this program? Contact Tiago Neves!
indts = [i for i ,s in enumerate(data) if "##Time step " in s]
indch = [i for i ,s in enumerate(data) if "##Channel " in s]
indsc = [i for i ,s in enumerate(data) if "##Scale Factor " in s]
indtrigger = [i for i ,s in enumerate(data) if "##Trigger Resistance " in s]
ts = data[indts[0]][13:]
ch = data[indch[0]][11:]
ch=ch.rstrip()
sc = data[indsc[0]][16:]
trigger = data[indtrigger[0]][22:]
#set the values
self.dockWidget.intervallbox.setValue(float(ts))
if ch == "Left":
......@@ -483,6 +485,10 @@ More trouble with this program? Contact Tiago Neves!
self.dockWidget.scalebox.setCurrentIndex(1)
else:
self.dockWidget.scalebox.setCurrentIndex(0)
self.dockWidget.triggerresistance.setValue(float(trigger))
self.myWidget.p2.setValue(trigger)
#delete all elements with ##
inddel = [i for i, s in enumerate(data) if "##" in s]
for b in reversed(inddel):
......@@ -562,7 +568,7 @@ class MySaveDialog(QtGui.QDialog, Ui_Save):
self.exec_()
#actual saving of data to file, format data for file, add name etc. from save window to file
def savedata(self,intervall, scale, channel, xdata, ydata, arrlength, printgraph):
def savedata(self,intervall, scale, channel, trigger, xdata, ydata, arrlength, printgraph):
name = self.line1.text()+'.dat'
namepicture = self.line1.text() + '.jpg'
# save_path = os.path.abspath(r'C:\Users\Public') #My PC
......@@ -609,6 +615,7 @@ class MySaveDialog(QtGui.QDialog, Ui_Save):
file.write('##Channel '+'Right' +'\n') #Left/right
file.write('##Time step '+str(intervall)+'\n')
file.write('##Scale Factor '+str(scale)+'\n')
file.write('##Trigger Resistance '+str(trigger)+'\n')
file.write('##'+'x-data'+' '+'y-data'+'\n')
for v in range(arrlength):
if ydata[v] == np.nan:
......@@ -670,6 +677,10 @@ if __name__ == '__main__':
view.status = "starting"
#Default interval of measuremnts
view.dockWidget.intervallbox.setValue(0.5) #KRY
#Resistance depending on the KRY thermistor Head (measured at -8°C)
view.dockWidget.triggerresistance.setValue(7.54)#KRY
#Display the trigger resitance value in the graph (horizontal Red line)
view.myWidget.p2.setValue(view.dockWidget.triggerresistance.value())
#Scale is set to "200"
view.dockWidget.scalebox.setCurrentIndex(2)
#start timer to update the GUI
......
......@@ -33,11 +33,15 @@ class Ui_MyWidget(object):
obj.l.setHorizontalSpacing(0)
obj.l.setVerticalSpacing(0)
obj.vb = ViewBox(enableMenu = False)
obj.l.addItem(obj.vb,1, 1)
obj.l.addItem(obj.vb,1,1)
#Actual plot item
obj.linewidth = pg.mkPen(width = 2)
obj.p1 = pg.PlotDataItem(pen = obj.linewidth)
obj.vb.addItem(obj.p1)
#Add horizontal infinite line (for trigger)
obj.ap2=pg.TextItem()
obj.p2 = pg.InfiniteLine(angle=0, pen='r', label='Trigger', labelOpts={'position':0.04})
obj.vb.addItem(obj.p2)
#Add plot settings/axis names
obj.xScale = pg.AxisItem(orientation='bottom', linkView=obj.vb)
obj.l.addItem(obj.xScale, 2, 1)
......@@ -109,7 +113,7 @@ class Ui_MyDockWidget(object):
obj.stopbt2 = QtGui.QPushButton('Stop measuring', obj)
#temperature display
obj.acttempbox = QtGui.QGroupBox("Resistance[kohm]")
obj.acttempbox = QtGui.QGroupBox("Resistance [kohm]")
obj.acttemplayout =QtGui.QVBoxLayout()
obj.acttemp = QtGui.QLineEdit( obj)
obj.acttemp.setReadOnly(True)
......@@ -124,8 +128,18 @@ class Ui_MyDockWidget(object):
obj.maxmtimelayout.addWidget(obj.maxmtime)
obj.maxmtimebox.setLayout(obj.maxmtimelayout)
#max measurement time
obj.triggerresistancebox = QtGui.QGroupBox("Trigger Resitance value (T=-8°C)")
obj.triggerresistancelayout =QtGui.QVBoxLayout()
obj.triggerresistance = QtGui.QDoubleSpinBox()
obj.triggerresistance.setReadOnly(True)
obj.triggerresistance.setSuffix(" [kohm]")
obj.triggerresistance.setButtonSymbols(obj.triggerresistance.NoButtons)
obj.triggerresistancelayout.addWidget(obj.triggerresistance)
obj.triggerresistancebox.setLayout(obj.triggerresistancelayout)
#Measurement intervall
obj.intervall = QtGui.QGroupBox("Choose measure intervall[s]")
obj.intervall = QtGui.QGroupBox("Choose measure intervall [s]")
#obj.intervall.setFixedHeight(50)
obj.intervalllayout =QtGui.QVBoxLayout()
obj.intervallbox = QtGui.QDoubleSpinBox()
......@@ -195,6 +209,7 @@ class Ui_MyDockWidget(object):
obj.dlayout.addWidget(obj.acttempbox)
obj.dlayout.addWidget(obj.intervall)
obj.dlayout.addWidget(obj.maxmtimebox)
obj.dlayout.addWidget(obj.triggerresistancebox)
#obj.dlayout.addWidget(obj.scale)
#obj.dlayout.addWidget(obj.channel)
obj.dlayout.addWidget(obj.toolbar)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment