def import_alazar(name='alazar',
                  station=None,
                  clock_source='EXTERNAL_CLOCK_10MHz_REF'):
    from qcodes.instrument_drivers.AlazarTech.ATS9360 import AlazarTech_ATS9360
    alazar = AlazarTech_ATS9360(name=name)
    config_alazar(alazar, seq_mode='off', clock_source=clock_source)
    alazar.add_parameter(name='seq_mode',
                         get_cmd=partial(get_alazar_seq_mode, alazar),
                         set_cmd=partial(set_alazar_seq_mode, alazar),
                         vals=vals.Anything())
    if station is not None:
        station.add_component(alazar)
    logging.info('imported Alazar ATS9360: \'{}\''.format(name))
    print('imported Alazar ATS9360: \'{}\''.format(name))
    print('-------------------------')
    return alazar
示例#2
0
    def add_standard_parameters(self):
        """
        Function to automatically generate the QCC specific functions
        from the qcodes parameters. The function uses the add_parameter
        function internally.
        """
        self.parameter_list = self._read_parameters()

        for parameter in self.parameter_list:
            name = parameter["name"]
            del parameter["name"]

            if ("vals" in parameter):
                validator = parameter["vals"]
                try:
                    val_type = validator["type"]

                    if (val_type == "Bool"):
                        parameter["vals"] = vals.Ints(0, 1)
                        parameter['get_parser'] = int

                    elif (val_type == "IntArray"):
                        parameter["vals"] = vals.Arrays()
                        parameter['get_parser'] = lambda v: np.array(
                            v.split(','), dtype=int)
                    elif (val_type == "QECDataType"):
                        # The QECDataType assumes a long array of ints in which groups of 6 datapoints are returned.
                        # In this datatype every row corresponds to a timeslot
                        # every column corresponds to a qubit index.
                        parameter["vals"] = vals.Anything()

                    elif (val_type == "Non_Neg_Number"):
                        if ("range" in validator):
                            val_min = validator["range"][0]
                            val_max = validator["range"][1]
                        else:
                            val_min = 0
                            val_max = INT32_MAX

                        parameter["vals"] = vals.PermissiveInts(
                            val_min, val_max)
                        parameter['get_parser'] = int
                        parameter['set_parser'] = int

                    else:
                        log.warning("Failed to set the validator for the" +
                                    " parameter " + name + ", because of a" +
                                    " unknown validator type: '" + val_type +
                                    "'")

                except Exception as e:
                    log.warning(
                        "Failed to set the validator for the parameter " +
                        name + ".(%s)", str(e))

            try:
                log.info("Adding parameter:")
                for key, value in parameter.items():
                    log.info("\t", key, value)
                log.info("\n")

                self.add_parameter(name, **parameter)

            except Exception as e:
                log.warning(
                    "Failed to create the parameter " + name +
                    ", because of a unknown keyword in this" +
                    " parameter.(%s)", str(e))
示例#3
0
    def __init__(self,
                 name,
                 address,
                 reset=False,
                 clock=1e9,
                 numpoints=1000,
                 **kw):
        '''
        Initializes the AWG520.

        Args:
            name (str)    : name of the instrument
            address (str) : GPIB address (Note: 520 cannot be controlled
                               via ethernet)
            reset (bool)     : resets to default values, default=false
            numpoints (int)  : sets the number of datapoints

        Output:
            None
        '''
        super().__init__(name, address, **kw)

        self._address = address
        self._values = {}
        self._values['files'] = {}
        self._clock = clock
        self._numpoints = numpoints
        self._fname = ''

        self.add_function('reset', call_cmd='*RST')
        self.add_parameter('state', get_cmd=self.get_state)

        # Add parameters
        self.add_parameter('trigger_mode',
                           get_cmd='AWGC:RMOD?',
                           set_cmd='AWGC:RMOD ' + '{}',
                           vals=vals.Enum('CONT', 'TRIG', 'ENH', 'GAT'))
        self.add_parameter('trigger_impedance',
                           unit='Ohm',
                           label='Trigger impedance (Ohm)',
                           get_cmd='TRIG:IMP?',
                           set_cmd='TRIG:IMP ' + '{}',
                           vals=vals.Enum(50, 1000),
                           get_parser=float)
        self.add_parameter('trigger_level',
                           unit='V',
                           label='Trigger level (V)',
                           get_cmd='TRIG:LEV?',
                           set_cmd='TRIG:LEV ' + '{:.3f}',
                           vals=vals.Numbers(-5, 5),
                           get_parser=float)

        self.add_parameter('clock_freq',
                           label='Clock frequency (Hz)',
                           get_cmd='SOUR:FREQ?',
                           set_cmd='SOUR:FREQ ' + '{}',
                           vals=vals.Numbers(1e6, 1e9),
                           get_parser=float)
        # Todo check if max freq is 1.2 GHz for the AWG 520 aswell
        self.add_parameter('numpoints',
                           label='Number of datapoints per wave',
                           get_cmd=self._do_get_numpoints,
                           set_cmd=self._do_set_numpoints,
                           vals=vals.Ints(100, int(1e9)))

        for ch in [1, 2]:
            amp_cmd = 'SOUR{}:VOLT:LEV:IMM:AMPL'.format(ch)
            offset_cmd = 'SOUR{}:VOLT:LEV:IMM:OFFS'.format(ch)

            self.add_parameter('ch{}_filename'.format(ch),
                               set_cmd=self._gen_ch_set_func(
                                   self._do_set_filename, ch),
                               vals=vals.Anything())
            self.add_parameter('ch{}_amp'.format(ch),
                               label='Amplitude channel {} (V)'.format(ch),
                               unit='V',
                               get_cmd=amp_cmd + '?',
                               set_cmd=amp_cmd + ' {:.6f}',
                               vals=vals.Numbers(0.02, 2.0),
                               get_parser=float)

            self.add_parameter('ch{}_offset'.format(ch),
                               label='Offset channel {} (V)'.format(ch),
                               unit='V',
                               get_cmd=offset_cmd + '?',
                               set_cmd=offset_cmd + ' {:.3f}',
                               vals=vals.Numbers(-1.0, 1.0),
                               get_parser=float)
            self.add_parameter('ch{}_status'.format(ch),
                               get_cmd='OUTP{}?'.format(ch),
                               set_cmd='OUTP{}'.format(ch) + ' {}',
                               vals=vals.Enum('ON', 'OFF'),
                               get_parser=float)

            for j in [1, 2]:
                # TODO: check that 520 does not have marker delay feature
                # m_del_cmd = 'SOUR{}:MARK{}:DEL'.format(ch, j)
                m_high_cmd = 'SOUR{}:MARK{}:VOLT:LEV:IMM:HIGH'.format(ch, j)
                m_low_cmd = 'SOUR{}:MARK{}:VOLT:LEV:IMM:LOW'.format(ch, j)

                self.add_parameter(
                    'ch{}_m{}_high'.format(ch, j),
                    label='Channel {} Marker {} high level (V)'.format(ch, j),
                    get_cmd=m_high_cmd + '?',
                    set_cmd=m_high_cmd + ' {:.3f}',
                    vals=vals.Numbers(-2., 2.),
                    get_parser=float)
                self.add_parameter(
                    'ch{}_m{}_low'.format(ch, j),
                    label='Channel {} Marker {} low level (V)'.format(ch, j),
                    get_cmd=m_low_cmd + '?',
                    set_cmd=m_low_cmd + ' {:.3f}',
                    vals=vals.Numbers(-2., 2.),
                    get_parser=float)

        # Add functions
        if reset:
            self.reset()
        else:
            self.get_all()
        self.connect_message()
    def __init__(self, name, **kwargs):
        t0 = time()
        super().__init__(name, **kwargs)

        self.add_parameter('frequency',
                           label='Frequency ',
                           unit='Hz',
                           initial_value=5e9,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        self.add_parameter('span',
                           label='Span ',
                           unit='Hz',
                           initial_value=.25e6,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        self.add_parameter('power',
                           label='Power ',
                           unit='dBm',
                           initial_value=0,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers(max_value=20))
        self.add_parameter('ref_lvl',
                           label='Reference power ',
                           unit='dBm',
                           initial_value=0,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers(max_value=20))
        self.add_parameter('external_reference',
                           parameter_class=ManualParameter,
                           initial_value=False,
                           vals=vals.Bool())
        self.add_parameter('device_type', parameter_class=ManualParameter)

        self.add_parameter('device_mode',
                           initial_value='sweeping',
                           parameter_class=ManualParameter,
                           vals=vals.Anything())
        self.add_parameter('acquisition_mode',
                           parameter_class=ManualParameter,
                           initial_value='average',
                           vals=vals.Enum('average', 'min-max'))
        self.add_parameter('scale',
                           parameter_class=ManualParameter,
                           initial_value='log-scale',
                           vals=vals.Enum('log-scale', 'lin-scale',
                                          'log-full-scale', 'lin-full-scale'))
        self.add_parameter('running',
                           parameter_class=ManualParameter,
                           initial_value=False,
                           vals=vals.Bool())
        self.add_parameter('decimation',
                           parameter_class=ManualParameter,
                           initial_value=1,
                           vals=vals.Ints(1, 8))
        self.add_parameter('bandwidth',
                           label='Bandwidth',
                           unit='Hz',
                           initial_value=0,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        # rbw Resolution bandwidth in Hz. RBW can be arbitrary.
        self.add_parameter('rbw',
                           label='Resolution Bandwidth',
                           unit='Hz',
                           initial_value=1e3,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        # vbw Video bandwidth in Hz. VBW must be less than or equal to RBW.
        #  VBW can be arbitrary. For best performance use RBW as the VBW.
        self.add_parameter('vbw',
                           label='Video Bandwidth',
                           unit='Hz',
                           initial_value=1e3,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        self.add_parameter('avg',
                           label='Number of averages',
                           initial_value=2,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        t1 = time()
        print('Initialized SignalHound in %.2fs' % (t1 - t0))
示例#5
0
    def __init__(self, name, dll_path=None, **kwargs):
        t0 = time()
        super().__init__(name, **kwargs)

        self.log = logging.getLogger('Main.DeviceInt')
        logging.info(__name__ +
                     ' : Initializing instrument SignalHound USB 124A')
        self.dll = ct.CDLL(dll_path or self.dll_path)
        self.hf = constants

        self.add_parameter('frequency',
                           label='Frequency ',
                           unit='Hz',
                           initial_value=5e9,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        self.add_parameter('span',
                           label='Span ',
                           unit='Hz',
                           initial_value=.25e6,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        self.add_parameter('power',
                           label='Power ',
                           unit='dBm',
                           initial_value=0,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers(max_value=20))
        self.add_parameter('ref_lvl',
                           label='Reference power ',
                           unit='dBm',
                           initial_value=0,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers(max_value=20))
        self.add_parameter('external_reference',
                           parameter_class=ManualParameter,
                           initial_value=False,
                           vals=vals.Bool())
        self.add_parameter('device_type', get_cmd=self._do_get_device_type)

        self.add_parameter('device_mode',
                           initial_value='sweeping',
                           parameter_class=ManualParameter,
                           vals=vals.Anything())
        self.add_parameter('acquisition_mode',
                           parameter_class=ManualParameter,
                           initial_value='average',
                           vals=vals.Enum('average', 'min-max'))
        self.add_parameter('scale',
                           parameter_class=ManualParameter,
                           initial_value='log-scale',
                           vals=vals.Enum('log-scale', 'lin-scale',
                                          'log-full-scale', 'lin-full-scale'))
        self.add_parameter('running',
                           parameter_class=ManualParameter,
                           initial_value=False,
                           vals=vals.Bool())
        self.add_parameter('decimation',
                           parameter_class=ManualParameter,
                           initial_value=1,
                           vals=vals.Ints(1, 8))
        self.add_parameter('bandwidth',
                           label='Bandwidth',
                           unit='Hz',
                           initial_value=0,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        # rbw Resolution bandwidth in Hz. RBW can be arbitrary.
        self.add_parameter('rbw',
                           label='Resolution Bandwidth',
                           unit='Hz',
                           initial_value=1e3,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())
        # vbw Video bandwidth in Hz. VBW must be less than or equal to RBW.
        #  VBW can be arbitrary. For best performance use RBW as the VBW.
        self.add_parameter('vbw',
                           label='Video Bandwidth',
                           unit='Hz',
                           initial_value=1e3,
                           parameter_class=ManualParameter,
                           vals=vals.Numbers())

        self.openDevice()
        self.device_type()

        t1 = time()
        print('Initialized SignalHound in %.2fs' % (t1 - t0))