Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
    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.') 
Exemplo n.º 4
0
 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()
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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'
Exemplo n.º 7
0
 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'
Exemplo n.º 8
0
 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'
Exemplo n.º 9
0
    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)
Exemplo n.º 10
0
 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()
Exemplo n.º 11
0
 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)
Exemplo n.º 12
0
    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.')
Exemplo n.º 13
0
 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()
Exemplo n.º 14
0
 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')
Exemplo n.º 15
0
 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
Exemplo n.º 16
0
 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')
Exemplo n.º 17
0
 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()
Exemplo n.º 18
0
 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)
Exemplo n.º 19
0
 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')
Exemplo n.º 20
0
 def __del__(self):
     if self.protocol == 'serial':
         SerialInstrument.__del__(self)
     if self.protocol == 'socket':
         self.write('END')
         SocketInstrument.__del__(self)
Exemplo n.º 21
0
 def read(self):
     if self.protocol == 'serial':
         return SerialInstrument.read(self)
     if self.protocol == 'socket':
         return SocketInstrument.read(self)
Exemplo n.º 22
0
 def write(self, s):
     if self.protocol == 'serial':
         SerialInstrument.write(self, s)
     if self.protocol == 'socket':
         SocketInstrument.write(self, s)
Exemplo n.º 23
0
 def __init__(self, name="PressureGauge", address='COM5',enabled=True,timeout=1):
     SerialInstrument.__init__(self, name, address, enabled, timeout)
Exemplo n.º 24
0
 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')
Exemplo n.º 25
0
 def __init__(self,name="",address='COM11',enabled=True,timeout=0.25):
     SerialInstrument.__init__(self,name,address,enabled,timeout,query_sleep=0.2)
Exemplo n.º 26
0
 def __del__(self):
     if self.protocol == 'serial':
         SerialInstrument.__del__(self)
     if self.protocol == 'socket':
         self.write('END')
         SocketInstrument.__del__(self)
Exemplo n.º 27
0
 def write(self, s):
     if self.protocol == 'serial':
         SerialInstrument.write(self, s)
     if self.protocol == 'socket':
         SocketInstrument.write(self, s)
Exemplo n.º 28
0
 def read(self):
     if self.protocol == 'serial':
         return SerialInstrument.read(self)
     if self.protocol == 'socket':
         return SocketInstrument.read(self)
Exemplo n.º 29
0
 def write(self, s):
     if self.protocol == 'serial':
         SerialInstrument.write(self, s)
     if self.protocol == 'VISA':
         VisaInstrument.write(self, s)
Exemplo n.º 30
0
 def read(self):
     if self.protocol == 'serial':
         return SerialInstrument.read(self)
     if self.protocol == 'VISA':
         return VisaInstrument.read(self)
Exemplo n.º 31
0
 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)
Exemplo n.º 32
0
 def __del__(self):
     return
     if self.protocol == 'serial':
         SerialInstrument.__del__(self)
     if self.protocol == 'VISA':
         VisaInstrument.__del__(self)
Exemplo n.º 33
0
 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'