Example #1
0
    def __init__(self, filename, trange, SR850scanlength, SR850SinRMS,
                 CurrentResistance, GainRatio, dT, dTfluc, description,
                 WaitTimeForT):
        Thread.__init__(self)
        wx.CallAfter(Publisher.sendMessage, "update",
                     msg="S")  ## "S" means "Setting up SR850 and LTC21"

        ## Initialize input parameters
        self.CurrentResistance = CurrentResistance
        self.SR850SinRMS = SR850SinRMS
        self.GainRatio = GainRatio
        self.SR850Current = SR850SinRMS / CurrentResistance * self.GainRatio
        self.SR850scanlength = SR850scanlength
        self.trange = trange
        self.dT = dT
        self.dTfluc = dTfluc
        self.WaitTimeForT = WaitTimeForT
        ## Get GPIB connection
        rm = visa.ResourceManager()
        self.ltc21 = rm.open_resource('GPIB0::10::INSTR')
        self.ltc21.timeout = 60000
        self.sr850 = rm.open_resource('GPIB0::12::INSTR')
        self.sr850.timeout = 60000

        ## open data file and write file header
        self.file = open(filename, "a", 0)
        self.file.write("##")
        self.file.write(time.ctime())
        self.file.write("\n")
        self.file.write("##")
        self.file.write("User Description: %s" % description)
        self.file.write("\n")
        self.file.write("##")
        self.file.write(self.sr850.query("*IDN?\n;"))
        self.file.write("##")
        self.file.write(self.ltc21.query("*IDN?\n;"))
        self.file.write("##")
        self.file.write("SR850 scan length is %.1f\n" % SR850scanlength)
        self.file.write("##")
        self.file.write("SR850 Sine RMS is %.3fV\n" % SR850SinRMS)
        self.file.write("##")
        self.file.write("Current Source Resistance is %.5f\n" %
                        CurrentResistance)
        self.file.write("##")
        self.file.write(
            "T_Stable flags: 0--Unstable, 1--Stable, 2--Measurement Stopped\n")
        self.file.write("##")
        self.file.write(
            "Time(s),\t T_in(K),\t R_s(ohm),\t Rstd_s(ohm),\t Tstd_in(K),\t T_out(K),\t Tstd_out(K),\t SR850_V(V),\t Temperature_Set(K),\t T_Stable?\n"
        )

        ## Setting SR850 and LTC21
        ## set autoGain for the measurement
        #self.sr850.write("AGAN\n;")
        #time.sleep(10)
        ## set 1 (= top display) to be 3 (Chart)
        self.sr850.write("DTYP1,3\n;")
        time.sleep(0.5)

        ## set Chart scan length to be 10 sec and the scan rate to be 64Hz
        self.sr850.write("SLEN%.0f;SRAT10\n;" % SR850scanlength)
        self.sr850.write("SLVL%.3f" % SR850SinRMS)

        ## set the initial SET point to be 0.5K lower than the base T reading. Somehow, the command need \n;
        Tinit = self.ltc21.query("QSAMP?1;")
        Tinit = float(Tinit[0:-3])

        self.ltc21.write("SETP1,%.3f\n;" % (Tinit - 0.5))
        self.ltc21.write("SCONT\n;")

        ## Initialize stable-T-mean and stable-T-std values to be off from the real readings, so it will run the first loop (10s) for checking stable temperature
        self.tstablemean = 0
        self.tstablestd = 1

        GlobalFlag.init()

        self.start()
    def __init__(self,filename,trange,SR850scanlength,SR850SinRMS,CurrentResistance,GainRatio,dT,dTfluc,description,WaitTimeForT):
        Thread.__init__(self)
        wx.CallAfter(Publisher.sendMessage, "update", msg = "S") ## "S" means "Setting up SR850 and LTC21"

        ## Initialize input parameters
        self.CurrentResistance = CurrentResistance
        self.SR850SinRMS = SR850SinRMS
        self.GainRatio = GainRatio
        self.SR850Current = SR850SinRMS/CurrentResistance*self.GainRatio
        self.SR850scanlength = SR850scanlength
        self.trange = trange
        self.dT = dT
        self.dTfluc = dTfluc
        self.WaitTimeForT = WaitTimeForT
        ## Get GPIB connection
        rm  = visa.ResourceManager()
        self.ltc21 = rm.open_resource('GPIB0::10::INSTR')
        self.ltc21.timeout = 60000
        self.sr850 = rm.open_resource('GPIB0::12::INSTR')
        self.sr850.timeout = 60000
        
        ## open data file and write file header
        self.file = open(filename, "a",0)
        self.file.write("##")
        self.file.write(time.ctime())
        self.file.write("\n")
        self.file.write("##")
        self.file.write("User Description: %s" % description)
        self.file.write("\n")
        self.file.write("##")
        self.file.write(self.sr850.query("*IDN?\n;"))
        self.file.write("##")
        self.file.write(self.ltc21.query("*IDN?\n;"))
        self.file.write("##")
        self.file.write("SR850 scan length is %.1f\n" % SR850scanlength)
        self.file.write("##")
        self.file.write("SR850 Sine RMS is %.3fV\n" % SR850SinRMS)
        self.file.write("##")
        self.file.write("Current Source Resistance is %.5f\n" % CurrentResistance)
        self.file.write("##")
        self.file.write("T_Stable flags: 0--Unstable, 1--Stable, 2--Measurement Stopped\n")  
        self.file.write("##")
        self.file.write("Time(s),\t T_in(K),\t R_s(ohm),\t Rstd_s(ohm),\t Tstd_in(K),\t T_out(K),\t Tstd_out(K),\t SR850_V(V),\t Temperature_Set(K),\t T_Stable?\n")
        

        ## Setting SR850 and LTC21
        ## set autoGain for the measurement
        #self.sr850.write("AGAN\n;")
        #time.sleep(10)
        ## set 1 (= top display) to be 3 (Chart)
        self.sr850.write("DTYP1,3\n;")
        time.sleep(0.5)
        
        ## set Chart scan length to be 10 sec and the scan rate to be 64Hz
        self.sr850.write("SLEN%.0f;SRAT10\n;" % SR850scanlength)
        self.sr850.write("SLVL%.3f" % SR850SinRMS)
        
        ## set the initial SET point to be 0.5K lower than the base T reading. Somehow, the command need \n;        
        Tinit = self.ltc21.query("QSAMP?1;")
        Tinit = float(Tinit[0:-3])

        self.ltc21.write("SETP1,%.3f\n;" % (Tinit-0.5))
        self.ltc21.write("SCONT\n;")
            
        ## Initialize stable-T-mean and stable-T-std values to be off from the real readings, so it will run the first loop (10s) for checking stable temperature
        self.tstablemean = 0
        self.tstablestd = 1
        
        GlobalFlag.init()
        
        self.start()
    def __init__(self, parent, id, title):
        # First, call the base class' __init__ method to create the frame
        wx.Frame.__init__(self, parent, id, title, size=(500,600))

        # Add a panel
        panel = wx.Panel(self)
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
        
        # Add a directory selection button
        bottonDic=wx.Button(panel,label="Directory",pos=(10,10),size=(60,30))
        self.Bind(wx.EVT_BUTTON,self.directorybutton, bottonDic)
        # Text box for showing the directory
        self.txtDic = wx.TextCtrl(panel, -1, pos=(75,10),size=(400,30))
        self.txtDic.SetValue('C:\Users\Supercon\Desktop\Dropbox\FeSe_Projects\Dip_Probe\GPIB_communication\data')
        # disable the textbox, so no one can edit it
        self.txtDic.Disable()        
        
        # Add a filename Button, taking the data file name from user
        bottonFil=wx.Button(panel,label="FileName",pos=(10,40),size=(60,30))
        self.Bind(wx.EVT_BUTTON,self.filenamebutton, bottonFil)
        # Text box for showing the filename
        self.txtFil = wx.TextCtrl(panel, -1, pos=(75,40),size=(400,30))
        self.txtFil.SetValue('temp.txt')
        # disable the textbox, so no one can edit it
        self.txtDic.Disable() 
        
  
        # Add a plot realtime data button
        bottonPlot=wx.Button(panel,label="Plot Live",pos=(10,70),size=(80,30))
        self.Bind(wx.EVT_BUTTON, self.plotbutton, bottonPlot)
        # Add a plot static/previous data button
        bottonPlotStatic=wx.Button(panel,label="Plot Static Data",pos=(90,70),size=(100,30))
        self.Bind(wx.EVT_BUTTON, self.plotbuttonstatic, bottonPlotStatic)
        
        self.XplotLabel = wx.StaticText(panel, -1, "X:",pos=(200,70),size=(20,30))
        self.plotdict = {u"Time":0, u"T_in": 1 , u"R":2, u"Rstd":3, u"Tin_std":4, u"T_out":5, u"Tout_std":6, u"V_SR850":7, u"T_set":8,u"T_stable":9}
        self.XplotChoices =  [u"T_in", u"T_out", u"Time", u"T_stable"]       
        self.Xplot = wx.Choice(panel,pos=(221,70),size=(100,30),choices=self.XplotChoices)
        self.Xplot.SetSelection( 0 )
        #self.choice.Bind(wx.EVT_CHOICE, self.onChoice)
        self.XplotLabel = wx.StaticText(panel, -1, "Y:",pos=(330,70),size=(20,30))
        self.YplotChoices = [u"Time", u"T_in", u"R", u"Rstd", u"Tin_std", u"T_out", u"Tout_std", u"V_SR850", u"T_set",u"T_stable"]        
        self.Yplot = wx.Choice(panel,pos=(351,70),size=(100,30),choices = self.YplotChoices)
        self.Yplot.SetSelection( 2 )

        
        
        ######################################
        # Temperature start, end, interval input, five of them, so one can choose five different T range
        self.tStart = wx.StaticText(panel, -1, "T1 Start(K):",pos=(10,100),size=(60,30))
        self.tStartval = wx.TextCtrl(panel, -1, "4.2",pos=(75,100),size=(60, 20))
        self.tStartval.SetInsertionPoint(0)
        self.tEnd = wx.StaticText(panel, -1, "T End(K):",pos=(160,100),size=(60,30))
        self.tEndval = wx.TextCtrl(panel, -1, "30",pos=(225,100),size=(60, 20))
        self.tEndval.SetInsertionPoint(0)
        self.tDividen = wx.StaticText(panel, -1, "Dividen:",pos=(300,100),size=(60,30))
        self.tDividenval = wx.TextCtrl(panel, -1, "0.2",pos=(365,100),size=(40, 20))
        self.tDividenval.SetInsertionPoint(0)
        
        
        self.tStart2 = wx.StaticText(panel, -1, "T2 Start(K):",pos=(10,130),size=(60,30))
        self.tStartval2 = wx.TextCtrl(panel, -1, "N",pos=(75,130),size=(60, 20))
        self.tStartval2.SetInsertionPoint(0)
        self.tEnd2 = wx.StaticText(panel, -1, "T End(K):",pos=(160,130),size=(60,30))
        self.tEndval2 = wx.TextCtrl(panel, -1, "N",pos=(225,130),size=(60, 20))
        self.tEndval2.SetInsertionPoint(0)
        self.tDividen2 = wx.StaticText(panel, -1, "Dividen:",pos=(300,130),size=(60,30))
        self.tDividenval2 = wx.TextCtrl(panel, -1, "N",pos=(365,130),size=(40, 20))
        self.tDividenval2.SetInsertionPoint(0)
        
        
        self.tStart3 = wx.StaticText(panel, -1, "T3 Start(K):",pos=(10,160),size=(60,30))
        self.tStartval3 = wx.TextCtrl(panel, -1, "N",pos=(75,160),size=(60, 20))
        self.tStartval3.SetInsertionPoint(0)
        self.tEnd3 = wx.StaticText(panel, -1, "T End(K):",pos=(160,160),size=(60,30))
        self.tEndval3 = wx.TextCtrl(panel, -1, "N",pos=(225,160),size=(60, 20))
        self.tEndval3.SetInsertionPoint(0)
        self.tDividen3 = wx.StaticText(panel, -1, "Dividen:",pos=(300,160),size=(60,30))
        self.tDividenval3 = wx.TextCtrl(panel, -1, "N",pos=(365,160),size=(40, 20))
        self.tDividenval3.SetInsertionPoint(0)        
        
        
        self.tStart4 = wx.StaticText(panel, -1, "T4 Start(K):",pos=(10,190),size=(60,30))
        self.tStartval4 = wx.TextCtrl(panel, -1, "N",pos=(75,190),size=(60, 20))
        self.tStartval4.SetInsertionPoint(0)
        self.tEnd4 = wx.StaticText(panel, -1, "T End(K):",pos=(160,190),size=(60,30))
        self.tEndval4 = wx.TextCtrl(panel, -1, "N",pos=(225,190),size=(60, 20))
        self.tEndval4.SetInsertionPoint(0)
        self.tDividen4 = wx.StaticText(panel, -1, "Dividen:",pos=(300,190),size=(60,30))
        self.tDividenval4 = wx.TextCtrl(panel, -1, "N",pos=(365,190),size=(40, 20))
        self.tDividenval4.SetInsertionPoint(0)  


        self.tStart5 = wx.StaticText(panel, -1, "T5 Start(K):",pos=(10,220),size=(60,20))
        self.tStartval5 = wx.TextCtrl(panel, -1, "N",pos=(75,220),size=(60, 20))
        self.tStartval5.SetInsertionPoint(0)
        self.tEnd5 = wx.StaticText(panel, -1, "T End(K):",pos=(160,220),size=(60,20))
        self.tEndval5 = wx.TextCtrl(panel, -1, "N",pos=(225,220),size=(60, 20))
        self.tEndval5.SetInsertionPoint(0)
        self.tDividen5 = wx.StaticText(panel, -1, "Dividen:",pos=(300,220),size=(60,20))
        self.tDividenval5 = wx.TextCtrl(panel, -1, "N",pos=(365,220),size=(40, 20))
        self.tDividenval5.SetInsertionPoint(0)  
        ####################################
        
        
        # Add a textbox for user description of the measurement
        self.description = wx.TextCtrl(panel, -1, "None",pos=(10,248),size=(460, 30))
        
        
        ####################################
        ## Start Measurement Button
        self.bottonMeasure=wx.Button(panel,label="Measure",pos=(10,280),size=(60,30))
        self.Bind(wx.EVT_BUTTON,self.measurebutton, self.bottonMeasure)
        
        ## Stop Measurement Button
        bottonStop=wx.Button(panel,label="STOP",pos=(80,280),size=(60,30))
        self.Bind(wx.EVT_BUTTON,self.stopbutton, bottonStop)   
        
        # Textbox for status update from SR850LTC21 threading
        self.statusMeasure = wx.StaticText(panel, -1, "Status:",pos=(145,280),size=(50,30))
        self.statusMeasureinput = wx.TextCtrl(panel, -1, "None",pos=(200,280),size=(270, 20))
        self.statusMeasureinput.SetBackgroundColour((230,230,230))
        self.statusMeasureinput.Disable()
        
        # create a pubsub receiver for receiving updates from SR850LTC21 threading
        Publisher.subscribe(self.updateDisplay, "update")        
        
        # initialize the global stop flag
        GlobalFlag.init()
        ####################################        

        
        ###########################################################
        # User input parameters for measurement: SR850scanlength,SR850SinRMS,CurrentResistance     
        self.sr850control1 = wx.StaticText(panel, -1, "SR850 Scanlength (s):",pos=(10,320),size=(160,30))
        self.sr850control1input = wx.TextCtrl(panel, -1, "10.0",pos=(175,320),size=(80, 20))
        
        self.sr850control2 = wx.StaticText(panel, -1, "SR850 Output RMS (V):",pos=(10,350),size=(160,30))
        self.sr850control2input = wx.TextCtrl(panel, -1, "1.0",pos=(175,350),size=(80, 20))
        self.Bind(wx.EVT_TEXT, self.updateCurrent, self.sr850control2input)
        
        self.sr850control3 = wx.StaticText(panel, -1, "R (kOhm) for Const. I:",pos=(10,380),size=(160,30))
        self.sr850control3input = wx.TextCtrl(panel, -1, "100.0",pos=(175,380),size=(80, 20))
        self.Bind(wx.EVT_TEXT, self.updateCurrent, self.sr850control3input)
        
        # Calculate running current
        Current = 1000.0*float(self.sr850control2input.GetValue())/float(self.sr850control3input.GetValue())
        self.sr850control4_2 = wx.StaticText(panel, -1, "I (uA):",pos=(10,410),size=(160,30))
        self.sr850control4output = wx.TextCtrl(panel, -1, "%.1f"%Current,pos=(175,410),size=(60,20))
        self.sr850control4output.Disable()        
        
        self.sr850control6 = wx.StaticText(panel, -1, "Transformer Amplifier:",pos=(10,440),size=(160,30))
        self.sr850control6input = wx.TextCtrl(panel, -1, "100.0",pos=(175,440),size=(80, 20))
        
        self.sr850control4 = wx.StaticText(panel, -1, "dT Allowrance (K) (No-Func):",pos=(10,470),size=(160,30))
        self.sr850control4input = wx.TextCtrl(panel, -1, "0.1",pos=(175,470),size=(80, 20))
        
        self.sr850control5 = wx.StaticText(panel, -1, "Max dT Fluctuation:",pos=(10,500),size=(160,30))
        self.sr850control5input = wx.TextCtrl(panel, -1, "0.1",pos=(175,500),size=(80, 20))
        
        self.sr850control7 = wx.StaticText(panel, -1, "Wait time for T stable (s):",pos=(10,530),size=(160,30))
        self.sr850control7input = wx.TextCtrl(panel, -1, "5",pos=(175,530),size=(80, 20))
Example #4
0
    def __init__(self, parent, id, title):
        # First, call the base class' __init__ method to create the frame
        wx.Frame.__init__(self, parent, id, title, size=(500, 600))

        # Add a panel
        panel = wx.Panel(self)
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)

        # Add a directory selection button
        bottonDic = wx.Button(panel,
                              label="Directory",
                              pos=(10, 10),
                              size=(60, 30))
        self.Bind(wx.EVT_BUTTON, self.directorybutton, bottonDic)
        # Text box for showing the directory
        self.txtDic = wx.TextCtrl(panel, -1, pos=(75, 10), size=(400, 30))
        self.txtDic.SetValue(
            'C:\Users\Supercon\Desktop\Dropbox\FeSe_Projects\Dip_Probe\GPIB_communication\data'
        )
        # disable the textbox, so no one can edit it
        self.txtDic.Disable()

        # Add a filename Button, taking the data file name from user
        bottonFil = wx.Button(panel,
                              label="FileName",
                              pos=(10, 40),
                              size=(60, 30))
        self.Bind(wx.EVT_BUTTON, self.filenamebutton, bottonFil)
        # Text box for showing the filename
        self.txtFil = wx.TextCtrl(panel, -1, pos=(75, 40), size=(400, 30))
        self.txtFil.SetValue('temp.txt')
        # disable the textbox, so no one can edit it
        self.txtDic.Disable()

        # Add a plot realtime data button
        bottonPlot = wx.Button(panel,
                               label="Plot Live",
                               pos=(10, 70),
                               size=(80, 30))
        self.Bind(wx.EVT_BUTTON, self.plotbutton, bottonPlot)
        # Add a plot static/previous data button
        bottonPlotStatic = wx.Button(panel,
                                     label="Plot Static Data",
                                     pos=(90, 70),
                                     size=(100, 30))
        self.Bind(wx.EVT_BUTTON, self.plotbuttonstatic, bottonPlotStatic)

        self.XplotLabel = wx.StaticText(panel,
                                        -1,
                                        "X:",
                                        pos=(200, 70),
                                        size=(20, 30))
        self.plotdict = {
            u"Time": 0,
            u"T_in": 1,
            u"R": 2,
            u"Rstd": 3,
            u"Tin_std": 4,
            u"T_out": 5,
            u"Tout_std": 6,
            u"V_SR850": 7,
            u"T_set": 8,
            u"T_stable": 9
        }
        self.XplotChoices = [u"T_in", u"T_out", u"Time", u"T_stable"]
        self.Xplot = wx.Choice(panel,
                               pos=(221, 70),
                               size=(100, 30),
                               choices=self.XplotChoices)
        self.Xplot.SetSelection(0)
        #self.choice.Bind(wx.EVT_CHOICE, self.onChoice)
        self.XplotLabel = wx.StaticText(panel,
                                        -1,
                                        "Y:",
                                        pos=(330, 70),
                                        size=(20, 30))
        self.YplotChoices = [
            u"Time", u"T_in", u"R", u"Rstd", u"Tin_std", u"T_out", u"Tout_std",
            u"V_SR850", u"T_set", u"T_stable"
        ]
        self.Yplot = wx.Choice(panel,
                               pos=(351, 70),
                               size=(100, 30),
                               choices=self.YplotChoices)
        self.Yplot.SetSelection(2)

        ######################################
        # Temperature start, end, interval input, five of them, so one can choose five different T range
        self.tStart = wx.StaticText(panel,
                                    -1,
                                    "T1 Start(K):",
                                    pos=(10, 100),
                                    size=(60, 30))
        self.tStartval = wx.TextCtrl(panel,
                                     -1,
                                     "4.2",
                                     pos=(75, 100),
                                     size=(60, 20))
        self.tStartval.SetInsertionPoint(0)
        self.tEnd = wx.StaticText(panel,
                                  -1,
                                  "T End(K):",
                                  pos=(160, 100),
                                  size=(60, 30))
        self.tEndval = wx.TextCtrl(panel,
                                   -1,
                                   "30",
                                   pos=(225, 100),
                                   size=(60, 20))
        self.tEndval.SetInsertionPoint(0)
        self.tDividen = wx.StaticText(panel,
                                      -1,
                                      "Dividen:",
                                      pos=(300, 100),
                                      size=(60, 30))
        self.tDividenval = wx.TextCtrl(panel,
                                       -1,
                                       "0.2",
                                       pos=(365, 100),
                                       size=(40, 20))
        self.tDividenval.SetInsertionPoint(0)

        self.tStart2 = wx.StaticText(panel,
                                     -1,
                                     "T2 Start(K):",
                                     pos=(10, 130),
                                     size=(60, 30))
        self.tStartval2 = wx.TextCtrl(panel,
                                      -1,
                                      "N",
                                      pos=(75, 130),
                                      size=(60, 20))
        self.tStartval2.SetInsertionPoint(0)
        self.tEnd2 = wx.StaticText(panel,
                                   -1,
                                   "T End(K):",
                                   pos=(160, 130),
                                   size=(60, 30))
        self.tEndval2 = wx.TextCtrl(panel,
                                    -1,
                                    "N",
                                    pos=(225, 130),
                                    size=(60, 20))
        self.tEndval2.SetInsertionPoint(0)
        self.tDividen2 = wx.StaticText(panel,
                                       -1,
                                       "Dividen:",
                                       pos=(300, 130),
                                       size=(60, 30))
        self.tDividenval2 = wx.TextCtrl(panel,
                                        -1,
                                        "N",
                                        pos=(365, 130),
                                        size=(40, 20))
        self.tDividenval2.SetInsertionPoint(0)

        self.tStart3 = wx.StaticText(panel,
                                     -1,
                                     "T3 Start(K):",
                                     pos=(10, 160),
                                     size=(60, 30))
        self.tStartval3 = wx.TextCtrl(panel,
                                      -1,
                                      "N",
                                      pos=(75, 160),
                                      size=(60, 20))
        self.tStartval3.SetInsertionPoint(0)
        self.tEnd3 = wx.StaticText(panel,
                                   -1,
                                   "T End(K):",
                                   pos=(160, 160),
                                   size=(60, 30))
        self.tEndval3 = wx.TextCtrl(panel,
                                    -1,
                                    "N",
                                    pos=(225, 160),
                                    size=(60, 20))
        self.tEndval3.SetInsertionPoint(0)
        self.tDividen3 = wx.StaticText(panel,
                                       -1,
                                       "Dividen:",
                                       pos=(300, 160),
                                       size=(60, 30))
        self.tDividenval3 = wx.TextCtrl(panel,
                                        -1,
                                        "N",
                                        pos=(365, 160),
                                        size=(40, 20))
        self.tDividenval3.SetInsertionPoint(0)

        self.tStart4 = wx.StaticText(panel,
                                     -1,
                                     "T4 Start(K):",
                                     pos=(10, 190),
                                     size=(60, 30))
        self.tStartval4 = wx.TextCtrl(panel,
                                      -1,
                                      "N",
                                      pos=(75, 190),
                                      size=(60, 20))
        self.tStartval4.SetInsertionPoint(0)
        self.tEnd4 = wx.StaticText(panel,
                                   -1,
                                   "T End(K):",
                                   pos=(160, 190),
                                   size=(60, 30))
        self.tEndval4 = wx.TextCtrl(panel,
                                    -1,
                                    "N",
                                    pos=(225, 190),
                                    size=(60, 20))
        self.tEndval4.SetInsertionPoint(0)
        self.tDividen4 = wx.StaticText(panel,
                                       -1,
                                       "Dividen:",
                                       pos=(300, 190),
                                       size=(60, 30))
        self.tDividenval4 = wx.TextCtrl(panel,
                                        -1,
                                        "N",
                                        pos=(365, 190),
                                        size=(40, 20))
        self.tDividenval4.SetInsertionPoint(0)

        self.tStart5 = wx.StaticText(panel,
                                     -1,
                                     "T5 Start(K):",
                                     pos=(10, 220),
                                     size=(60, 20))
        self.tStartval5 = wx.TextCtrl(panel,
                                      -1,
                                      "N",
                                      pos=(75, 220),
                                      size=(60, 20))
        self.tStartval5.SetInsertionPoint(0)
        self.tEnd5 = wx.StaticText(panel,
                                   -1,
                                   "T End(K):",
                                   pos=(160, 220),
                                   size=(60, 20))
        self.tEndval5 = wx.TextCtrl(panel,
                                    -1,
                                    "N",
                                    pos=(225, 220),
                                    size=(60, 20))
        self.tEndval5.SetInsertionPoint(0)
        self.tDividen5 = wx.StaticText(panel,
                                       -1,
                                       "Dividen:",
                                       pos=(300, 220),
                                       size=(60, 20))
        self.tDividenval5 = wx.TextCtrl(panel,
                                        -1,
                                        "N",
                                        pos=(365, 220),
                                        size=(40, 20))
        self.tDividenval5.SetInsertionPoint(0)
        ####################################

        # Add a textbox for user description of the measurement
        self.description = wx.TextCtrl(panel,
                                       -1,
                                       "None",
                                       pos=(10, 248),
                                       size=(460, 30))

        ####################################
        ## Start Measurement Button
        self.bottonMeasure = wx.Button(panel,
                                       label="Measure",
                                       pos=(10, 280),
                                       size=(60, 30))
        self.Bind(wx.EVT_BUTTON, self.measurebutton, self.bottonMeasure)

        ## Stop Measurement Button
        bottonStop = wx.Button(panel,
                               label="STOP",
                               pos=(80, 280),
                               size=(60, 30))
        self.Bind(wx.EVT_BUTTON, self.stopbutton, bottonStop)

        # Textbox for status update from SR850LTC21 threading
        self.statusMeasure = wx.StaticText(panel,
                                           -1,
                                           "Status:",
                                           pos=(145, 280),
                                           size=(50, 30))
        self.statusMeasureinput = wx.TextCtrl(panel,
                                              -1,
                                              "None",
                                              pos=(200, 280),
                                              size=(270, 20))
        self.statusMeasureinput.SetBackgroundColour((230, 230, 230))
        self.statusMeasureinput.Disable()

        # create a pubsub receiver for receiving updates from SR850LTC21 threading
        Publisher.subscribe(self.updateDisplay, "update")

        # initialize the global stop flag
        GlobalFlag.init()
        ####################################

        ###########################################################
        # User input parameters for measurement: SR850scanlength,SR850SinRMS,CurrentResistance
        self.sr850control1 = wx.StaticText(panel,
                                           -1,
                                           "SR850 Scanlength (s):",
                                           pos=(10, 320),
                                           size=(160, 30))
        self.sr850control1input = wx.TextCtrl(panel,
                                              -1,
                                              "10.0",
                                              pos=(175, 320),
                                              size=(80, 20))

        self.sr850control2 = wx.StaticText(panel,
                                           -1,
                                           "SR850 Output RMS (V):",
                                           pos=(10, 350),
                                           size=(160, 30))
        self.sr850control2input = wx.TextCtrl(panel,
                                              -1,
                                              "1.0",
                                              pos=(175, 350),
                                              size=(80, 20))
        self.Bind(wx.EVT_TEXT, self.updateCurrent, self.sr850control2input)

        self.sr850control3 = wx.StaticText(panel,
                                           -1,
                                           "R (kOhm) for Const. I:",
                                           pos=(10, 380),
                                           size=(160, 30))
        self.sr850control3input = wx.TextCtrl(panel,
                                              -1,
                                              "100.0",
                                              pos=(175, 380),
                                              size=(80, 20))
        self.Bind(wx.EVT_TEXT, self.updateCurrent, self.sr850control3input)

        # Calculate running current
        Current = 1000.0 * float(self.sr850control2input.GetValue()) / float(
            self.sr850control3input.GetValue())
        self.sr850control4_2 = wx.StaticText(panel,
                                             -1,
                                             "I (uA):",
                                             pos=(10, 410),
                                             size=(160, 30))
        self.sr850control4output = wx.TextCtrl(panel,
                                               -1,
                                               "%.1f" % Current,
                                               pos=(175, 410),
                                               size=(60, 20))
        self.sr850control4output.Disable()

        self.sr850control6 = wx.StaticText(panel,
                                           -1,
                                           "Transformer Amplifier:",
                                           pos=(10, 440),
                                           size=(160, 30))
        self.sr850control6input = wx.TextCtrl(panel,
                                              -1,
                                              "100.0",
                                              pos=(175, 440),
                                              size=(80, 20))

        self.sr850control4 = wx.StaticText(panel,
                                           -1,
                                           "dT Allowrance (K) (No-Func):",
                                           pos=(10, 470),
                                           size=(160, 30))
        self.sr850control4input = wx.TextCtrl(panel,
                                              -1,
                                              "0.1",
                                              pos=(175, 470),
                                              size=(80, 20))

        self.sr850control5 = wx.StaticText(panel,
                                           -1,
                                           "Max dT Fluctuation:",
                                           pos=(10, 500),
                                           size=(160, 30))
        self.sr850control5input = wx.TextCtrl(panel,
                                              -1,
                                              "0.1",
                                              pos=(175, 500),
                                              size=(80, 20))

        self.sr850control7 = wx.StaticText(panel,
                                           -1,
                                           "Wait time for T stable (s):",
                                           pos=(10, 530),
                                           size=(160, 30))
        self.sr850control7input = wx.TextCtrl(panel,
                                              -1,
                                              "5",
                                              pos=(175, 530),
                                              size=(80, 20))