def __init__(self, interface, hostname='', device=''): if interface == 'serial': SCPI.__init__(self, interface=interface, device=device) self.f.baudrate = 19200 self.f.timeout = 5 if interface == 'lan': SCPI.__init__(self, interface=interface, hostname=hostname) self.channel_names = {1: 'a', 2: 'b'}
def __init__(self, output, interface = 'serial', hostname='', device='', tcp_port=0): if interface == 'lan': SCPI.__init__(self, 'lan', tcp_port=tcp_port, hostname=hostname) if interface == 'serial': SCPI.__init__(self, 'serial', device=device) if not (output == 1 or output == 2): raise InterfaceOutOfBoundsError(output) else: self.output = str(output)
def __init__(self, interface='serial', hostname='', device='', tcp_port=0): if interface == 'lan': SCPI.__init__(self, 'lan', tcp_port=tcp_port, hostname=hostname) if interface == 'serial': SCPI.__init__(self, 'serial', device=device) self.unit_list = [ 'VDC', 'VAC', 'ADC', 'AAC', 'OHM', 'OHM4W', 'HZ', 'SECS', 'C', 'F', 'K' ]
class vnaCom(): def __init__(self, device, ip): try: self.device = device self.comlink = serial.Serial(*device) except: print("Could not open ",device) raise self.scpi = SCPI(ip) def __del__(self): self.comlink.close() def sendMagAndPhase(self): (mag,phase) = self.scpi.getMagAndPhase() # Format is mag,phase (floats); command = b"{0},{1}\n".format(mag, phase) self.comlink.write(command) self.comlink.flush() return (mag,phase) def waitForRequest(self): response = self.comlink.readline() while response.find('GETMAGPHASE') != 0 : response = self.comlink.readline() print response
def __init__(self, device, ip): try: self.device = device self.comlink = serial.Serial(*device) except: print("Could not open ",device) raise self.scpi = SCPI(ip)
def __init__(self, interface = 'serial', hostname='', device='', tcp_port=0): if interface == 'lan': SCPI.__init__(self, 'lan', tcp_port=tcp_port, hostname=hostname) if interface == 'serial': SCPI.__init__(self, 'serial', device=device) self.unit_list = ['VDC', 'VAC', 'ADC', 'AAC', 'OHM', 'OHM4W', 'HZ', 'SECS', 'C', 'F', 'K']
def __init__(self, port='ttyUSB0', name='microreactor-agilent-34972a'): #SCPI.__init__(self,'/dev/usbtmc1','file') SCPI.__init__(self, interface='serial', device = port, hostname=name)
def __init__(self): SCPI.__init__(self, '/dev/ttyS0', 'serial') self.f.baudrate = 19200 self.f.timeout = 5
def __init__(self, name='microreactor-agilent-34972a'): #SCPI.__init__(self,'/dev/usbtmc1','file') SCPI.__init__(self, name, 'lan')
def __init__(self, port='ttyUSB0', name='microreactor-agilent-34972a'): #SCPI.__init__(self,'/dev/usbtmc1','file') SCPI.__init__(self, interface='serial', device=port, hostname=name)
def __init__(self,output,usbchannel = 0): SCPI.__init__(self,'/dev/ttyACM' + str(usbchannel),'serial') if not (output == 1 or output == 2): raise InterfaceOutOfBoundsError(output) else: self.output = str(output)
def __init__(self, interface = 'lan', hostname=''): if interface == 'lan': SCPI.__init__(self, interface=interface, hostname=hostname)
def __init__(self, name='microreactor-agilent-34972a'): #SCPI.__init__(self,'/dev/usbtmc1','file') SCPI.__init__(self, interface='lan', hostname=name)