Ejemplo n.º 1
0
 def __init__(self, name):
     Instrument.__init__(self, name, tags=['virtual'])
     
     self.add_parameter('temperature', type=float,
         flags=Instrument.FLAG_GET, units='mK')
     
     self.t = tip_client('tip',address='pi-us74')   #tip raspberry instance
Ejemplo n.º 2
0
    def __init__(self, name, address='10.22.197.115'):
        '''
        Initialzes the IVVIDIG, and communicates with the Rasbpi

        Input:
            name (string)        : name of the instrument
            address (string)     : Rasbpi's IP-Adress
        Output:
            None
        '''
        logging.info(__name__ + ' : Initializing instrument IVVIDIG')
        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._port = 6543

        #FIXME: numdacs is now variable!?
        self._numdacs = 16

        # Add functions
        #self.add_function('get_dac')
        #self.add_function('set_dac')

        self.REQUEST_TIMEOUT = 2500
        self.REQUEST_RETRIES = 3
        
        self._open_zmq_connection()
Ejemplo n.º 3
0
    def __init__(self, name, address, reset = False):
        '''
        Initializes the HP 3245A source, and communicates with the wrapper.

        Input:
            name (string)    : name of the instrument
            address (string) : GPIB address
            reset (bool)     : resets to default values

        Output:
            None
        '''
        # Initialize wrapper functions
        logging.info(__name__ + ' : Initializing instrument HP_3245A')
        Instrument.__init__(self, name, tags=['physical'])
                
        self._address = address
        self._visainstrument = visa.instrument(self._address)

        # Implement parameters
        self.add_parameter("current", type=float, units='A', flags=Instrument.FLAG_GETSET)
        self.add_parameter("voltage", type=float, units='V', flags=Instrument.FLAG_GETSET)

        self.add_function('reset')
        self.add_function('clear_memory')
        self.add_function('set_channel')
        self.add_function('set_terminal')
        self.add_function('set_output_type')
        self.add_function('set_impedance')
        self.add_function('set_resolution')
        self.add_function('set_autorange')
        #self.add_function('set_current')
        #self.add_function('set_voltage')

        self.reset()
Ejemplo n.º 4
0
    def __init__(self, name, address):
        '''

        Input:
            name (string)    : name of the instrument
            address (string) : instrument (serial port) address

        Output:
            None
        '''
        logging.debug(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._visainstrument = visa.SerialInstrument(self._address,
                                                     delay=30e-3)
        self._values = {}
        self._visainstrument.stop_bits = 1  # This works only using pyvisa 1.4
        self.reset()

        #Add parameters
        self.add_parameter('b_raw', type=int, flags=Instrument.FLAG_GET)
        self.add_parameter('counts', type=int, flags=Instrument.FLAG_GETSET)

        # Add functions
        self.add_function('get_all')
        self.get_all()
Ejemplo n.º 5
0
    def __init__(self, name, remote_name, inssrv=None, server=None):
        Instrument.__init__(self, name, tags=['remote'])

        self._remote_name = remote_name
        if inssrv is None:
            inssrv = objsh.helper.find_object('%s:instrument_server' % server)
        self._srv = inssrv
        params = self._srv.get_ins_parameters(remote_name)
        for name, info in params.iteritems():
            if info['flags'] & Instrument.FLAG_GET:
                info['get_func'] = self._get
            elif info['flags'] & Instrument.FLAG_SOFTGET:
                info['flags'] ^= (Instrument.FLAG_SOFTGET
                                  | Instrument.FLAG_GET)
                info['get_func'] = self._get
            if info['flags'] & Instrument.FLAG_SET:
                info['set_func'] = self._set
            info['channel'] = name
            self.add_parameter(name, **info)

        funcs = self._srv.get_ins_functions(remote_name)
        for name, info in funcs.iteritems():
            try:
                func = self.create_lambda(name, info.get('argspec', None))
                if 'doc' in info:
                    func.__doc__ = info['doc']
                setattr(self, name, func)
                self.add_function(name, **info)
            except Exception, e:
                logging.warning('Failed to create function %s: %s', name, e)
Ejemplo n.º 6
0
    def __init__(self, name, address, reset=False):
        '''
        Initializes the Inficon, and communicates with the wrapper.
        
        Input:
            name (string)    : name of the instrument
            address (string) : GPIB address
            reset (bool)     : resets to default values, default=False
        '''

        logging.info(__name__ + ': Initializing instrument Inficon')
        Instrument.__init__(self, name, tags=['physical'])
        #self._address = address
        if sys.version_info[0] < 3:

            def enc(string):
                return string

            def dec(string):
                return string
        else:

            def enc(string):
                return string.encode('latin-1')

            def dec(byte):
                return byte.decode('latin-1')

        self._enc = enc
        self._dec = dec

        self.setup(address)
Ejemplo n.º 7
0
    def __init__(self, name, address):

        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._visainstrument = visa.instrument(self._address)

        self.min_freq = self.get_MIN_frequency()
        self.max_freq = self.get_MAX_frequency()

        self.min_ampl = self.get_MIN_amplitude()
        self.max_ampl = self.get_MAX_amplitude()

        self.min_offs = self.get_MIN_offset()
        self.max_offs = self.get_MAX_offset()

        self.set_default()  #reset

        self.add_function('set_default')
        self.add_function('get_frequency')
        self.add_function('set_frequency')
        self.add_function('get_function')
        self.add_function('set_function')
        self.add_function('get_amplitude')
        self.add_function('set_amplitude')
        self.add_function('get_output')
        self.add_function('set_output')
        self.add_function('get_offset')
        self.add_function('set_offset')
        self.add_function('get_voltage_units')
        self.add_function('set_voltage_units')
        self.add_function('get_output_load')
        self.add_function('set_output_load')
Ejemplo n.º 8
0
    def __init__(self, name, host='10.22.197.88', port=9988):

        Instrument.__init__(self, name, tags=['physical'])

        self.add_parameter('position', type=str, flags=Instrument.FLAG_GETSET)

        self.HOST, self.PORT = host, port
Ejemplo n.º 9
0
    def __init__(self, name, source=None, channel = 0, stepsize = 2e-9, stepdelay=1):
        '''
            virtual magnet built upon yokogawa source
        '''
        Instrument.__init__(self, name, tags=['virtual'])
        self._instruments = qkit.instruments.get_instruments()
        self._source= self._instruments.get(source)
        self._channel = channel        
        # Add parameters        
        self.add_parameter('current', type=float,
            flags=Instrument.FLAG_GETSET, units='A')
        self.add_parameter('stepsize', type=float,
            flags=Instrument.FLAG_GETSET, units='A')        
        self.add_parameter('range', type=float,
            flags=Instrument.FLAG_GETSET, units='A')        
        self.add_parameter('stepdelay', type=float,
            flags=Instrument.FLAG_GETSET, units='ms')

        self._stepsize = stepsize
        self._stepdelay = stepdelay
        getattr(self._source, 'set_ch%d_sweep_mode'%channel)('fix')
        getattr(self._source, 'set_ch%d_source_mode'%channel)('curr')
        getattr(self._source, 'set_ch%d_sense_mode'%channel)('curr')

        self.get_all()
Ejemplo n.º 10
0
    def __init__(self, name):
        Instrument.__init__(self, name, tags=['virtual'])

        self.add_parameter('attenuation',
                           type=float,
                           flags=Instrument.FLAG_SET,
                           units='dB')
Ejemplo n.º 11
0
    def __init__(self, name, address, ip=""):

        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._visainstrument = visa.instrument(self._address, ip=ip)

        self.set_default()  #reset

        self.add_function('set_default')
        self.add_function('get_bandwidth')
        self.add_function('set_bandwidth')
        self.add_function('get_auto_zero')
        self.add_function('set_auto_zero')
        self.add_function('get_configuration')
        self.add_function('get_measurement_mode')
        self.add_function('get_range')
        self.add_function('get_resolution')
        self.add_function('set_measurement_mode')
        self.add_function('set_range_resolution')
        self.add_function('get_NPLC')
        self.add_function('set_NPLC')
        self.add_function('get_autorange')
        self.add_function('set_autorange')
        self.add_function('measure')
Ejemplo n.º 12
0
    def __init__(self, name, address, reset=False):
        """
        Initializes the MKS, and communicates with the wrapper.
        
        Args:
            name (string)    : Name of the instrument
            address (string) : Serial address
            reset (bool)     : Resets to default values, default=False
        """

        logging.info(__name__ + ': Initializing instrument MKS_647C')
        Instrument.__init__(self, name, tags=['physical'])

        self.predef_pressure_unit = 13  # 100 ubar, depends on baratron
        self.predef_channels = {"Ar": 1, "N2": 2, "O2": 3, "ArO": 4}
        self.predef_gasCorfact = {
            "Ar": 1.37,
            "N2": 1.0,
            "O2": 1.0,
            "ArO": 1.37
        }  # Values as they are predefined in MKS
        self.predef_flowRange = {
            "Ar": 6,
            "N2": 6,
            "O2": 6,
            "ArO": 3
        }  # 100sccm, 100sccm, 100sccm, 10sccm

        self.mutex = Lock()
        self.setup(address)

        self.init_controller(reset=reset)
Ejemplo n.º 13
0
    def __init__(self, name, address, number=5):
        '''
        Initializes the Oxford Instruments Kelvinox IGH Dilution Refrigerator.

        Input:
            name (string)    : name of the instrument
            address (string) : instrument address
            number (int)     : ISOBUS instrument number

        Output:
            None
        '''
        logging.debug(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._number = number
        self._visainstrument = visa.SerialInstrument(self._address)
        self._values = {}
        self._visainstrument.stop_bits = 2

        #Add parameters
        self.add_parameter('1K_pot_temp',
                           type=float,
                           flags=Instrument.FLAG_GET)
        self.add_parameter('mix_chamber_temp',
                           type=float,
                           flags=Instrument.FLAG_GET)

        # Add functions
        self.add_function('get_all')
        self.get_all()
Ejemplo n.º 14
0
    def __init__(self, name, id):
        Instrument.__init__(self, name, tags=['physical'])

        self._id = id

        for ch_in in self._get_input_channels():
            ch_in = _get_channel(ch_in)
            self.add_parameter(ch_in,
                               flags=Instrument.FLAG_GET,
                               type=float,
                               units='V',
                               tags=['measure'],
                               get_func=self.do_get_input,
                               channel=ch_in)

        for ch_out in self._get_output_channels():
            ch_out = _get_channel(ch_out)
            self.add_parameter(ch_out,
                               flags=Instrument.FLAG_SET,
                               type=float,
                               units='V',
                               tags=['sweep'],
                               set_func=self.do_set_output,
                               channel=ch_out)

        for ch_ctr in self._get_counter_channels():
            ch_ctr = _get_channel(ch_ctr)
            self.add_parameter(ch_ctr,
                               flags=Instrument.FLAG_GET,
                               type=int,
                               units='#',
                               tags=['measure'],
                               get_func=self.do_get_counter,
                               channel=ch_ctr)
            self.add_parameter(ch_ctr + "_src",
                               flags=Instrument.FLAG_SET
                               | Instrument.FLAG_SOFTGET,
                               type=str,
                               set_func=self.do_set_counter_src,
                               channel=ch_ctr)

        self.add_parameter('chan_config',
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           type=str,
                           option_list=('Default', 'RSE', 'NRSE', 'Diff',
                                        'PseudoDiff'))

        self.add_parameter('count_time',
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           type=float,
                           units='s')

        self.add_function('reset')
        self.add_function('digital_out')

        self.reset()
        self.set_chan_config('RSE')
        self.set_count_time(0.1)
        self.get_all()
Ejemplo n.º 15
0
    def __init__(self, name, address, reset=False):
        '''
        Initializes the Tektronix_PWS4205, and communicates with the wrapper.

        Input:
          name (string)    : name of the instrument
          address (string) : GPIB or USB address
          reset (bool)     : resets to default values, default=False
        '''
        logging.info(__name__ + ' : Initializing instrument Tektronix_PWS4205')
        Instrument.__init__(self, name, tags=['physical'])

        # Add some global constants
        self._address = address
        self._visainstrument = visa.instrument(self._address)
        self._name = name

        self.add_parameter('voltage',
                           flags=Instrument.FLAG_GETSET,
                           units='V',
                           minval=0,
                           maxval=20,
                           type=float)
        self.add_parameter('setvoltage',
                           flags=Instrument.FLAG_GET,
                           units='V',
                           minval=0,
                           maxval=20,
                           type=float)
        self.add_parameter('current',
                           flags=Instrument.FLAG_GETSET,
                           units='A',
                           minval=0,
                           maxval=5,
                           type=float)
        self.add_parameter('setcurrent',
                           flags=Instrument.FLAG_GET,
                           units='A',
                           minval=0,
                           maxval=5,
                           type=float)
        self.add_parameter('status', flags=Instrument.FLAG_GETSET, type=bool)

        self.add_function('reset')
        self.add_function('on')
        self.add_function('off')
        self.add_function('ramp_current')

        #        self.add_function('exec_tsl_script')
        #        self.add_function('exec_tsl_script_with_return')
        #        self.add_function('get_tsl_script_return')

        #self.add_function ('get_all')

        #self._visainstrument.write('beeper.beep(0.5,1000)')
        if (reset):
            self.reset()
        else:
            self.get_all()
Ejemplo n.º 16
0
    def __init__(self, name, address="tcp://10.22.197.143:4242"):
        """
        inits the VCA (virtual instrument)
        :param name: qkit instrument name
        :param address: IP-address of Raspberry-Pi controlling the VCAs
        """
        Instrument.__init__(self, name, tags=['virtual'])

        self.add_parameter('attenuation_i_manip',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='dB',
                           minval=0,
                           maxval=20)
        self.add_parameter('attenuation_q_manip',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='dB',
                           minval=0,
                           maxval=20)
        self.add_parameter('attenuation_i_readout',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='dB',
                           minval=0,
                           maxval=20)
        self.add_parameter('attenuation_q_readout',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='dB',
                           minval=0,
                           maxval=20)
        self.add_parameter('attenuation_rf_readout',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='dB',
                           minval=0,
                           maxval=30)
        self.add_parameter('attenuation_rf_manip',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='dB',
                           minval=0,
                           maxval=30)
        self.add_parameter('amplification_i_return',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='dB',
                           minval=-20,
                           maxval=33)
        self.add_parameter('amplification_q_return',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='dB',
                           minval=-20,
                           maxval=33)
        self._address = address

        self._dac = zerorpc.Client()
Ejemplo n.º 17
0
    def __init__(self, name, serial=None, port='A', baudrate=115200):
        '''
            discover and initialize Tunnel_DAC hardware
            
            Input:
                serial - serial number of the FTDI converter
                channel - 2 character channel id the DAC is connected to;
                    the first byte identifies the channel (A..D for current devices)
                    the second byte identifies the bit within that channel (0..7)
                numdacs - number of DACs daisy-chained on that line
                delay - communications delay assumed between PC and the USB converter
        '''
        logging.info(__name__ + ': Initializing instrument Tunnel_DAC')
        Instrument.__init__(self, name, tags=['physical'])

        self._conn = Ftdi()
        # VIDs and PIDs of converters used
        vps = [
            (0x0403, 0x6011),  # FTDI UM4232H 4ch
            (0x0403, 0x6014)  # FTDI UM232H 1ch
        ]
        # explicitly clear device cache of UsbTools
        #UsbTools.USBDEVICES = []
        # find all devices and obtain serial numbers
        devs = self._conn.find_all(vps)
        # filter list by serial number if provided
        if (serial != None):
            devs = [dev for dev in devs if dev[2] == serial]
        if (len(devs) == 0):
            logging.error(__name__ + ': failed to find matching FTDI devices.')
        elif (len(devs) > 1):
            logging.error(
                __name__ +
                ': more than one converter found and no serial number given.')
            logging.info(__name__ + ': available devices are: %s.' %
                         str([dev[2] for dev in devs]))
        vid, pid, self._serial, ports, description = devs[0]
        self._ports = [chr(ord('A') + i) for i in range(ports)]

        # open device
        (self._port, bit) = self._parse_channel_string(port)
        self._conn.open(vid,
                        pid,
                        interface=ord(self._port) - ord('A') + 1,
                        serial=self._serial)
        logging.info(__name__ +
                     ': using converter with serial #%s' % self._serial)
        self._conn.set_bitmode(0xFF, Ftdi.BITMODE_BITBANG)
        self._set_baudrate(baudrate)

        # provide user interface
        self.add_parameter('port', type=str, flags=Instrument.FLAG_GET)
        #self.add_parameter('aliases', type=types.DictType, flags=Instrument.FLAG_GETSET)
        self.add_function('digital_out')
        self.add_function('digital_stream')
        self.add_function('set_aliases')
        self.add_function('get_aliases')
Ejemplo n.º 18
0
    def __init__(self, name, address="localhost", port=9999):
        # logging.info(__name__ + ' : Initializing TIP client')
        Instrument.__init__(self, name, tags=['physical'])

        # Add some global constants
        self._address = address
        self._port = port

        self.reconnect(address, port)
        self.add_function('reconnect')
        self.add_function('send')
        self.add_function('recv')
        self.add_function('r_set_T')
        self.add_function('r_get_T')
        self.add_function('new_T')
        self.add_function('close')
        self.add_function('autorange')
        self.add_function('set_interval_scanning')
        self.add_function('set_interval_base')
        self.add_function('set_interval_off')
        self.add_function('measure')
        self.add_function('get_all')
        
        self.add_parameter('T',
                           flags=Instrument.FLAG_GETSET,
                           type=float,
                           units='K'
                           )
        self.add_parameter('P',
                           flags=Instrument.FLAG_GETSET,
                           type=float,
                           units=''
                           )
        self.add_parameter('I',
                           flags=Instrument.FLAG_GETSET,
                           type=float,
                           units=''
                           )
        self.add_parameter('D',
                           flags=Instrument.FLAG_GETSET,
                           type=float,
                           units=''
                           )
        self.add_parameter('interval', type=float,
                           flags=Instrument.FLAG_GETSET, units="s",
                           channels=(1, 5), channel_prefix='T%d_')
        self.add_parameter('range', type=int,
                           flags=Instrument.FLAG_GETSET,
                           channels=(1, 5), channel_prefix='T%d_')
        self.add_parameter('excitation', type=int,
                           flags=Instrument.FLAG_GETSET,
                           channels=(1, 5), channel_prefix='T%d_')
        self.add_parameter('temperature', type=float,
                           flags=Instrument.FLAG_GET, units="K",
                           channels=(1, 5), channel_prefix='T%d_')

        self.T = 0.0
Ejemplo n.º 19
0
 def __init__(self, name):
     self.__name__ = __name__
     Instrument.__init__(self, name, tags=['virtual'])
     self.predef_channels = {'Ar': 0,
                             'ArO': 0,
                             'N': 0,
                             'O': 0}
     self.add_function('get_pressure')
     self.add_function('get_flow')
Ejemplo n.º 20
0
    def __init__(self, name, host='pi-us126', port=9900):

        Instrument.__init__(self, name, tags=['physical'])
        
        self.add_parameter('attenuation',
            type=float, minval=0, maxval=31.5, units='dB',
            flags=Instrument.FLAG_GETSET)
            
        self.HOST, self.PORT = host, port
        self.get_attenuation()
Ejemplo n.º 21
0
    def __init__(self, name, address, model='Anritsu'):
        '''
        Initializes the Anritsu_MG37022, and communicates with the wrapper.
        
        Input:
            name (string)    : name of the instrument
            address (string) : GPIB address
        '''
        logging.info(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._model = model
        self._visainstrument = visa.instrument(self._address)
        self._slope = None  #set _slope to True if frequency dependent power compensation is requested
        sleep(1)

        # Implement parameters
        self.add_parameter('frequency',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])
        if ("MG3692C" not in self.ask("*IDN?").split(",")):
            self.add_parameter('phase_offset',
                               type=float,
                               flags=Instrument.FLAG_GETSET,
                               minval=-360,
                               maxval=360,
                               units='deg')
        self.add_parameter('slope',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=100,
                           units='dB@10GHz')
        self.add_parameter(
            'power',
            type=float,
            flags=Instrument.FLAG_GETSET,
            minval=-130,
            maxval=29,  #29dBm possible, this is security JB
            units='dBm',
            tags=['sweep'])
        self.add_parameter('status', type=bool, flags=Instrument.FLAG_GETSET)
        self.add_parameter('high_power',
                           type=bool,
                           flags=Instrument.FLAG_GETSET)

        # Implement functions
        self.add_function('get_all')
        self.get_all()
Ejemplo n.º 22
0
    def __init__(self, name, interface, ethertype = 0x0003, ip_host = '127.0.0.1', ip_port = 413, ip_filter = ''):
        '''
        Initializes the UDP-to-Ethernet bridge

        Input:
            name (string)    : name of the instrument
            interface (string) : raw ethernet network interface
            ethertype : ethernet frame type to receive
            ip_host:ip_port : UDP interface address
            ip_filter : regular expression used to match incoming packets against

        Output:
            None
        '''
        logging.debug(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name, tags=['physical'])

        self._interface = interface
        self._ethertype = int(ethertype)
        self._ip_host = ip_host
        self._ip_port = int(ip_port)
        self.do_set_ip_filter(ip_filter)
        self._clients = {} # associate MAC addresses with udp clients
        self._devices = set() # mac addresses seen on the raw interface
        self._updateLock = threading.Lock()

        # add parameters
        self.add_parameter('interface', type=str, flags=Instrument.FLAG_GET)
        self.add_parameter('MAC', type=str, flags=Instrument.FLAG_GET)
        self.add_parameter('ethertype', type=int, flags=Instrument.FLAG_GET)
        self.add_parameter('ip_host', type=str, flags=Instrument.FLAG_GET)
        self.add_parameter('ip_port', type=int, flags=Instrument.FLAG_GET)
        self.add_parameter('ip_filter', type=str, flags=Instrument.FLAG_GETSET)
        self.add_parameter('devices', type=types.ListType, flags=Instrument.FLAG_GET)
        self.add_parameter('listeners', type=types.ListType, flags=Instrument.FLAG_GET)
        self.add_parameter('raw_rcvbuf', type=int, flags=Instrument.FLAG_GETSET)
        self.add_parameter('udp_rcvbuf', type=int, flags=Instrument.FLAG_GETSET)
        self.add_function('get_all')

        # open sockets
        self._init_udp()
        self._init_raw()

        # update ui
        self.get_all()

        # start daemons
        self._udp_receiver = self.udp_receiver(self)
        self._udp_receiver.daemon = True
        self._udp_receiver.start()
        self._raw_receiver = self.raw_receiver(self)
        self._raw_receiver.daemon = True
        self._raw_receiver.start()
Ejemplo n.º 23
0
    def __init__(self, name, dacs=DAC_ROUT, dacranges=None):
        """
        init virtual instrument object
        Inputs:
            - name: qt instrument name
            - dacs: list of routes of channels in use, e.g. [5] or [5,9,2]
            - dacranges: list of length len(dacs) indicating the dac ranges set at the device, list entries one of 'bi' for -2000,2000, 'pos' for 0,4000, 'neg' for -4000,0
        """
        Instrument.__init__(self, name, tags=['virtual'])

        self.dacs = dacs
        try:
            self.channels = len(self.dacs)
        except TypeError:
            logging.error(
                'Error reading dac ports to be used. Import as list.')
        if dacranges == None:
            dacranges = ['bi'] * self.channels
        else:
            if len(dacranges) != self.channels:
                logging.error('dacranges not specified properly')
        limits_dict = {
            'bi': [-2000, 2000],
            'pos': [0, 4000],
            'neg': [-4000, 0]
        }
        self.range_limits = [
            limits_dict[dacranges[i]] for i in range(self.channels)
        ]
        # print self.range_limits
        if self.channels == 1:
            self.add_parameter('current',
                               type=float,
                               flags=Instrument.FLAG_GETSET,
                               units='mA')
            self.add_parameter('range', type=str, flags=Instrument.FLAG_GETSET)
        elif self.channels > 1 and self.channels <= 16:
            self.add_parameter('current',
                               type=float,
                               flags=Instrument.FLAG_GETSET,
                               units='mA',
                               channels=(1, self.channels),
                               channel_prefix='ch%d_')
            self.add_parameter('range',
                               type=str,
                               flags=Instrument.FLAG_GETSET,
                               channels=(1, self.channels),
                               channel_prefix='ch%d_')
        else:
            logging.error('incorrect number of channels specified')

        self.c_ranges = ['1m'] * self.channels
Ejemplo n.º 24
0
 def __init__(self, name, host='ip-address', port=9931, nchannels = 16):
     '''
     Initialize qkit parameters and connect to the zerorpc server as a client.
     '''
     Instrument.__init__(self, name, tags=['physical'])
     
     self.channels = nchannels
     self.add_parameter('voltage', type=float, flags=Instrument.FLAG_GETSET, 
             units='V', channels=(0, self.channels-1), channel_prefix='ch%d_',minval=-5.,maxval=5)
     self.voltages = [0]*self.channels
     
     self.HOST, self.PORT = host, port
     self.init_connection()
Ejemplo n.º 25
0
    def __init__(self, name, address, reference='external', model='ERASynth'):
        logging.info(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name)
        self._address = "tcp://" + address
        self._model = model
        self._statusdict = {}
        self._reference = reference
        self._rpc = zerorpc.Client()
        self._rpc.connect(self._address)

        # Implement parameters
        self.add_parameter('frequency',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=250e3,
                           maxval=15e9,
                           units='Hz')
        self.add_parameter(
            'power',
            type=float,
            flags=Instrument.FLAG_GETSET,
            minval=-60,
            maxval=20,  # 15 dBm Typ, up to 20 depending on F
            units='dBm')
        self.add_parameter('status', type=bool, flags=Instrument.FLAG_GETSET)

        # Initialize parameter values
        self.get_all(True)

        # Set 10MHz reference and check for lock if external
        # (if no reference is attached or quality is bad, it will switch to internal OCXO)
        lockcount = 0
        reference = _reference_class_conversion(reference)
        self.set_reference(ReferenceSource.OCXO)
        sleep(1)
        self.set_reference(reference)
        if reference == ReferenceSource.EXTERNAL:
            # Check if PLL has stable lock on external reference
            for _ in range(10):
                if self.get_diag()["lock_xtal"] == "1":
                    lockcount += 1
            if lockcount == 0:
                warnings.warn(
                    "No Lock possible. Check your reference. Defaulted to OCXO."
                )
                self.set_reference(ReferenceSource.OCXO)
            elif lockcount < 10:
                warnings.warn(
                    "External reference unstable. Check for sufficient amplitude & accuracy. Defaulted to OCXO."
                )
                self.set_reference(ReferenceSource.OCXO)
Ejemplo n.º 26
0
    def __init__(self, name, address, reset=False):
        '''
        Initializes the HP_81110A, and communicates with the wrapper.

        Input:
            name (string)    : name of the instrument
            address (string) : GPIB address
            reset (bool)     : resets to default values, default=false

        Output:
            None
        '''

        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._visainstrument = visa.instrument(self._address)
        self._channels = self._get_number_of_channels()

        self.add_parameter('delay', type=float,
            flags=Instrument.FLAG_GETSET | Instrument.FLAG_GET_AFTER_SET,
            channels=(1, self._channels), minval=0.0, maxval=999, units='sec',channel_prefix='ch%d_')
        self.add_parameter('width', type=float,
            flags=Instrument.FLAG_GETSET | Instrument.FLAG_GET_AFTER_SET,
            channels=(1, self._channels), minval=-6.25e-9, maxval=999.5, units='sec',channel_prefix='ch%d_')
        self.add_parameter('high', type=float,
            flags=Instrument.FLAG_GETSET | Instrument.FLAG_GET_AFTER_SET,
            channels=(1, self._channels), minval=-9.90, maxval=10.0, units='Volts',channel_prefix='ch%d_')
        self.add_parameter('low', type=float,
            flags=Instrument.FLAG_GETSET | Instrument.FLAG_GET_AFTER_SET,
            channels=(1, self._channels), minval=-10.0, maxval=9.90, units='Volts',channel_prefix='ch%d_')
        self.add_parameter('status', type=str, channels=(1, self._channels),
            flags=Instrument.FLAG_GETSET | Instrument.FLAG_GET_AFTER_SET,channel_prefix='ch%d_')
        self.add_parameter('add_channels', type=str,
            flags=Instrument.FLAG_GETSET)# | Instrument.FLAG_GET_AFTER_SET)
        self.add_parameter('display', type=str,
            flags=Instrument.FLAG_GETSET | Instrument.FLAG_GET_AFTER_SET)
        self.add_parameter('frequency', type=float, 
            flags=Instrument.FLAG_GETSET, units = 'Hz')

        self.add_function('reset')
        self.add_function('get_all')
        self.add_function('set_mode_triggered')
        self.add_function('set_mode_continuous')
        self.add_function('set_mode_gated')

        if reset:
            self.reset()
        else:
            self.get_all()
Ejemplo n.º 27
0
    def __init__(self, name, address, reset=False):
        '''
        Initializes the Keysight_E8267D, and communicates with the wrapper.

        Input:
          name (string)    : name of the instrument
          address (string) : GPIB address
          reset (bool)     : resets to default values, default=False
        '''
        logging.info(__name__ + ' : Initializing instrument Keysight_E8267D')
        Instrument.__init__(self, name, tags=['physical'])

        # Add some global constants
        self._address = address
        self._visainstrument = visa.instrument(self._address)

        self.add_parameter('power',
                           flags=Instrument.FLAG_GETSET,
                           units='dBm',
                           minval=-135,
                           maxval=25,
                           type=float)
        self.add_parameter('phase',
                           flags=Instrument.FLAG_GETSET,
                           units='rad',
                           minval=-numpy.pi,
                           maxval=numpy.pi,
                           type=float)
        self.add_parameter('frequency',
                           flags=Instrument.FLAG_GETSET,
                           units='Hz',
                           minval=1e5,
                           maxval=13e9,
                           type=float)
        self.add_parameter('status', flags=Instrument.FLAG_GETSET, type=bool)

        self.add_function('reset')
        self.add_function('get_all')

        if (reset):
            self.reset()
        else:
            self.get_all()

        print(
            'this is a copy of the Agilent E8257D driver, thourough testing of this driver in combination with the Keysight E8267D has NOT been done! proceed with caution!'
        )
        print(
            'The max. output power and the frequency range depend on the order option of the Keysight E8267D! '
        )
Ejemplo n.º 28
0
    def __init__(self, name, address, port = 10001):
        '''
        Initializes the Caen_fast_ps, and communicates with the wrapper.

        Input:
          name (string)    : name of the instrument
          address (string) : GPIB address
          reset (bool)     : resets to default values, default=False
        '''
        logging.info(__name__ + ' : Initializing instrument Caen_fast_ps')
        Instrument.__init__(self, name, tags=['physical'])

        self._host = address
        self._port = port
        self._soc = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
        self._soc.connect((self._host, self._port))
        
        self._ak_str = '#AK'

        
        self.add_parameter('voltage',
            flags=Instrument.FLAG_GET, units='V', minval=-20, maxval=20, type=float)
            
        self.add_parameter('setvoltage',
            flags=Instrument.FLAG_GETSET, units='V', minval=-20, maxval=20, type=float)
 
        self.add_parameter('current',
            flags=Instrument.FLAG_GET, units='A', minval=-10, maxval=10, type=float)
            
        self.add_parameter('setcurrent',
            flags=Instrument.FLAG_GETSET, units='A', minval=-10, maxval=10, type=float)

        self.add_parameter('status',
            flags=Instrument.FLAG_GET, type=bool)

        self.add_parameter('output_mode',
            flags=Instrument.FLAG_GETSET, type=str)

        self.add_parameter('current_ramp_rate',
            flags=Instrument.FLAG_GETSET, units='A/s', minval=2e-4, maxval=10, type=float)

        self.add_parameter('voltage_ramp_rate',
            flags=Instrument.FLAG_GETSET, units='A/s', minval=-10, maxval=10, type=float)

        self.add_parameter('floating_mode', flags=Instrument.FLAG_GETSET, type=str)
        
        self.add_function('ramp_current')
        self.add_function('ramp_voltage')
        self.add_function('on')
        self.add_function('off')
Ejemplo n.º 29
0
    def __init__(self, name, MAC, ip_host = '127.0.0.1', ip_port = 413, ip_timeout = 10.):
        '''
        Initializes the Oxford Instruments Kelvinox IGH Dilution Refrigerator.

        Input:
            name (string) : name of the instrument
            MAC (string) : MAC address of the target device
            ip_host:ip_port : UDP interface address of an EthernetServer 

        Output:
            None
        '''
        logging.debug(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name, tags=['physical'])

        self.do_set_MAC(MAC)
        self._ip_host = ip_host
        self._ip_port = int(ip_port)
        self._ip_timeout = float(ip_timeout)

        # add parameters
        self.add_parameter('MAC', type=str, flags=Instrument.FLAG_GETSET)
        self.add_parameter('ip_host', type=str, flags=Instrument.FLAG_GET)
        self.add_parameter('ip_port', type=int, flags=Instrument.FLAG_GET)
        self.add_parameter('ip_timeout', type=float, flags=Instrument.FLAG_GETSET)
        self.add_parameter('rcvbuf', type=int, flags=Instrument.FLAG_GETSET)
        self.add_function('get_regfile')
        self.add_function('set_regfile')
        self.add_function('set_sram')
        self.add_function('get_all')
        self.add_function('seq_start')
        self.add_function('seq_stop')
        self.add_function('seq_single')
        self.add_function('seq_loop')

        # open sockets
        self._init_udp()

        # initialize hardware
        self._reg = None
        self.init_pll()
        self.init_dac(0, signed = True)
        self.init_dac(1, signed = True)
        
        # trigger register readback
        self._reg = None
        self.update_regfile()

        # update ui
        self.get_all()
Ejemplo n.º 30
0
    def __init__(self, name, host='ip-address', port=9955):

        Instrument.__init__(self, name, tags=['physical'])

        self.add_parameter('condenser_pressure',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GET,
                           units='mbar')
        self.add_parameter('still_pressure',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GET,
                           units='mbar')

        self.HOST, self.PORT = host, port