def run_expt(expt): global w w.eye.fd.close() # Close hardware port cmd = sys.executable + ' ' + eyeplot.abs_path() + expt+'.py' os.system(cmd) showhelp(_('Finished ') + expt) w.eye = eyes.open() # Open hardware port again w.eye.disable_actions()
def run_expt(expt): global w if os.name == 'nt': # For windows OS w.eye.fd.close() # Close hardware port cmd = sys.executable + ' ' + eyeplot.abs_path() + expt+'.py' os.system(cmd) w.eye = eyes.open() # Open hardware port again showhelp('Finished ' + expt) else: #print abs_path() + expt+'.py' stat,out = subprocess.getstatusoutput('python '+ eyeplot.abs_path() + expt+'.py') if stat != 0: showhelp(out) else: showhelp('Finished "'+expt+'.py"') w.eye.disable_actions()
def run_expt(expt): global w w.eye.fd.close() # Close hardware port if os.name == 'nt': # For windows OS cmd = sys.executable + ' ' + eyeplot.abs_path() + expt+'.py' os.system(cmd) showhelp(_('Finished ') + expt) else: #print abs_path() + expt+'.py' stat,out = commands.getstatusoutput('python '+ eyeplot.abs_path() + expt+'.py') if stat != 0: showhelp(out) else: showhelp(_('Finished "')+expt+'.py"') w.eye = eyes.open() # Open hardware port again w.eye.disable_actions()
def run_expt(expt): global w w.eye.fd.close() # Close hardware port if os.name == "nt": # For windows OS cmd = sys.executable + " " + eyeplot.abs_path() + expt + ".py" os.system(cmd) showhelp(_("Finished ") + expt) else: # print abs_path() + expt+'.py' stat, out = commands.getstatusoutput("python " + eyeplot.abs_path() + expt + ".py") if stat != 0: showhelp(out) else: showhelp(_('Finished "') + expt + '.py"') w.eye = eyes.open() # Open hardware port again w.eye.disable_actions()
Io = f[1][0] a1 = f[1][1] T = 300.0 # Room temp in Kelvin n = q/(a1*k*T) s = _('Fitted with Diode Equation : Io = %5.2e mA , Ideality factor = %5.2f')%(Io,n) msg.config(text = s) def clear(): global history, trial, running if running == True: return g.delete_lines() history = [] trial = 0 p = eyes.open() p.loadall_calib() p.disable_actions() root = Tk() Canvas(root, width = WIDTH, height = 5).pack(side=TOP) # Some space at the top g = eyeplot.graph(root, width=WIDTH, height=HEIGHT) # make plot objects using draw.disp g.setWorld(MINX, MINY, MAXX, MAXY,_('V'),_('mA')) cf = Frame(root, width = WIDTH, height = 10) cf.pack(side=TOP, fill = BOTH, expand = 1) ZEN = IntVar() cb0 = Checkbutton(cf,text =_('ZENER'), variable=ZEN, fg = 'black') cb0.pack(side=LEFT, anchor = SW) b1 = Button(cf, text = _('START'), command = start) b1.pack(side = LEFT, anchor = N)
if fa != None: pa = fa[1] s = _('CH0 Vp = %5.2f V | Freq = %5.2f Hz ') % (abs( pa[0]), pa[1] * 1000) fb = eyemath.fit_sine(tt, vv) if fb != None: pb = fb[1] s = s + _('CH1 Vp = %5.2f V | Freq = %5.2f Hz') % (abs( pb[0]), pb[1] * 1000) msgwin.config(text=s) else: g.delete_lines() root.after(10, update) p = eyes.open() p.loadall_calib() root = Tk() Canvas(root, width=WIDTH, height=5).pack(side=TOP) # Some space at the top g = eyeplot.graph(root, width=WIDTH, height=HEIGHT) # make plot objects using draw.disp g.setWorld(0, -5, 20, 5, _('mS'), _('V')) cf = Frame(root, width=WIDTH, height=10) cf.pack(side=TOP, fill=BOTH, expand=1) l = Label(cf, text=_('mS/div')) l.pack(side=LEFT, anchor=SW) timebase = Scale(cf,command = set_timebase, orient=HORIZONTAL, length=50, showvalue=False,\ from_ = 0, to=9, resolution=1) timebase.pack(side=LEFT, anchor=SW) l = Label(cf, text=_('Volt/div'))
def __init__(self, parent, opts, locale="fr_FR"): """ Le constructeur @param parent un QWidget @param opts une liste d'options extraite à l'aide de getopts @param locale la langue de l'application """ QMainWindow.__init__(self) QWidget.__init__(self, parent) self.locale = locale from Ui_main import Ui_Dialog self.ui = Ui_Dialog() self.ui.setupUi(self) self.ui.graphWidget.setWorld(0, -5, 1, 5) # begins with A0 checked self.ui.A0Check.setCheckState(Qt.Checked) # connects the panel's great button self.connect(self.ui.panelButton, SIGNAL("clicked()"), self.panelHelp) # clears the text browser self.showhelp("") # initialize self.tw: table of widgets which are on the panel self.NSIG = 1 + 32 # number of signals; zeroth element is unused self.tw = [None] * self.NSIG # left entry widgets: 6, 7, 10 self.setTwDisplay(1, self.ui.ID0_display) self.setTwDisplay(2, self.ui.ID0_display) self.setTwEdit(6, self.ui.SQR1_edit) self.setTwEdit(7, self.ui.SQR2_edit) self.setTwDisplay(8, self.ui.SQR2_display) self.setTwEdit(10, self.ui.PULSE_edit) self.setTwDisplay(15, self.ui.FREQ_display) self.setTwDisplay(22, self.ui.SEN_display_2) self.setTwDisplay(23, self.ui.SEN_display) self.setTwDisplay(24, self.ui.A2_display) self.setTwDisplay(25, self.ui.A1_display) self.setTwDisplay(26, self.ui.A0_display) self.setTwDisplay(27, self.ui.CS_display) self.setTwEdit(28, self.ui.CS_edit) self.setTwEdit(30, self.ui.BPV_edit) self.setTwEdit(31, self.ui.UPV_edit) self.connect(self.ui.OD0_check, SIGNAL("stateChanged(int)"), self.OD0toggle) self.connect(self.ui.OD1_check, SIGNAL("stateChanged(int)"), self.OD1toggle) self.connect(self.ui.ID0_button_F, SIGNAL("clicked()"), self.freq_id0) self.connect(self.ui.AMPLI_button_F, SIGNAL("clicked()"), self.freq_ampin) self.connect(self.ui.SEN_button_F, SIGNAL("clicked()"), self.freq_sen) self.connect(self.ui.ID0_button_pcent, SIGNAL("clicked()"), self.pcent_id0) self.connect(self.ui.horizontalSlider, SIGNAL("valueChanged(int)"), self.set_timebase) self.connect(self.ui.A0Check, SIGNAL("stateChanged(int)"), self.toggleA0) self.connect(self.ui.A1Check, SIGNAL("stateChanged(int)"), self.toggleA1) self.connect(self.ui.fitCheck, SIGNAL("stateChanged(int)"), self.toggleFit) self.connect(self.ui.lisCheck, SIGNAL("stateChanged(int)"), self.toggleLis) self.connect(self.ui.saveButton, SIGNAL("clicked()"), self.save) self.connect(self.ui.xmButton, SIGNAL("clicked()"), self.xmgrace) self.connect(self.ui.ftButton, SIGNAL("clicked()"), self.do_fft) self.connect(self.ui.quitButton, SIGNAL("clicked()"), self.close) # other intializations self.VPERDIV = 1.0 # Volts per division, vertical scale self.delay = 10 # Time interval between samples self.np = 100 # Number of samples self.nc = 1 # Number of channels self.lissa = False # drawing lissajous-type plots self.chanmask = 1 # byte to store the mask for active analogic channels. self.np = 100 # number of points to plot (and samples to get) self.delay = 10 # delay for measurements (µs between two samples) self.measure = 0 # boolean to toggle data fitting self.NOSQR2 = True # SQR2 is not set self.NOSF = True # No frequency on SENSOR input self.NOAF = True # No frequency on Amplifier input, T15 self.NODF = True # No frequency on Digital input 0 self.OUTMASK = 0 # Digital outputs to LOW # connect to the eyes box self.eye = eyes.open() # Try several times to make a connection # starts the timer for refresh loop if self.eye == None: self.setWindowTitle("EYES Hardware NOT found.") self.showhelp("EYES Hardware Not Found.<br/>Re-Connect USB cable and restart the program.", "red") else: self.setWindowTitle(("EYES Hardware found on " + str(self.eye.device))) self.eye.write_outputs(0) self.eye.disable_actions() self.eye.loadall_calib() self.timer = QTimer(self) self.connect(self.timer, SIGNAL("timeout()"), self.update) self.timer.start(500) # refresh twice per second if possible
msg.config(text = _('Data saved to file ')+s) def clear(): global history, trial, running if running == True: return g.delete_lines() history = [] trial = 0 def quit(): ph.set_sqr1(0) sys.exit() ph = eyes.open() ph.loadall_calib() root = Tk() Canvas(root, width = WIDTH, height = 5).pack(side=TOP) # Some space at the top g = eyeplot.graph(root, width=WIDTH, height=HEIGHT) # make plot objects using draw.disp g.setWorld(fmin, 0, fmax, 5.0,_('Freq'),_('Amp')) cf = Frame(root, width = WIDTH, height = 10) cf.pack(side=TOP, fill = BOTH, expand = 1) b1 = Button(cf, text = _('START'), command = start) b1.pack(side = LEFT, anchor = N) b3 = Button(cf, text = _('SAVE to'), command = save) b3.pack(side = LEFT, anchor = N) filename = StringVar() e1 =Entry(cf, width=15, bg = 'white', textvariable = filename)
def lissa_mode(): global lissa,delay, NP, NC, VPERDIV lissa = LIZ.get() if lissa == 1: lissa = True else: g.setWorld(0,-5*VPERDIV, NP * delay * 0.001, 5*VPERDIV,_('mS'),'V') # Restore old scale lissa = False #-----------------------------main program starts here----------------------------- for k in range(10): # Test the hardware availability by by running another program. stat,out = commands.getstatusoutput('python '+ eyeplot.abs_path() + 'hwtest.py') if stat == 0: break pe = eyes.open() # Try several times to make a connection root = Tk() left = Frame(root) # Divide root window into Left and Right left.pack(side=LEFT, anchor = S) right = Frame(root) right.pack(side = LEFT, anchor = S, fill = Y), w=eyePanel(left, pe, WIDTH, HEIGHT) # Panel photograph to the Left Panel g = eyeplot.graph(right, WIDTH*1.05, HEIGHT*2./3,color = 'white', labels=False) # Plot window g.setWorld(0,-5*VPERDIV, NP * delay * 0.001, 5*VPERDIV,_('mS'),'V') cf = Frame(right) # Command Frame, inside the right frame, below plot window cf.pack(side=TOP, anchor = NW) l = Label(cf, text=_('mS/div')) l.pack(side=LEFT, anchor = SW )
def clear(): global history, trial, running if running == True: return g.delete_lines() history = [] trial = 0 def quit(): ph.set_sqr1(0) sys.exit() ph = eyes.open() ph.loadall_calib() root = Tk() Canvas(root, width=WIDTH, height=5).pack(side=TOP) # Some space at the top g = eyeplot.graph(root, width=WIDTH, height=HEIGHT) # make plot objects using draw.disp g.setWorld(fmin, 0, fmax, 5.0, _('Freq'), _('Amp')) cf = Frame(root, width=WIDTH, height=10) cf.pack(side=TOP, fill=BOTH, expand=1) b1 = Button(cf, text=_('START'), command=start) b1.pack(side=LEFT, anchor=N) b3 = Button(cf, text=_('SAVE to'), command=save) b3.pack(side=LEFT, anchor=N) filename = StringVar()
def __init__(self, parent, opts, locale="fr_FR"): """ Le constructeur @param parent un QWidget @param opts une liste d'options extraite à l'aide de getopts @param locale la langue de l'application """ QMainWindow.__init__(self) QWidget.__init__(self, parent) self.locale = locale from Ui_main import Ui_Dialog self.ui = Ui_Dialog() self.ui.setupUi(self) self.ui.graphWidget.setWorld(0, -5, 1, 5) # begins with A0 checked self.ui.A0Check.setCheckState(Qt.Checked) # connects the panel's great button self.connect(self.ui.panelButton, SIGNAL("clicked()"), self.panelHelp) # clears the text browser self.showhelp('') # initialize self.tw: table of widgets which are on the panel self.NSIG = 1 + 32 # number of signals; zeroth element is unused self.tw = [None] * self.NSIG # left entry widgets: 6, 7, 10 self.setTwDisplay(1, self.ui.ID0_display) self.setTwDisplay(2, self.ui.ID0_display) self.setTwEdit(6, self.ui.SQR1_edit) self.setTwEdit(7, self.ui.SQR2_edit) self.setTwDisplay(8, self.ui.SQR2_display) self.setTwEdit(10, self.ui.PULSE_edit) self.setTwDisplay(15, self.ui.FREQ_display) self.setTwDisplay(22, self.ui.SEN_display_2) self.setTwDisplay(23, self.ui.SEN_display) self.setTwDisplay(24, self.ui.A2_display) self.setTwDisplay(25, self.ui.A1_display) self.setTwDisplay(26, self.ui.A0_display) self.setTwDisplay(27, self.ui.CS_display) self.setTwEdit(28, self.ui.CS_edit) self.setTwEdit(30, self.ui.BPV_edit) self.setTwEdit(31, self.ui.UPV_edit) self.connect(self.ui.OD0_check, SIGNAL("stateChanged(int)"), self.OD0toggle) self.connect(self.ui.OD1_check, SIGNAL("stateChanged(int)"), self.OD1toggle) self.connect(self.ui.ID0_button_F, SIGNAL("clicked()"), self.freq_id0) self.connect(self.ui.AMPLI_button_F, SIGNAL("clicked()"), self.freq_ampin) self.connect(self.ui.SEN_button_F, SIGNAL("clicked()"), self.freq_sen) self.connect(self.ui.ID0_button_pcent, SIGNAL("clicked()"), self.pcent_id0) self.connect(self.ui.horizontalSlider, SIGNAL("valueChanged(int)"), self.set_timebase) self.connect(self.ui.A0Check, SIGNAL("stateChanged(int)"), self.toggleA0) self.connect(self.ui.A1Check, SIGNAL("stateChanged(int)"), self.toggleA1) self.connect(self.ui.fitCheck, SIGNAL("stateChanged(int)"), self.toggleFit) self.connect(self.ui.lisCheck, SIGNAL("stateChanged(int)"), self.toggleLis) self.connect(self.ui.saveButton, SIGNAL("clicked()"), self.save) self.connect(self.ui.xmButton, SIGNAL("clicked()"), self.xmgrace) self.connect(self.ui.ftButton, SIGNAL("clicked()"), self.do_fft) self.connect(self.ui.quitButton, SIGNAL("clicked()"), self.close) # other intializations self.VPERDIV = 1.0 # Volts per division, vertical scale self.delay = 10 # Time interval between samples self.np = 100 # Number of samples self.nc = 1 # Number of channels self.lissa = False # drawing lissajous-type plots self.chanmask = 1 # byte to store the mask for active analogic channels. self.np = 100 # number of points to plot (and samples to get) self.delay = 10 # delay for measurements (µs between two samples) self.measure = 0 # boolean to toggle data fitting self.NOSQR2 = True # SQR2 is not set self.NOSF = True # No frequency on SENSOR input self.NOAF = True # No frequency on Amplifier input, T15 self.NODF = True # No frequency on Digital input 0 self.OUTMASK = 0 # Digital outputs to LOW # connect to the eyes box self.eye = eyes.open() # Try several times to make a connection # starts the timer for refresh loop if self.eye == None: self.setWindowTitle('EYES Hardware NOT found.') self.showhelp( 'EYES Hardware Not Found.<br/>Re-Connect USB cable and restart the program.', 'red') else: self.setWindowTitle( ('EYES Hardware found on ' + str(self.eye.device))) self.eye.write_outputs(0) self.eye.disable_actions() self.eye.loadall_calib() self.timer = QTimer(self) self.connect(self.timer, SIGNAL("timeout()"), self.update) self.timer.start(500) # refresh twice per second if possible
showhelp('Finished "' + expt + '.py"') w.eye.disable_actions() #-----------------------------main program starts here----------------------------- if __name__ == "__main__": for k in range( 20 ): # Test the hardware availability by by running another program. stat, out = subprocess.getstatusoutput('python ' + eyeplot.abs_path() + 'hwtest.py') print(stat) if stat == 0: break pe = eyes.open() # Try several times to make a connection root = Tk() left = Frame(root) # Divide root window into Left and Right left.pack(side=LEFT, anchor=S) right = Frame(root) right.pack(side=LEFT, anchor=S, fill=Y) w = eyePanel(left, pe, WIDTH, HEIGHT) # Panel photograph to the Left Panel g = eyeplot.graph(right, WIDTH * 1.05, HEIGHT * 2. / 3, color='white', labels=False) # Plot window g.setWorld(0, -5 * VPERDIV, NP * delay * 0.001, 5 * VPERDIV, 'mS', 'V')