def __init__(self,name="Kepco",address='COM4',enabled=True,timeout=1): #if ':' not in address: address+=':22518' if address[:3].upper()=='COM': SerialInstrument.__init__(self,name,address,enabled,timeout) self.query_sleep=0.05 self.recv_length=65536 self.Remote()
def write(self, s, port=None): if port is not None: self.write("SNDT %x,#3%03d%s\n" % (port, len(s), s)) if self.protocol == 'serial': SerialInstrument.write(self, s) if self.protocol == 'socket': VisaInstrument.write(self, s)
def __init__(self, name='spec_analyzer', protocol='socket', address='', port=23, enabled=True, timeout=.1, recv_length=1024, query_sleep=0.005, lo_power=10, lo_offset=10.55e6, baudrate=115200): self.lo_offset = lo_offset self.lo_power = lo_power if (address.count('.') == 3): #the address is in an IP address format self.protocol = 'socket' else: #otherwise we treat the address as port self.protocol = 'serial' if address != '': port = int(address) if self.protocol == 'serial': SerialInstrument.__init__(self, name, port, enabled, timeout, recv_length, baudrate=baudrate, querysleep=query_sleep) self.term_char = '' time.sleep(2) print(self.read()) elif self.protocol == 'socket': if ':' in address: SocketInstrument.__init__(self, name, address, enabled, timeout, recv_length) else: SocketInstrument.__init__(self, name, address+':'+str(port), enabled, timeout, recv_length) self.recv_length = recv_length self.term_char = '' self.query_sleep = query_sleep else: print('The protocol requested is not valid.')
def __init__(self, name="Kepco", address='COM4', enabled=True, timeout=1): #if ':' not in address: address+=':22518' if address[:3].upper() == 'COM': SerialInstrument.__init__(self, name, address, enabled, timeout) self.query_sleep = 0.05 self.recv_length = 65536 self.Remote()
def __init__(self,name="",address='COM6',enabled=True,timeout=0): if address[:3].upper()=='COM': SerialInstrument.__init__(self,name,address,enabled,timeout,querysleep=0.1) self.term_char='\r' self.boxaddress = '00' else: WebInstrument.__init__(self,name,address,enabled)
def __init__(self,name="Lakeshore",address='COM4',enabled=True,timeout=1): #if ':' not in address: address+=':22518' if address[:3].upper()=='COM': SerialInstrument.__init__(self,name,address,enabled,timeout) else: VisaInstrument.__init__(self,name,address,enabled, term_chars='\r') self.query_sleep=0.05 self.recv_length=65536 self.term_char='\r'
def __init__(self, name="", address='COM5', enabled=True, timeout=1.0): # if ':' not in address: address+=':22518' if address[:3].upper() == 'COM': SerialInstrument.__init__(self, name, address, enabled, timeout) else: VisaInstrument.__init__(self, name, address, enabled) self.query_sleep = 0.05 self.recv_length = 65535 self.escapekey = 'XXYYXX'
def __init__(self, name="", address='COM6', enabled=True, timeout=0): """Note when initialized the attenuator board will reset to -31.5dB""" SerialInstrument.__init__(self, name, address, enabled, timeout, query_sleep=0.1) self.term_char = '\n'
def __init__(self, name="", address='COM20', enabled=True, timeout=.02): self.query_sleep = .005 self.timeout = timeout self.recv_length = 32 self.term_char = '\r\n' SerialInstrument.__init__(self, name, address, enabled, timeout, self.recv_length, baudrate=115200, query_sleep=self.query_sleep) self.valve_state=self.get_all() self.pulse_state=self.get_pulse_state() self.pulse_time=self.set_pulse_time(1)
def __init__(self,name="magnet",address='COM4',enabled=True,timeout=1): #if ':' not in address: address+=':22518' if address[:3].upper()=='COM': SerialInstrument.__init__(self,name,address,enabled,timeout) else: VisaInstrument.__init__(self,name,address,enabled, term_chars='\r') self.query_sleep=0.05 self.recv_length=65536 self.term_char='\r' self.set_mode() self.set_extended_resolution()
def __init__(self, name="", address='COM6', enabled=True, timeout=0): if address[:3].upper() == 'COM': SerialInstrument.__init__(self, name, address, enabled, timeout, querysleep=0.1) self.term_char = '\r' self.boxaddress = '00' else: WebInstrument.__init__(self, name, address, enabled)
def __init__(self, name='spec_analyzer', protocol='socket', address='', port=23, enabled=True, timeout=.1, recv_length=1024, query_sleep=0.005, lo_power=10, lo_offset=10.55e6, baudrate=115200): self.lo_offset = lo_offset self.lo_power = lo_power if (address.count('.') == 3): #the address is in an IP address format self.protocol = 'socket' else: #otherwise we treat the address as port self.protocol = 'serial' if address != '': port = int(address) if self.protocol == 'serial': SerialInstrument.__init__(self, name, port, enabled, timeout, recv_length, baudrate=baudrate, querysleep=query_sleep) self.term_char = '' time.sleep(2) print(self.read()) elif self.protocol == 'socket': if ':' in address: SocketInstrument.__init__(self, name, address, enabled, timeout, recv_length) else: SocketInstrument.__init__(self, name, address + ':' + str(port), enabled, timeout, recv_length) self.recv_length = recv_length self.term_char = '' self.query_sleep = query_sleep else: print('The protocol requested is not valid.')
def __init__(self, name="magnet", address='COM4', enabled=True, timeout=1): #if ':' not in address: address+=':22518' if address[:3].upper() == 'COM': SerialInstrument.__init__(self, name, address, enabled, timeout) else: VisaInstrument.__init__(self, name, address, enabled, term_chars='\r') self.query_sleep = 0.05 self.recv_length = 65536 self.term_char = '\r' self.set_mode() self.set_extended_resolution()
def __init__(self, name="ArduinoADC", address='COM4', enabled=True, timeout=.01): SerialInstrument.__init__(self, name, address, enabled, timeout, query_sleep=0.2) self.read() self.read() time.sleep(0.5) self.query('S')
def __init__(self, name="", address='COM3', enabled=True, timeout=.05, query_timeout=20): SerialInstrument.__init__(self, name, address, enabled, timeout, baudrate=57600, query_sleep=0.05) self.term_char = '\r\n' self.serial_lock = RLock() self.query_timeout = query_timeout
def __init__(self, name="", address='COM7', enabled=True, timeout=.5, config_path=None): self.query_sleep = .05 self.timeout = timeout self.rec_length = 1024 self.s_handle = SerialInstrument.__init__(self, name, address, enabled, timeout, baudrate=38400, query_sleep=self.query_sleep) self.term_char = bytes([13]) self.c_char = {'EXT': bytes([3]), 'ENQ': bytes([5])} self.config_path = config_path if config_path == None: pass else: try: self.load_config(config_path=self.config) except: print('Unable to load pressure gauge configuration')
def __init__(self, name="", address='COM3', enabled=True, timeout=.5, query_timeout=20): SerialInstrument.__init__(self, name, address, enabled, timeout, baudrate=28800, query_sleep=0.05) self.term_char = '\r' self.lock = RLock() self.query_timeout = query_timeout self.comm_error = list()
def read(self, port=None): if port is not None: self.write("CONN %x,'%s'\n" % (port, self.escapekey)) self.read() self.write(self.escapekey) if self.protocol == 'serial': return SerialInstrument.read(self) if self.protocol == 'GPIB': return VisaInstrument.read(self)
def __init__(self, name="", address='COM8', enabled=True, timeout=.5, config_path=None): self.query_sleep = .1 self.timeout = timeout self.recv_length = 1024 self.s_handle = SerialInstrument.__init__(self, name, address, enabled, timeout, baudrate=9600, query_sleep=self.query_sleep) self.config_path = config_path if config_path == None: pass else: try: self.load_config(config_path=self.config) except: print('Unable to load Turbo Controller configuration')
def __del__(self): if self.protocol == 'serial': SerialInstrument.__del__(self) if self.protocol == 'socket': self.write('END') SocketInstrument.__del__(self)
def read(self): if self.protocol == 'serial': return SerialInstrument.read(self) if self.protocol == 'socket': return SocketInstrument.read(self)
def write(self, s): if self.protocol == 'serial': SerialInstrument.write(self, s) if self.protocol == 'socket': SocketInstrument.write(self, s)
def __init__(self, name="PressureGauge", address='COM5',enabled=True,timeout=1): SerialInstrument.__init__(self, name, address, enabled, timeout)
def __init__(self, name="ArduinoADC", address='COM4',enabled=True,timeout=.01): SerialInstrument.__init__(self, name, address, enabled, timeout,query_sleep=0.2) self.read() self.read() time.sleep(0.5) self.query('S')
def __init__(self,name="",address='COM11',enabled=True,timeout=0.25): SerialInstrument.__init__(self,name,address,enabled,timeout,query_sleep=0.2)
def write(self, s): if self.protocol == 'serial': SerialInstrument.write(self, s) if self.protocol == 'VISA': VisaInstrument.write(self, s)
def read(self): if self.protocol == 'serial': return SerialInstrument.read(self) if self.protocol == 'VISA': return VisaInstrument.read(self)
def __init__(self, name="", address='COM23', enabled=True, timeout=.5): self.query_sleep=.01 self.timeout=timeout self.recv_length=1024 self.term_char='\r\n' self.s_handle=SerialInstrument.__init__(self, name, address, enabled, timeout, baudrate=115200, query_sleep=self.query_sleep)
def __del__(self): return if self.protocol == 'serial': SerialInstrument.__del__(self) if self.protocol == 'VISA': VisaInstrument.__del__(self)