Ejemplo n.º 1
0
    def __init__(self, transport, shims=None, channel=None):
        stb = {
            0: 'sweep mode active',
            1: 'standby mode active',
            2: 'quench condition present',
            3: 'power module failure',
            7: 'menu mode',
        }
        if not channel in (None, 1, 2):
            raise ValueError('Invalid channel. Must be either None, 1 or 2.')
        if channel:
            # if single channel mode is required, set the channel on every
            # command to avoid errors.
            protocol = slave.protocol.IEC60488(
                msg_prefix='CHAN {0};'.format(channel))
        else:
            protocol = slave.protocol.IEC60488()
        super(MPS4G, self).__init__(transport, protocol, stb=stb)
        if shims:
            if isinstance(shims, (str, bytes)):
                shims = [shims]
            for shim in list(shims):
                setattr(self, str(shim), Shim(transport, self._protocol, shim))

        if channel:
            # Channel is read only if channel is fixed
            self.channel = Command(('CHAN?', Set(1, 2)))
        else:
            self.channel = Command('CHAN?', 'CHAN', Set(1, 2))

        self.error = Command('ERROR?', 'ERROR', Boolean)
        self.current = Command('IMAG?', 'IMAG', UnitFloat)
        self.output_current = Command(('IOUT?', UnitFloat))
        # Custom format string to fix bug in firmware. The `;` must be appended
        self.lower_limit = Command('LLIM?', 'LLIM', UnitFloat(fmt='{0:.4f};'))
        self.mode = Command(('MODE?', String))
        self.name = Command('NAME?', 'NAME', String)
        self.switch_heater = Command('PSHTR?', 'PSHTR',
                                     Mapping({
                                         True: 'ON',
                                         False: 'OFF'
                                     }))
        for idx in range(0, 5):
            rng = Range(transport, self._protocol, idx)
            setattr(self, 'range{0}'.format(idx), rng)
        # Custom format string to fix bug in firmware. The `;` must be appended
        self.upper_limit = Command('ULIM?', 'ULIM', UnitFloat(fmt='{0:.4f};'))
        self.unit = Command('UNITS?', 'UNITS', Set('A', 'G'))
        self.voltage_limit = Command('VLIM?', 'VLIM', UnitFloat(min=0.,
                                                                max=10.))
        self.magnet_voltage = Command(('VMAG?', UnitFloat(min=-10., max=10.)))
        self.output_voltage = Command(('VMAG?', UnitFloat(min=-12.8,
                                                          max=12.8)))
        self.sweep_status = Command(('SWEEP?', String))
Ejemplo n.º 2
0
 def setUp(self):
     self._values = (
         'string',
         1337,
     )
     self._serialized = tuple(str(v) for v in self._values)
     self._type = Set(*self._values)
Ejemplo n.º 3
0
    def __init__(self, connection, idx):
        super(Loop, self).__init__(connection)
        self.idx = idx = int(idx)
        self.filter = Command('CFILT? {0}'.format(idx),
                              'CFILT {0},'.format(idx),
                              Boolean)
        self.limit = Command('CLIMIT? {0}'.format(idx),
                             'CLIMIT {0},'.format(idx),
                             [Float, Float, Float,
                              Enum(0.25, 0.5, 1., 2., start=1),
                              Integer(min=0, max=5)])
        self.manual_output = Command('MOUT? {0}'.format(idx),
                                     'MOUT {0},'.format(idx),
                                     Float(min=-100., max=100.))
        self.mode = Command('CMODE? {0}'.format(idx), 'CMODE {0},'.format(idx),
                            Enum('manual', 'zone', 'open', 'pid', 'pi', 'p',
                                 start=1))

        self.parameters = Command('CSET? {0}'.format(idx),
                                  'CSET {0},'.format(idx),
                                  [Set('A', 'B'),
                                   Enum('kelvin', 'celsius', 'sensor',
                                        start=1),
                                   Boolean,
                                   Boolean])
        self.pid = Command('PID? {0}'.format(idx), 'PID {0},'.format(idx),
                           [Float, Float, Float])
        self.ramp = Command('RAMP? {0}'.format(idx), 'RAMP {0},'.format(idx),
                            [Boolean, Float])
        self.ramping = Command(('RAMPST? {0}'.format(idx), Boolean))
        self.setpoint = Command('SETP? {0}'.format(idx),
                                'SETP {0},'.format(idx), Float)
        for z in range(1, 11):
            type_ = [
                Float(min=0),  # top value
                Float(min=0),  # P value
                Float(min=0),  # I value
                Float(min=0),  # D value
                Float(min=0),  # manual output
                Integer(min=0, max=5),  # heater range
            ]
            cmd = Command('ZONE? {0}, {1},'.format(idx, z),
                          'ZONE {0}, {1},'.format(idx, z),
                          type_)
            setattr(self, 'zone{0}'.format(z), cmd)
        if idx == 1:
            self.tuning_status = Command(('TUNEST?', Boolean))
            self.settle = Command('SETTLE?', 'SETTLE',
                                  [Float(min=0., max=100.),
                                   Integer(min=0, max=86400)])
        cdisp = [
            Enum('none', 'loop1', 'loop2', 'both'),
            Integer(min=0, max=1000),
            Enum('current', 'power', start=1),
            Boolean,
        ]
        self.display_parameters = Command('CDISP? {0}'.format(idx),
                                          'CDISP {0},'.format(idx), cdisp)
Ejemplo n.º 4
0
 def __init__(self, transport, protocol, idx):
     super(Input, self).__init__(transport, protocol)
     self.idx = idx = int(idx)
     self.average = Command(
         'MEAS:AVER? {0}'.format(idx),
         'MEAS:AVER {0},'.format(idx),
         Integer(min=1, max=250)
     )
     self.polarity = Command(
         'MEAS:POL? {0}'.format(idx),
         'MEAS:POL {0},'.format(idx),
         Enum('unipolar', 'bipolar', start=1)
     )
     # Due to a bug in the isc4807 firmware, a query returns 10.0001 instead
     # of 10. This leads to problems when a Set type is used as query and
     # write type.
     self.range = Command(
         ('MEAS:RANG? {0}'.format(idx), Integer),
         ('MEAS:RANG {0},'.format(idx), Set(5, 10))
     )
     self.voltage = Command(('MEAS:VOLT? {0}'.format(idx), Float))
Ejemplo n.º 5
0
 def __init__(self, connection, scanner=None):
     super(LS340, self).__init__(connection)
     self.scanner = _get_scanner(connection, scanner) if scanner else None
     self.a = Input(connection, 'A')
     self.b = Input(connection, 'B')
     self.output1 = Output(connection, 1)
     self.output2 = Output(connection, 2)
     # Control Commands
     # ================
     self.loop1 = Loop(connection, 1)
     self.loop2 = Loop(connection, 2)
     self.heater = Heater(connection)
     # System Commands
     # ===============
     self.beeper = Command('BEEP?', 'BEEP', Boolean)
     self.beeping = Command(('BEEPST?', Integer))
     self.busy = Command(('BUSY?', Boolean))
     self.com = Command('COMM?', 'COMM',
                         [Enum('CRLF', 'LFCR', 'CR', 'LF', start=1),
                          Enum(300, 1200, 2400, 4800, 9600, 19200, start=1),
                          Set(1, 2, 3)])
     self.datetime = Command('DATETIME?', 'DATETIME',
                             [Integer(min=1, max=12),
                              Integer(min=1, max=31),
                              Integer,
                              Integer(min=0, max=23),
                              Integer(min=0, max=59),
                              Integer(min=0, max=59),
                              Integer(min=0, max=999)])
     dispfld = [
         String,
         Enum('kelvin', 'celsius', 'sensor units', 'linear', 'min', 'max'),
     ]
     for i in range(1, 9):
         cmd = Command('DISPFLD? {0}'.format(i),
                       'DISPFLD {0},'.format(i),
                       dispfld)
         setattr(self, 'display_field{0}'.format(i), cmd)
     self.mode = Command('MODE?', 'MODE',
                         Enum('local', 'remote', 'lockout', start=1))
     self.key_status = Command(('KEYST?',
                                Enum('no key pressed', 'key pressed')))
     self.high_relay = Command('RELAY? 1', 'RELAY 1',
                               [Enum('off', 'alarms', 'manual'),
                                Boolean])
     self.low_relay = Command('RELAY? 2', 'RELAY 2',
                               [Enum('off', 'alarms', 'manual'),
                                Boolean])
     self.high_relay_status = Command(('RELAYST? 1', Enum('off', 'on')))
     self.low_relay_status = Command(('RELAYST? 2', Enum('off', 'on')))
     self.revision = Command(('REV?', [Integer for _ in range(9)]))
     self.lock = Command('LOCK?', 'LOCK',
                         [Boolean, Integer(min=0, max=999)])
     self.ieee = Command('IEEE?', 'IEEE',
                         [Enum(None, '\r\n', '\n\r', '\r', '\n'),
                          Boolean,
                          Integer(min=0, max=30)])
     dout = [
         Enum('off', 'alarms', 'scanner', 'manual'),
         Register({'DO1': 0, 'DO2': 1, 'DO3': 2, 'DO4': 3, 'DO5': 4})
     ]
     self.digital_output_param = Command('DOUT?', 'DOUT',
                                         dout)
     diost = [
         Register({'DI1': 0, 'DI2': 1, 'DI3': 2, 'DI4': 3, 'DI5': 4}),
         Register({'DO1': 0, 'DO2': 1, 'DO3': 2, 'DO4': 3, 'DO5': 4}),
     ]
     self.digital_io_status = Command(('DIOST?', diost))
     xscan = [
         Enum('off', 'manual', 'autoscan', 'slave'),
         Integer(min=1, max=16),
         Integer(min=0, max=999)
     ]
     self.scanner_parameters = Command('XSCAN?', 'XSCAN', xscan)
     # Curve Commands
     # ==============
     self.std_curve = tuple(
         Curve(connection, i, writeable=False) for i in range(1, 21)
     )
     self.user_curve = tuple(
         Curve(connection, i, writeable=True) for i in range(21, 61)
     )
     # Data Logging Commands
     # =====================
     self.logging = Command('LOG?', 'LOG', Boolean)
     logset_query_t = [
         Enum('invalid', 'readings', 'seconds', start=0),
         Integer(min=0, max=3600),
         Boolean,
         Enum('clear', 'continue')
     ]
     logset_write_t = [
         Enum('readings', 'seconds', start=1),
         Integer(min=1, max=3600),
         Boolean,
         Enum('clear', 'continue')
     ]
     self.logging_params = Command(('LOGSET?', logset_query_t),
                                   ('LOGSET', logset_write_t))
     self.program_status = Command(('PGMRUN?',
                                    [Integer, Enum(*self.PROGRAM_STATUS)]))
     self.programs = tuple(Program(connection, i) for i in range(1, 11))
     for i in range(1, 5):
         setattr(self, 'column{0}'.format(i), Column(connection, i))
Ejemplo n.º 6
0
    def __init__(self, connection):
        cfg = {
             'program data separator': ',',
        }
        super(SR7225, self).__init__(connection, cfg=cfg)
        # Signal channel
        # ==============
        self.current_mode = Command('IMODE', 'IMODE',
                                    Enum('off', 'high bandwidth', 'low noise'))
        self.voltage_mode = Command(
            'VMODE',
            'VMODE',
            Enum('test', 'A', 'A-B', start=1)
        )
        self.fet = Command('FET', 'FET', Enum('bipolar', 'fet'))
        self.grounding = Command('FLOAT', 'FLOAT', Enum('ground', 'float'))
        self.coupling = Command('CP', 'CP', Enum('ac', 'dc'))
        volt_sens = Enum(
            '2 nV', '5 nV', '10 nV', '20 nV', '50 nV', '100 nV', '200 nV',
            '500 nV', '1 uV', '2 uV', '5 uV', '10 uV', '20 uV', '50 uV',
            '100 uV', '200 uV', '500 uV', '1 mV', '2 mV', '5 mV', '10 mV',
            '20 mV', '50 mV', '100 mV', '200 mV', '500 mV', '1 V',
            start=1
        )
        self._voltage_sensitivity = Command('SEN', 'SEN', volt_sens)
        highbw_sens = Enum(
            '2 fA', '5 fA', '10 fA', '20 fA', '50 fA', '100 fA', '200 fA',
            '500 fA', '1 pA', '2 pA', '5 pA', '10 pA', '20 pA', '50 pA',
            '100 pA', '200 pA', '500 pA', '1 nA', '2 nA', '5 nA', '10 nA',
            '20 nA', '50 nA', '100 nA', '200 nA', '500 nA', '1 uA',
            start=1
        )
        self._highbandwidth_sensitivity = Command('SEN', 'SEN', highbw_sens)
        lownoise_sens = Enum(
            '2 fA', '5 fA', '10 fA', '20 fA', '50 fA', '100 fA', '200 fA',
            '500 fA', '1 pA', '2 pA', '5 pA', '10 pA', '20 pA', '50 pA',
            '100 pA', '200 pA', '500 pA', '1 nA', '2 nA', '5 nA', '10 nA',
            start=7
        )
        self._lownoise_sensitivity = Command('SEN', 'SEN', lownoise_sens)
        self.ac_gain = Command('ACGAIN', 'ACGAIN',
                               Enum('0 dB', '10 dB', '20 dB', '30 dB', '40 dB',
                                    '50 dB', '60 dB', '70 db', '80 dB', '90 dB'
                                    ))
        self.auto_ac_gain = Command('AUTOMATIC', 'AUTOMATIC', Boolean)
        self.line_filter = Command('LF', 'LF',
                                   [Enum('off', 'notch', 'double', 'both'),
                                    Enum('60Hz', '50Hz')])
        self.sample_frequency = Command('SAMPLE', 'SAMPLE',
                                        Integer(min=0, max=2))

        # Reference Channel
        # =================
        self.reference = Command('IE', 'IE', Enum('internal', 'rear', 'front'))
        self.harmonic = Command('REFN', 'REFN', Integer(min=1, max=32))
        self.reference_phase = Command('REFP.', 'REFP.',
                                       Float(min=-360., max=360.))
        self.reference_frequency = Command(('FRQ.', Float))

        # Signal channel output filters
        # =============================
        self.slope = Command('SLOPE', 'SLOPE',
                             Enum('6dB', '12dB', '18dB', '24dB'))
        self.time_constant = Command('TC', 'TC', Enum(*self.TIME_CONSTANT))
        self.sync = Command('SYNC', 'SYNC', Boolean)

        # Signal Channel Output Amplifiers
        # ================================
        self.x_offset = Command('XOF', 'XOF', Boolean,
                                Integer(min=-30000, max=30000))
        self.y_offset = Command('YOF', 'YOF', Boolean,
                                Integer(min=-30000, max=30000))
        self.expand = Command('EX', 'EX',
                              Enum('off', 'x', 'y', 'both'))
        self.channel1_output = Command('CH 1', 'CH 1 ',
                                       Enum('x', 'y', 'r', 'phase1', 'phase2',
                                            'noise', 'ratio', 'log ratio'))
        self.channel2_output = Command('CH 2', 'CH 2 ',
                                       Enum('x', 'y', 'r', 'phase1', 'phase2',
                                            'noise', 'ratio', 'log ratio'))

        # Instrument Outputs
        # ==================
        self.x = Command('X.', type_=Float)
        self.y = Command('Y.', type_=Float)
        self.xy = Command('XY.', type_=[Float, Float])
        self.r = Command('MAG.', type_=Float)
        self.theta = Command('PHA.', type_=Float)
        self.r_theta = Command('MP.', type_=[Float, Float])
        self.ratio = Command('RT.', type_=Float)
        self.log_ratio = Command('LR.', type_=Float)
        self.noise = Command('NHZ.', type_=Float)
        self.noise_bandwidth = Command('ENBW.', type_=Float)
        self.noise_output = Command('NN.', type_=Float)
        self.star = Command('STAR', 'STAR',
                            Enum('x', 'y', 'r', 'theta',
                                 'adc1', 'xy', 'rtheta', 'adc12'))
        # Internal oscillator
        # ===================
        self.amplitude = Command('OA.', 'OA.', Float(min=0., max=5.))
        self.amplitude_start = Command('ASTART.', 'ASTART.',
                                       Float(min=0., max=5.))
        self.amplitude_stop = Command('ASTOP.', 'ASTOP.',
                                      Float(min=0., max=5.))
        self.amplitude_step = Command('ASTEP.', 'ASTEP.',
                                      Float(min=0., max=5.))
        self.sync_oscillator = Command('SYNCOSC', 'SYNCOSC', Boolean)
        self.frequency = Command('OF.', 'OF.', Float(min=0, max=1.2e5))
        self.frequency_start = Command('FSTART.', 'FSTART.',
                                       Float(min=0, max=1.2e5))
        self.frequency_stop = Command('FSTOP.', 'FSTOP.',
                                       Float(min=0, max=1.2e5))
        self.frequency_step = Command('FSTEP.', 'FSTEP.',
                                      [Float(min=0, max=1.2e5),
                                       Enum('log', 'linear')])
        self.sweep_rate = Command('SRATE.', 'SRATE.',
                                  Float(min=0.05, max=1000))
        # Auxiliary Outputs
        # ================
        self.dac1 = Command('DAC. 1', 'DAC. 1 ', Float(min=-12., max=12.))
        self.dac2 = Command('DAC. 2', 'DAC. 2 ', Float(min=-12., max=12.))
        self.output_port = Command('BYTE', 'BYTE', Integer(min=0, max=255))
        # Auxiliary Inputs
        # ================
        self.adc1 = Command('ADC. 1', type_=Float)
        self.adc2 = Command('ADC. 2', type_=Float)
        self.adc_trigger_mode = Command('TADC', type_=Integer(min=0, max=13))
        self.burst_time = Command('BURSTTPP', 'BURSTTPP',
                                  Integer(min=25, max=5000))
        # Output Data Curve Buffer
        # ========================
        cb = Register(dict((v, k) for k, v in self.CURVE_BUFFER.iteritems()))
        self.curve_buffer_settings = Command('CBD', 'CBD', cb)
        self.curve_buffer_length = Command('LEN', 'LEN', Integer(min=0))
        self.storage_intervall = Command('STR', 'STR', Integer(min=0, max=1e9))
        self.event_marker = Command('EVENT', 'EVENT',
                                    Integer(min=0, max=32767))
        status_byte = Register(
            dict((v, k) for k, v in self.STATUS_BYTE.iteritems())
        )
        self.measurement_status = Command(('M', [Enum('no activity',
                                                      'td running',
                                                      'tdc running',
                                                      'td halted',
                                                      'tdc halted'),
                                                 Integer,
                                                 status_byte,
                                                 Integer]))
        # Computer Interfaces
        # ===================
        rs = Register(dict((v, k) for k, v in self.RS232.iteritems()))
        self.rs232 = Command('RS', 'RS', [Enum(*self.BAUD_RATE), rs])
        self.gpib = Command('GP', 'GP',
                            [Integer(min=0, max=31),
                             Enum('CR', 'CR echo', 'CRLF', 'CRLF echo',
                                  'None', 'None echo')])
        self.delimiter = Command('DD', 'DD', Set(13, *range(31, 126)))
        self.status = Command('ST', type_=status_byte)
        overload_byte = {
            'ch1 output overload': 1,
            'ch2 output overload': 2,
            'y output overload': 3,
            'x output overload': 4,
            'input overload': 6,
            'reference unlock': 7,
        }
        self.overload_status = Command('N', type_=Register(overload_byte))
        self.status_enable = Command('MSK', 'MSK', status_byte)
        self.remote = Command('REMOTE', 'REMOTE', Boolean)
        # Instrument identification
        # =========================
        self.identification = Command('ID', type_=String)
        self.revision = Command('REV', type_=String)
        self.version = Command('VER', type_=String)
        # Frontpanel
        # ==========
        self.lights = Command('LTS', 'LTS', Boolean)
Ejemplo n.º 7
0
 def __init__(self, transport, protocol):
     super(Unit, self).__init__(transport, protocol)
     self.temperature = Command(':UNIT:TEMP?', ':UNIT:TEMP',
                                Set('C', 'F', 'K'))
Ejemplo n.º 8
0
    def __init__(self, transport):
        protocol = slave.protocol.IEC60488(msg_term='\r\n', resp_term='\r\n')
        super(SR7225, self).__init__(transport, protocol)
        # Signal channel
        # ==============
        self.current_mode = Command('IMODE', 'IMODE',
                                    Enum('off', 'high bandwidth', 'low noise'))
        self.voltage_mode = Command('VMODE', 'VMODE',
                                    Enum('test', 'A', 'A-B', start=1))
        self.fet = Command('FET', 'FET', Enum('bipolar', 'fet'))
        self.grounding = Command('FLOAT', 'FLOAT', Enum('ground', 'float'))
        self.coupling = Command('CP', 'CP', Enum('ac', 'dc'))
        self._voltage_sensitivity = Command(
            'SEN', 'SEN', Enum(*SR7225.SENSITIVITY_VOLTAGE, start=1))
        self._highbandwidth_sensitivity = Command(
            'SEN', 'SEN', Enum(*SR7225.SENSITIVITY_CURRENT_HIGHBW, start=1))
        self._lownoise_sensitivity = Command(
            'SEN', 'SEN', Enum(*SR7225.SENSITIVITY_CURRENT_LOWNOISE, start=7))
        self.ac_gain = Command('ACGAIN', 'ACGAIN', Enum(*SR7225.AC_GAIN))
        self.auto_ac_gain = Command('AUTOMATIC', 'AUTOMATIC', Boolean)
        self.line_filter = Command(
            'LF', 'LF',
            [Enum('off', 'notch', 'double', 'both'),
             Enum('60Hz', '50Hz')])
        self.sample_frequency = Command('SAMPLE', 'SAMPLE',
                                        Integer(min=0, max=2))

        # Reference Channel
        # =================
        self.reference = Command('IE', 'IE', Enum('internal', 'ttl', 'analog'))
        self.harmonic = Command('REFN', 'REFN', Integer(min=1, max=32))
        self.reference_phase = Command('REFP.', 'REFP.',
                                       Float(min=-360., max=360.))
        self.reference_frequency = Command(('FRQ.', Float))

        # Signal channel output filters
        # =============================
        self.slope = Command('SLOPE', 'SLOPE',
                             Enum('6 dB', '12 dB', '18 dB', '24 dB'))
        self.time_constant = Command('TC', 'TC', Enum(*self.TIME_CONSTANT))
        self.sync = Command('SYNC', 'SYNC', Boolean)

        # Signal Channel Output Amplifiers
        # ================================
        self.x_offset = Command(
            'XOF', 'XOF', [Boolean, Integer(min=-30000, max=30000)])
        self.y_offset = Command(
            'YOF', 'YOF', [Boolean, Integer(min=-30000, max=30000)])
        self.expand = Command('EX', 'EX', Enum('off', 'x', 'y', 'both'))
        self.channel1_output = Command(
            'CH 1', 'CH 1 ',
            Enum('x', 'y', 'r', 'phase1', 'phase2', 'noise', 'ratio',
                 'log ratio'))
        self.channel2_output = Command(
            'CH 2', 'CH 2 ',
            Enum('x', 'y', 'r', 'phase1', 'phase2', 'noise', 'ratio',
                 'log ratio'))

        # Instrument Outputs
        # ==================
        self.x = Command(('X.', Float))
        self.y = Command(('Y.', Float))
        self.xy = Command(('XY.', [Float, Float]))
        self.r = Command(('MAG.', Float))
        self.theta = Command(('PHA.', Float))
        self.r_theta = Command(('MP.', [Float, Float]))
        self.ratio = Command(('RT.', Float))
        self.log_ratio = Command(('LR.', Float))
        self.noise = Command(('NHZ.', Float))
        self.noise_bandwidth = Command(('ENBW.', Float))
        self.noise_output = Command(('NN.', Float))
        self.star = Command(
            'STAR', 'STAR',
            Enum('x', 'y', 'r', 'theta', 'adc1', 'xy', 'rtheta', 'adc12'))
        # Internal oscillator
        # ===================
        self.amplitude = Command('OA.', 'OA.', Float(min=0., max=5.))
        self.amplitude_start = Command('ASTART.', 'ASTART.',
                                       Float(min=0., max=5.))
        self.amplitude_stop = Command('ASTOP.', 'ASTOP.', Float(min=0.,
                                                                max=5.))
        self.amplitude_step = Command('ASTEP.', 'ASTEP.', Float(min=0.,
                                                                max=5.))
        self.sync_oscillator = Command('SYNCOSC', 'SYNCOSC', Boolean)
        self.frequency = Command('OF.', 'OF.', Float(min=0, max=1.2e5))
        self.frequency_start = Command('FSTART.', 'FSTART.',
                                       Float(min=0, max=1.2e5))
        self.frequency_stop = Command('FSTOP.', 'FSTOP.',
                                      Float(min=0, max=1.2e5))
        self.frequency_step = Command(
            'FSTEP.', 'FSTEP.',
            [Float(min=0, max=1.2e5),
             Enum('log', 'linear')])
        self.sweep_rate = Command('SRATE.', 'SRATE.', Float(min=0.05,
                                                            max=1000))
        # Auxiliary Outputs
        # ================
        self.dac1 = Command('DAC. 1', 'DAC. 1 ', Float(min=-12., max=12.))
        self.dac2 = Command('DAC. 2', 'DAC. 2 ', Float(min=-12., max=12.))
        self.output_port = Command('BYTE', 'BYTE', Integer(min=0, max=255))
        # Auxiliary Inputs
        # ================
        self.adc1 = Command('ADC. 1', type_=Float)
        self.adc2 = Command('ADC. 2', type_=Float)
        self.adc_trigger_mode = Command('TADC', type_=Integer(min=0, max=13))
        self.burst_time = Command('BURSTTPP', 'BURSTTPP',
                                  Integer(min=25, max=5000))
        # Output Data Curve Buffer
        # ========================
        cb = Register(self.CURVE_BUFFER)
        self.curve_buffer_settings = Command('CBD', 'CBD', cb)
        self.curve_buffer_length = Command('LEN', 'LEN', Integer(min=0))
        self.storage_intervall = Command('STR', 'STR', Integer(min=0, max=1e9))
        self.event_marker = Command('EVENT', 'EVENT', Integer(min=0,
                                                              max=32767))
        self.measurement_status = Command(('M', [
            Enum('no activity', 'td running', 'tdc running', 'td halted',
                 'tdc halted'), Integer,
            Register(self.STATUS_BYTE), Integer
        ]))
        # Computer Interfaces
        # ===================
        rs = Register(self.RS232)
        self.rs232 = Command('RS', 'RS', [Enum(*self.BAUD_RATE), rs])
        self.gpib = Command('GP', 'GP', [
            Integer(min=0, max=31),
            Enum('CR', 'CR echo', 'CRLF', 'CRLF echo', 'None', 'None echo')
        ])
        self.delimiter = Command('DD', 'DD', Set(13, *range(31, 126)))
        self.status = Command(('ST', Register(self.STATUS_BYTE)))
        self.overload_status = Command(('N', Register(self.OVERLOAD_BYTE)))
        self.status_enable = Command('MSK', 'MSK', Register(self.STATUS_BYTE))
        self.remote = Command('REMOTE', 'REMOTE', Boolean)
        # Instrument identification
        # =========================
        self.identification = Command('ID', type_=String)
        self.revision = Command('REV', type_=String)
        self.version = Command('VER', type_=String)
        # Frontpanel
        # ==========
        self.lights = Command('LTS', 'LTS', Boolean)
Ejemplo n.º 9
0
    def __init__(self, transport):
        """Constructs a SR830 instrument object.

        :param transport: A transport object.

        """
        super(SR830, self).__init__(transport)

        # Reference and phase commands
        # ============================
        #: Sets and queries the reference phase
        self.phase = Command('PHAS?', 'PHAS',
                             Float(min=-360., max=729.99))
        #: Sets or queries the reference source
        self.reference = Command('FMOD?', 'FMOD',
                                 Enum('external', 'internal'))
        #: Sets or queries the internal reference frequency.
        self.frequency = Command('FREQ?', 'FREQ',
                                 Float(min=0.001, max=102000.))
        #: Sets or triggers the reference trigger mode.
        self.reference_trigger = Command('RSLP?', 'RSLP',
                                         Enum('sine', 'rise', 'fall'))
        #: Sets or queries the detection harmonic.
        self.harmonic = Command('HARM?', 'HARM', Integer(min=1, max=19999))
        #: Sets or queries the amplitude of the sine output.
        self.amplitude = Command('SLVL?', 'SLVL', Float(min=0.004, max=5.))

        # Input and filter commands
        # =========================
        #: Sets or queries the input configuration.
        self.input = Command('ISRC?', 'ISRC', Enum('A', 'A-B', 'I', 'I100'))
        #: Sets or queries the input shield grounding.
        self.ground = Command('IGND?', 'IGND', Boolean)
        #: Sets or queries the input coupling.
        self.coupling = Command('ICPL?', 'ICPL', Enum('AC', 'DC'))
        #: Sets or queries the input line notch filter status.
        self.filter = Command('ILIN?', 'ILIN',
                              Enum('unfiltered', 'notch', '2xnotch', 'both'))

        # Gain and time constant commands
        # ===============================
        #: Sets or queries the sensitivity in units of volt.
        self.sensitivity = Command('SENS?', 'SENS',
                                   Enum(*SR830.SENSITIVITY))
        #: Sets or queries the dynamic reserve.
        self.reserve = Command('RMOD?', 'RMOD', Enum('high', 'medium', 'low'))
        #: Sets or queries the time constant in seconds.
        self.time_constant = Command('OFLT?', 'OFLT',
                                     Enum(*SR830.TIME_CONSTANT))
        #: Sets or queries the low-pass filter slope.
        self.slope = Command('OFSL?', 'OFSL', Integer(min=0, max=3))
        #: Sets or queries the synchronous filtering mode.
        self.sync = Command('SYNC?', 'SYNC', Boolean)

        # Display and output commands
        # ===========================
        #: Set or query the channel 1 display settings.
        self.ch1_display = Command('DDEF? 1', 'DDEF 1',
                                   [Enum('X', 'R', 'Xnoise',
                                         'AuxIn1', 'AuxIn2'),
                                    Enum('none', 'AuxIn1', 'AuxIn2')])
        #: Set or query the channel 2 display settings.
        self.ch2_display = Command('DDEF? 2', 'DDEF 2',
                                   [Enum('Y', 'Theta', 'Ynoise',
                                         'AuxIn3', 'AuxIn4'),
                                    Enum('none', 'AuxIn3', 'AuxIn4')])
        #: Sets the channel1 output.
        self.ch1_output = Command('FPOP? 1', 'FPOP 1,', Enum('CH1', 'X'))
        #: Sets the channel2 output.
        self.ch2_output = Command('FPOP? 2', 'FPOP 2,', Enum('CH2', 'Y'))
        #:Sets or queries the x value offset and expand.
        self.x_offset_and_expand = Command('OEXP? 1', 'OEXP 1',
                                         [Float(min=-105., max=105.),
                                          Set(0, 10, 100)])
        #:Sets or queries the x value offset and expand.
        self.y_offset_and_expand = Command('OEXP? 2', 'OEXP 2',
                                         [Float(min=-105., max=105.),
                                          Set(0, 10, 100)])
        #:Sets or queries the x value offset and expand
        self.r_offset_and_expand = Command('OEXP? 3', 'OEXP 3',
                                         [Float(min=-105., max=105.),
                                          Set(0, 10, 100)])

        # Aux input and output commands
        # =============================
        for id in range(1, 5):
            setattr(self, 'aux{0}'.format(id), Aux(transport, self._protocol, id))

        # Setup commands
        # ==============
        #: Sets or queries the output interface.
        self.output_interface = Command('OUTX?', 'OUTX', Enum('RS232', 'GPIB'))
        #: Sets the remote mode override.
        self.overide_remote = Command(write=('OVRM', Boolean))
        #: Sets or queries the key click state.
        self.key_click = Command('KCLK?', 'KCLK', Boolean)
        #: Sets or queries the alarm state.
        self.alarm = Command('ALRM?', 'ALRM', Boolean)

        # Data storage commands
        # =====================
        self.sample_rate = Command('SRAT?', 'SRAT', Integer(min=0, max=14))
        #: The send command sets or queries the end of buffer mode.
        #: .. note::
        #:
        #:    If loop mode is used, the data storage should be paused to avoid
        #:    confusion about which point is the most recent.
        self.send_mode = Command('SEND?', 'SEND', Enum('shot', 'loop'))

        # Data transfer commands
        # ======================
        #: Reads the value of x.
        self.x = Command(('OUTP? 1', Float))
        #: Reads the value of y.
        self.y = Command(('OUTP? 2', Float))
        #: Reads the value of r.
        self.r = Command(('OUTP? 3', Float))
        #: Reads the value of theta.
        self.theta = Command(('OUTP? 4', Float))
        #: Reads the value of channel 1.
        self.ch1 = Command(('OUTR? 1', Float))
        #: Reads the value of channel 2.
        self.ch2 = Command(('OUTR? 2', Float))
        #: Queries the number of data points stored in the internal buffer.
        self.data_points = Command(('SPTS?', Integer))
        #: Sets or queries the data transfer mode.
        #: .. note::
        #:
        #:    Do not use :class:`~SR830.start() to execute the scan, use
        #:    :class:`~SR830.delayed_start instead.
        self.fast_mode = Command('FAST?', 'FAST',
                                 Enum('off', 'DOS', 'Windows'))

        # Interface Commands
        # ==================
        #: Queries the device identification string
        self.idn = Command('*IDN?', type_=[String, String, String, String])
        #: Queries or sets the state of the frontpanel.
        self.state = Command('LOCL?', 'LOCL',
                             Enum('local', 'remote', 'lockout'))

        # Status reporting commands
        # =========================
        self.error_status = ErrorStatus(transport, self._protocol)
        self.error_enable = ErrorEnable(transport, self._protocol)
        self.lockin_status = LockInStatus(transport, self._protocol)
        self.lockin_enable = LockInEnable(transport, self._protocol)
        self.serial_poll_status = SerialPollStatus(transport, self._protocol)
        self.serial_poll_enable = SerialPollEnable(transport, self._protocol)
        self.std_event_status = StandardEventStatus(transport, self._protocol)
        self.std_event_enable = StandardEventEnable(transport, self._protocol)
        #: Enables or disables the clearing of the status registers on poweron.
        self.clear_on_poweron = Command('*PSC?', '*PSC', Boolean)