def register(self): self.lock = threading.Lock() self.controlwin = None self.origin = [0., 0.] try: self.lock.acquire() devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) self.server_ip = devname.split(':')[0] self.server_port = int(devname.split(':')[1]) if self.ui_target: self.hbox = gtk.HBox(False, 5) pb = gtk.ToggleButton('Show Pos Control') pb.connect('toggled', self.pb_toggled, None) self.hbox.pack_start(pb, True, True, 5) self.ui_target.pack_start(self.hbox, False, False, 5) self.ui_target.show_all() finally: self.lock.release() return True
def register(self): self.lock = threading.Lock() devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) self.dmm = Gpib.Gpib(devname) self.dmm.clear() time.sleep(.1) self.dmm.range = .1 self.set_speed(self.dmm, 'NORM') if self.ui_target: self.speedchoice = gtk.combo_box_entry_new_text() for string in ['NORM', 'FAST', 'SLOW']: self.speedchoice.append_text(string) iter = self.speedchoice.get_model().get_iter_first() self.speedchoice.set_active_iter(iter) self.speedchoice.connect("changed", self.set_speed_clicked) dmmspeed = gtk.Label("%s" % (self.alias)) self.tophbox = gtk.HBox(False, 5) self.tophbox.pack_start(dmmspeed, True, True, 5) self.tophbox.pack_start(self.speedchoice, True, True, 5) self.ui_target.pack_start(self.tophbox, False, False, 5) self.ui_target.show_all()
def register(self): if self.ui_target: self.topvbox = gtk.VBox(False, 0) self.ui_target.pack_start(self.topvbox, False, False, 5) self.ui_target.show_all() self.lock = threading.Lock() try: self.lock.acquire() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) self.Keithley = Gpib.Gpib(devname) self.Keithley.clear() self.Keithley.write('*RST'); self.Keithley.write(':SOUR:FUNC VOLT'); self.Keithley.write(':SOUR:VOLT:RANG 20'); self.Keithley.write(':SENS:FUNC "CURR"'); self.Keithley.write(':SENS:CURR:PROT 15e-3'); self.Keithley.write(':SENS:CURR:RANG 100e-3'); self.Keithley.write(':SENS:CURR:NPLC 0.1'); self.Keithley.write('OUTP ON'); finally: self.lock.release() self.Keithley.state = self.K_read_V()
def register(self): self.lock = threading.Lock() self.controlwin = None self.origin = [0., 0.] try: self.lock.acquire() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) self.server_ip = devname.split(':')[0] self.server_port = int(devname.split(':')[1]) if self.ui_target: self.hbox = gtk.HBox(False, 5) pb = gtk.ToggleButton('Show Pos Control') pb.connect('toggled', self.pb_toggled, None) self.hbox.pack_start(pb, True, True, 5) self.ui_target.pack_start(self.hbox, False, False, 5) self.ui_target.show_all() finally: self.lock.release() return True
def register(self): self.lock = threading.Lock() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) self.dmm = Gpib.Gpib(devname) self.dmm.clear() time.sleep(.1) self.dmm.range = .1 self.set_speed(self.dmm, 'NORM') if self.ui_target: self.speedchoice = gtk.combo_box_entry_new_text() for string in ['NORM','FAST', 'SLOW']: self.speedchoice.append_text(string) iter = self.speedchoice.get_model().get_iter_first() self.speedchoice.set_active_iter(iter) self.speedchoice.connect("changed", self.set_speed_clicked) dmmspeed = gtk.Label("%s"%(self.alias)) self.tophbox = gtk.HBox(False, 5) self.tophbox.pack_start(dmmspeed, True, True, 5) self.tophbox.pack_start(self.speedchoice, True, True, 5) self.ui_target.pack_start(self.tophbox, False, False, 5) self.ui_target.show_all()
def register(self): if self.ui_target: self.topvbox = gtk.VBox(False, 0) self.ui_target.pack_start(self.topvbox, False, False, 5) self.ui_target.show_all() self.lock = threading.Lock() try: self.lock.acquire() devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) self.Keithley = Gpib.Gpib(devname) self.Keithley.clear() self.Keithley.write('*RST') self.Keithley.write(':SOUR:FUNC VOLT') self.Keithley.write(':SOUR:VOLT:RANG 20') self.Keithley.write(':SENS:FUNC "CURR"') self.Keithley.write(':SENS:CURR:PROT 15e-3') self.Keithley.write(':SENS:CURR:RANG 100e-3') self.Keithley.write(':SENS:CURR:NPLC 0.1') self.Keithley.write('OUTP ON') finally: self.lock.release() self.Keithley.state = self.K_read_V()
def register(self): self.lock = threading.Lock() # helpers.devmap_remap takes a string and returns a # corresponding value from devmap.data_acq file. Used # to configure gpib/serial addresses, and alias for the # device. See the file in ~ionsearch/data_acq. devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) # Create a lock to serialize all communication self.lock.acquire() try: # Open the device self.fd = os.open(devname, os.O_NONBLOCK | os.O_RDONLY) if (self.fd < 0): raise "Error opening %s!" % devname # Pause time.sleep(.1) finally: # release the lock self.lock.release() # We cache last value self.lastvalue = { 'TIME': 0, 'TOTAL': 0, 'MAX': 0, 'MIN': 0, 'CENTERX': 0, 'CENTERY': 0 }
def register(self): self.lock = threading.Lock() # helpers.devmap_remap takes a string and returns a # corresponding value from devmap.data_acq file. Used # to configure gpib/serial addresses, and alias for the # device. See the file in ~ionsearch/data_acq. devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) # Create a lock to serialize all communication self.lock.acquire() try: # Open the device self.fd = os.open(devname, os.O_NONBLOCK|os.O_RDONLY) if (self.fd < 0): raise "Error opening %s!" % devname # Pause time.sleep(.1) finally: # release the lock self.lock.release() # We cache last value self.lastvalue = {'TIME': 0, 'TOTAL': 0, 'MAX': 0, 'MIN': 0, 'CENTERX': 0, 'CENTERY': 0}
def register(self): self.device = {} self.device['lock'] = threading.Lock() self.dacstate = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] try: self.device['lock'].acquire() devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.device['serverip'] = socket.gethostbyname( devname.split(':')[0]) self.device['serverport'] = int(devname.split(':')[1]) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) finally: self.device['lock'].release() if self.ui_target: self.speedchoice1 = gtk.combo_box_entry_new_text() for string in ['NORM', 'FAST', 'SLOW']: self.speedchoice1.append_text(string) iter = self.speedchoice1.get_model().get_iter_first() self.speedchoice1.set_active_iter(iter) self.speedchoice1.connect("changed", self.set_speed_clicked, 1) dmmspeed1 = gtk.Label("%s_ADC1" % (self.alias)) self.speedchoice2 = gtk.combo_box_entry_new_text() for string in ['NORM', 'FAST', 'SLOW']: self.speedchoice2.append_text(string) iter = self.speedchoice2.get_model().get_iter_first() self.speedchoice2.set_active_iter(iter) self.speedchoice2.connect("changed", self.set_speed_clicked, 2) dmmspeed2 = gtk.Label("%s_ADC2" % (self.alias)) hbox1 = gtk.HBox(False, 5) hbox1.pack_start(dmmspeed1, True, True, 5) hbox1.pack_start(self.speedchoice1, True, True, 5) hbox2 = gtk.HBox(False, 5) hbox2.pack_start(dmmspeed2, True, True, 5) hbox2.pack_start(self.speedchoice2, True, True, 5) self.topvbox = gtk.VBox(False, 5) self.topvbox.pack_start(hbox1, True, True, 5) self.topvbox.pack_start(hbox2, True, True, 5) self.ui_target.pack_start(self.topvbox, False, False, 5) self.ui_target.show_all() # sync up the ADCs to us self.set_speed(1, "NORM") self.set_speed(2, "NORM")
def register(self): self.device = {} self.device['lock'] = threading.Lock() self.dacstate = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] try: self.device['lock'].acquire() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.device['serverip'] = socket.gethostbyname(devname.split(':')[0]) self.device['serverport'] = int(devname.split(':')[1]) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) finally: self.device['lock'].release() if self.ui_target: self.speedchoice1 = gtk.combo_box_entry_new_text() for string in ['NORM','FAST', 'SLOW']: self.speedchoice1.append_text(string) iter = self.speedchoice1.get_model().get_iter_first() self.speedchoice1.set_active_iter(iter) self.speedchoice1.connect("changed", self.set_speed_clicked, 1) dmmspeed1 = gtk.Label("%s_ADC1"%(self.alias)) self.speedchoice2 = gtk.combo_box_entry_new_text() for string in ['NORM','FAST', 'SLOW']: self.speedchoice2.append_text(string) iter = self.speedchoice2.get_model().get_iter_first() self.speedchoice2.set_active_iter(iter) self.speedchoice2.connect("changed", self.set_speed_clicked, 2) dmmspeed2 = gtk.Label("%s_ADC2"%(self.alias)) hbox1 = gtk.HBox(False, 5) hbox1.pack_start(dmmspeed1, True, True, 5) hbox1.pack_start(self.speedchoice1, True, True, 5) hbox2 = gtk.HBox(False, 5) hbox2.pack_start(dmmspeed2, True, True, 5) hbox2.pack_start(self.speedchoice2, True, True, 5) self.topvbox = gtk.VBox(False, 5) self.topvbox.pack_start(hbox1, True, True, 5) self.topvbox.pack_start(hbox2, True, True, 5) self.ui_target.pack_start(self.topvbox, False, False, 5) self.ui_target.show_all() # sync up the ADCs to us self.set_speed(1, "NORM") self.set_speed(2, "NORM")
def register(self): self.lock = threading.Lock() self.lock.acquire() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) self.psup = Gpib.Gpib(devname) self.psup.clear() time.sleep(.1) #self.psup.write('*RST') #self.psup.write('OUTP:ON') self.lock.release()
def register(self): self.lock = threading.Lock() self.lock.acquire() devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) self.psup = Gpib.Gpib(devname) self.psup.clear() time.sleep(.1) #self.psup.write('*RST') #self.psup.write('OUTP:ON') self.lock.release()
def register(self): self.lock = threading.Lock() # calling the "Lock" function under class "threading"."()" implies Lock is a func try: # the daq suite has multiple programs working in parallel, lock makes sure that self.lock.acquire() # when one is changing the parameters, no others can change it simultaneously devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) finally: self.lock.release() if self.ui_target: pass self.tds = Gpib.Gpib(devname) # self.tds is now the gpib buffer self.tds.clear() # clear the gpib buffer time.sleep(.1) self.tds.range = .1
def register(self): self.device = {} self.device['lock'] = threading.Lock() try: self.device['lock'].acquire() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.device['serverip'] = socket.gethostbyname(devname.split(':')[0]) self.device['serverport'] = int(devname.split(':')[1]) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) finally: self.device['lock'].release() if self.ui_target: pass
def register(self): self.lock = threading.Lock() try: self.lock.acquire() devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) self.Agilent = Gpib.Gpib(devname) self.Agilent.clear() time.sleep(.1) # Annoying line that resets the signal generator so you loose the # ion: # self.Agilent.write('*RST'); # self.Agilent.write('APPL:DC DEF,DEF,0'); # self.Agilent.write('OUTP:LOAD INF'); self.Agilent.state = { 'mode': 'DC', 'Vh': 0., 'Vl': 0., 'PW': 1e-4, 'f': 1000.0 } # self.Agilent.write('OUTP ON'); finally: self.lock.release() if self.ui_target: self.modechoice = gtk.combo_box_entry_new_text() for string in ['DC', 'PULSE', 'SIN', 'SQUARE']: self.modechoice.append_text(string) iter = self.modechoice.get_model().get_iter_first() self.modechoice.set_active_iter(iter) self.modechoice.connect("changed", self.set_modechoice_clicked) wsmode = gtk.Label("%s" % (self.alias)) self.tophbox = gtk.HBox(False, 5) self.tophbox.pack_start(wsmode, True, True, 5) self.tophbox.pack_start(self.modechoice, True, True, 5) self.ui_target.pack_start(self.tophbox, False, False, 5) self.ui_target.show_all()
def register(self): if self.ui_target: self.topvbox = gtk.VBox(False, 0) self.ui_target.pack_start(self.topvbox, False, False, 5) self.ui_target.show_all() self.lock = threading.Lock() try: self.lock.acquire() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) self.server_ip = devname.split(':')[0] self.server_port = int(devname.split(':')[1]) finally: self.lock.release()
def register(self): self.lock = threading.Lock( ) # calling the "Lock" function under class "threading"."()" implies Lock is a func try: # the daq suite has multiple programs working in parallel, lock makes sure that self.lock.acquire( ) # when one is changing the parameters, no others can change it simultaneously devname = helpers.devmap_remap("%s:dev" % (DEVICENAME)) assert devname, "Did not find %s in devmap" % (DEVICENAME) self.alias = helpers.devmap_remap("%s:alias" % (DEVICENAME)) assert self.alias, "Did not find alias for %s" % (DEVICENAME) finally: self.lock.release() if self.ui_target: pass self.tds = Gpib.Gpib(devname) # self.tds is now the gpib buffer self.tds.clear() # clear the gpib buffer time.sleep(.1) self.tds.range = .1
def register(self): if self.ui_target: self.topvbox = gtk.VBox(gtk.FALSE, 0) self.ui_target.pack_start(self.topvbox, gtk.FALSE, gtk.FALSE, 5) self.ui_target.show_all() self.lock = threading.Lock() try: self.lock.acquire() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) self.rfgen = Gpib.Gpib(devname) self.rfgen.clear() time.sleep(.1) finally: self.lock.release()
def register(self): self.lock = threading.Lock() try: self.lock.acquire() devname = helpers.devmap_remap("%s:dev"%(DEVICENAME)) assert devname, "Did not find %s in devmap"%(DEVICENAME) self.alias = helpers.devmap_remap("%s:alias"%(DEVICENAME)) assert self.alias, "Did not find alias for %s"%(DEVICENAME) self.Agilent = Gpib.Gpib(devname) self.Agilent.clear() time.sleep(.1) # Annoying line that resets the signal generator so you loose the # ion: # self.Agilent.write('*RST'); # self.Agilent.write('APPL:DC DEF,DEF,0'); # self.Agilent.write('OUTP:LOAD INF'); self.Agilent.state = {'mode' : 'DC', 'Vh' : 0., 'Vl' : 0., 'PW' : 1e-4, 'f' : 1000.0} # self.Agilent.write('OUTP ON'); finally: self.lock.release() if self.ui_target: self.modechoice = gtk.combo_box_entry_new_text() for string in ['DC','PULSE', 'SIN', 'SQUARE']: self.modechoice.append_text(string) iter = self.modechoice.get_model().get_iter_first() self.modechoice.set_active_iter(iter) self.modechoice.connect("changed", self.set_modechoice_clicked) wsmode = gtk.Label("%s"%(self.alias)) self.tophbox = gtk.HBox(False, 5) self.tophbox.pack_start(wsmode, True, True, 5) self.tophbox.pack_start(self.modechoice, True, True, 5) self.ui_target.pack_start(self.tophbox, False, False, 5) self.ui_target.show_all()