示例#1
0
 def __init__(self, transport, protocol):
     super(Output, self).__init__(transport, protocol)
     self.gain = Command('OUTP:GAIN?', 'OUTP:GAIN',
                         Float(min=-100e6, max=100e6))
     self.offset = Command('OUTP:OFFS?', 'OUTP:OFFS',
                           Float(min=-1.2, max=1.2))
     self.relative = Command('OUTP:REL?', 'OUTP:REL', Boolean)
     self.state = Command('OUTP:STAT?', 'OUTP:STAT', Boolean)
示例#2
0
 def __init__(self, connection, cfg, idx):
     super(Range, self).__init__(connection, cfg)
     self.idx = idx = int(idx)
     if not idx in range(0, 5):
         raise ValueError('Invalid range index.'
                          ' Must be one of {0}'.format(range(0, 5)))
     self.limit = Command('RANGE? {0}'.format(idx),
                          'RANGE {0} '.format(idx), Float(fmt='{0:.4f}'))
     self.rate = Command('RATE? {0}'.format(idx), 'RATE {0}'.format(idx),
                         Float(min=1e-4, max=100., fmt='{0:.4f}'))
示例#3
0
 def __init__(self, transport, protocol, idx):
     super(Output, self).__init__(transport, protocol)
     idx = int(idx)
     self.mode = Command('AUXM? {0}'.format(idx), 'AUXM {0},'.format(idx),
                         Enum('fixed', 'log', 'linear'))
     self.voltage = Command('AUXV? {0}'.format(idx),
                            'AUXV {0},'.format(idx),
                            Float(min=-10.5, max=10.5))
     self.limits = Command(
         'SAUX? {0}'.format(idx), 'SAUX {0},'.format(idx),
         (Float(min=1e-3, max=21), Float(
             min=1e-3, max=21), Float(min=-10.5, max=10.5)))
示例#4
0
文件: ppms.py 项目: utopianf/slave
 def __init__(self, transport, protocol, id):
     super(BridgeChannel, self).__init__(transport, protocol)
     self.idx = id
     self.config = Command('BRIDGE? {}'.format(id), 'BRIDGE {} '.format(id),
                           [
                               Float(min=0.01, max=5000.),
                               Float(min=0.001, max=1000.),
                               Enum('AC', 'DC'),
                               Enum('standart', 'fast', 'high res')
                           ])
     bit = 2 * (id + 1)
     self.current = Command(('GETDAT? {}'.format(2**bit), Float))
     self.resistance = Command(('GETDAT? {}'.format(2**(bit + 1)), Float))
示例#5
0
 def __init__(self, transport, protocol):
     super(Sense, self).__init__(transport, protocol)
     self.delta_mode = Command(':SENS:VOLT:DELT?', ':SENS:VOLT:DELT',
                               Boolean)
     self.function = Command(
         ':SENS:FUNC?', ':SENS:FUNC',
         Mapping({
             'voltage': '"VOLT:DC"',
             'temperature': '"TEMP"'
         }))
     self.nplc = Command(':SENS:VOLT:NPLC?', ':SENS:VOLT:NPLC',
                         Float(min=0.01, max=50))
     self.auto_range = Command(':SENS:VOLT:RANG:AUTO?', ':SENS:VOLT:RANG',
                               Boolean)
     self.range = Command(':SENS:VOLT:RANG?', ':SENS:VOLT:RANG',
                          Float(min=0, max=120))
示例#6
0
文件: ppms.py 项目: utopianf/slave
    def __init__(self, transport, max_field=None):
        # The PPMS uses whitespaces to separate data and semicolon to terminate
        # a message.
        protocol = slave.protocol.IEC60488(msg_data_sep=',',
                                           msg_term=';',
                                           resp_data_sep=',',
                                           resp_term=';')
        super(PPMS, self).__init__(transport, protocol)
        self.advisory_number = Command(('ADVNUM?', Integer(min=0, max=999)))
        self.chamber = Command(
            'CHAMBER?', 'CHAMBER',
            Enum('seal', 'purge seal', 'vent seal', 'pump', 'vent'))
        self.sample_space_pressure = Command(('GETDAT? 524288', Float))
        self.move_config = Command(
            'MOVECFG?',
            'MOVECFG',
            (
                Enum('steps', 'degree', 'radian', 'mm', 'cm', 'mils', 'inch'),
                Float,  # Units per step
                Float  # The total range
            ))
        self.sample_position = Command(('GETDAT? 8', Float))
        self.magnet_config = Command('MAGCNF?', 'MAGCNF',
                                     [Float] * 5 + [Integer, Integer])
        if max_field is None:
            max_field = self.magnet_config[0]

        self.target_field = Command(
            'FIELD?', 'FIELD',
            (Float(min=-max_field, max=max_field,
                   fmt='{0:.2f}'), Float(min=10.5, max=196., fmt='{0:.1f}'),
             Enum('linear', 'no overshoot',
                  'oscillate'), Enum('persistent', 'driven')))
        # TODO Allow for the configuration of the ranges
        self.target_temperature = Command(
            'TEMP?', 'TEMP', (Float(min=1.9, max=350.), Float(
                min=0., max=20), Enum('fast', 'no overshoot')))
        self.digital_input = Command(
            ('DIGIN?', Register(STATUS_DIGITAL_INPUT)))
        cmds = [
            Command('DRVOUT? {}'.format(i), 'DRVOUT {} '.format(i),
                    [Float(min=0, max=1000.),
                     Float(min=0., max=20.)]) for i in range(1, 3)
        ]
        self.driver_output = CommandSequence(self._transport, self._protocol, [
            Command('DRVOUT? {}'.format(i), 'DRVOUT {} '.format(i),
                    [Float(min=0, max=1000.),
                     Float(min=0., max=20.)]) for i in range(1, 3)
        ])
        self.bridge = [
            BridgeChannel(self._transport, self._protocol, i)
            for i in range(1, 5)
        ]
        self.level = Command(
            ('LEVEL?', [Float, Enum('>1h', '<1h', 'continuous')]))
        self.revision = Command(('REV?', [String, String]))
示例#7
0
文件: ppms.py 项目: utopianf/slave
    def beep(self, duration, frequency):
        """Generates a beep.

        :param duration: The duration in seconds, in the range 0.1 to 5.
        :param frequency: The frequency in Hz, in the range 500 to 5000.

        """
        cmd = 'BEEP', [Float(min=0.1, max=5.0), Integer(min=500, max=5000)]
        self._write(cmd, duration, frequency)
示例#8
0
 def __init__(self, transport, protocol):
     super(Trigger, self).__init__(transport, protocol)
     self.auto_delay = Command(':TRIG:DEL:AUTO?', ':TRIG:DEL:AUTO', Boolean)
     # TODO count has a max value of 9999 but supports infinity as well.
     self.count = Command(':TRIG:COUN?', ':TRIG:COUN', Float(min=0.))
     self.delay = Command(':TRIG:DEL?', ':TRIG:DEL',
                          Float(min=0., max=999999.999))
     self.source = Command(
         ':TRIG:SOUR?', ':TRIG:SOUR',
         Mapping({
             'immediate': 'IMM',
             'timer': 'TIM',
             'manual': 'MAN',
             'bus': 'BUS',
             'external': 'EXT'
         }))
     self.timer = Command(':TRIG:TIM?', ':TRIG:TIM',
                          Float(min=0., max=999999.999))
示例#9
0
 def make_zone(i):
     """Helper function to create a zone command."""
     type_ = [
         Float, Float(min=0.001, max=1000.), Integer(min=0, max=10000),
         Integer(min=0, max=10000), Integer(min=0, max=100),
         Enum(*Heater.RANGE), Boolean, Boolean,
         Integer(min=-100, max=100),Integer(min=-100, max=100)
     ]
     return Command('ZONE? {0}'.format(i), 'ZONE {0},'.format(i), type_)
示例#10
0
 def __init__(self, transport, protocol, id):
     super(Aux, self).__init__(transport, protocol)
     self.id = id = int(id)
     #: Queries the aux input voltages.
     self.input = Command(('OAUX? {0}'.format(id), Float))
     #: Sets and queries the output voltage.
     self.output = Command('AUXV? {0}'.format(id),
                           'AUXV {0},'.format(id),
                           Float(min=-10.5, max=10.5))
示例#11
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)
示例#12
0
 def __init__(self, transport, protocol, idx):
     super(Display, self).__init__(transport, protocol)
     idx = int(idx)
     self.type = Command('DTYP? {0}'.format(idx), 'DTYP {0},'.format(idx),
                         Enum('polar', 'blank', 'bar', 'chart'))
     self.trace = Command('DTRC? {0}'.format(idx), 'DTRC {0},'.format(idx),
                          Integer(min=1, max=4))
     self.range = Command('DSCL? {0}'.format(idx), 'DSCL {0},'.format(idx),
                          Float(min=1e-18, max=1e18))
     self.offset = Command('DOFF? {0}'.format(idx), 'DOFF {0},'.format(idx),
                           Float(min=1e-12, max=1e12))
     self.horizontal_scale = Command(
         'DHZS? {0}'.format(idx), 'DHZS {0},'.format(idx),
         Enum('2 ms', '5 ms', '10 ms', '20 ms', '50 ms', '0.1 s', '0.2 s',
              '0.5 s', '1 s', '2 s', '5 s', '10 s', '20 s', '50 s', '1 min',
              '100 s', '2 min', '200 s', '5 min', '500 s', '10 min', '1 ks',
              '20 min', '2 ks', '1 h', '10 ks', '3 h', '20 ks', '50 ks',
              '100 ks', '200 ks'))
     self.bin = Command(('RBIN ? {0}'.format(idx), Integer))
     self.cursor = Command(('CURS? {0}'.format(idx), (Float, Float)))
示例#13
0
 def __init__(self, connection, cfg, shim):
     super(Shim, self).__init__(connection, cfg)
     if not shim in SHIMS:
         raise ValueError('Invalid shim identifier, '
                          'must be one of {0}'.format(SHIMS))
     self._shim = shim = str(shim)
     self.limit = Command('SLIM?', 'SLIM', Float(min=-30., max=30.))
     state = {
         True: '{0} Enabled'.format(shim),
         False: '{0} Disabled'.format(shim)
     }
     self.status = Command(('SHIM?', Mapping(state)))
     self.current = Command('IMAG? {0}'.format(shim),
                            'IMAG {0}'.format(shim), UnitFloat)
示例#14
0
 def __init__(self, connection, idx, writeable, length=None):
     super(Curve, self).__init__(connection)
     self.idx = idx = int(idx)
     self.__length = length or 200
     # curves 1-20 are internal and not writeable.
     self._writeable = writeable
     self.header = Command('CRVHDR? {0}'.format(idx),
                           'CRVHDR {0},'.format(idx) if writeable else None,
                           [String(max=15),
                            String(max=10),
                            Enum('mV/K', 'V/K', 'Ohm/K',
                                 'logOhm/K', 'logOhm/logK', start=1),
                            Float(min=0.),
                            Enum('negative', 'positive', start=1)])
示例#15
0
 def __init__(self, transport, protocol, idx, length):
     super(Curve, self).__init__(transport, protocol)
     self.idx = idx = int(idx)
     self.header = Command(
         'CRVHDR? {0}'.format(idx),
         'CRVHDR {0},'.format(idx),
         [
             String(max=15),
             String(max=10),
             Enum('Ohm/K', 'logOhm/K', start=3),
             Float(min=0.),Enum('negative', 'positive', start=1)
         ]
     )
     if length > 0:
         self.__length = int(length)
     else:
         raise ValueError('length must be a positive integer > 0')
示例#16
0
    def __init__(self, transport, scanner=None):
        super(LS370, self).__init__(transport)
        self.baud = Command('BAUD?', 'BAUD', Enum(300, 1200, 9600))
        self.beeper = Command('BEEP?', 'BEEP', Boolean)
        self.brightness = Command('BRIGT?', 'BRIGT', Enum(25, 50, 75, 100))
        self.common_mode_reduction = Command('CMR?', 'CMR', Boolean)
        self.control_mode = Command(
            'CMODE?',
            'CMODE',
            Enum('closed', 'zone', 'open', 'off', start=1)
        )
        self.control_params = Command(
            'CSET?',
            'CSET',
            [Integer(min=0, max=16), Enum('unfiltered', 'filtered'),
             Enum('kelvin', 'ohm', start=1), Integer(min=0, max=255),
             Enum('current', 'power', start=1), Enum(*Heater.RANGE),
             Float(min=1., max=100000.)]
        )
        # TODO disable if 3716 scanner option is used.
        self.digital_output = Command(
            'DOUT?',
            'DOUT',
            Register({
                0: 'DO1',
                1: 'DO2',
                2: 'DO3',
                3: 'DO4',
                4: 'DO5'
            }),
        )
        self.displays = tuple(
            Display(transport, self._protocol, i) for i in range(1, 9)
        )
        self.display_locations = Command(
            'DISPLAY?',
            'DISPLAY',
            Integer(min=1, max=8)
        )
        self.frequency = Command(
            'FREQ?',
            'FREQ',
            Enum('9.8 Hz', '13.7 Hz', '16.2 Hz', start=1)
        )
        self.guard = Command('GUARD?', 'GUARD', Boolean)
        self.ieee = Command('IEEE?', 'IEEE',
                            [Enum('\r\n', '\n\r', '\n', None),
                             Boolean,
                             Integer(min=0, max=30)])
        # TODO only active if model scanner 3716 is installed.
        self.input_change = Command('CHGALL?', 'CHGALL', Enum('one', 'all'))
        self.mode = Command('MODE?', 'MODE',
                            Enum('local', 'remote', 'lockout', start=1))
        self.monitor = Command(
            'MONITOR?',
            'MONITOR',
            Enum('off', 'cs neg', 'cs pos', 'vad',
                 'vcm neg', 'vcm pos', 'vdif', 'vmix')
        )
        self.output = (
            Output(transport, self._protocol, 1),
            Output(transport, self._protocol, 2)
        )
        self.pid = Command(
            'PID?',
            'PID',
            [Float(min=1e-3, max=1e3), Float(min=0., max=1e4),
             Float(min=0, max=2.5e3)]
        )
        self.polarity = Command('CPOL?', 'CPOL', Enum('unipolar', 'bipolar'))
        self.ramp = Command(
            'RAMP?',
            'RAMP',
            [Boolean, Float(min=1e-3, max=10.)]
        )
        self.ramping = Command(('RAMPST?', Boolean))
        self.low_relay = Relay(transport, self._protocol, 1)
        self.high_relay = Relay(transport, self._protocol, 2)
        self.scanner = scanner
        self.setpoint = Command('SETP?', 'SETP', Float)
        self.still = Command('STILL?', 'STILL', Float)
        self.all_curves = Curve(transport, self._protocol, 0, 200)
        self.user_curve = tuple(
            Curve(transport, self._protocol, i, 200) for i in range(1, 21)
        )

        def make_zone(i):
            """Helper function to create a zone command."""
            type_ = [
                Float, Float(min=0.001, max=1000.), Integer(min=0, max=10000),
                Integer(min=0, max=10000), Integer(min=0, max=100),
                Enum(*Heater.RANGE), Boolean, Boolean,
                Integer(min=-100, max=100),Integer(min=-100, max=100)
            ]
            return Command('ZONE? {0}'.format(i), 'ZONE {0},'.format(i), type_)
        self.zones = CommandSequence(
            self._transport,
            self._protocol,
            (make_zone(i) for i in range(1, 11))
        )
示例#17
0
文件: ppms.py 项目: utopianf/slave
 def __init__(self, transport, protocol, id):
     super(AnalogOutput, self).__init__(transport, protocol)
     self.id = id
     self.voltage = Command('SIGOUT? {}'.format(self.id),
                            'SIGOUT {} '.format(self.id),
                            Float(min=-10., max=10.))
示例#18
0
    def __init__(self, transport):
        stb = {
            0: 'SCN',
            1: 'IFC',
            2: 'ERR',
            3: 'LIA',
            4: 'MAV',
            5: 'ESB',
            6: 'SRQ',
            7: '7'
        }
        esb = {
            0: 'INP',
            1: '1',
            2: 'QRY',
            3: '3',
            4: 'EXE',
            5: 'CMD',
            6: 'URQ',
            7: 'PON',
        }
        err = {
            0: 'print/plot error',
            1: 'backup error',
            2: 'ram error',
            3: 'disk error',
            4: 'rom error',
            5: 'gpib error',
            6: 'dsp error',
        }
        super(SR850, self).__init__(transport, stb=stb, esb=esb)
        # Status Reporting Commands
        self.lia_status = Command(('LIAS?', Register(self.LIA_BYTE)))
        self.lia_status_enable = Command('LIAE?', 'LIAE',
                                         Register(self.LIA_BYTE))
        # Reference and Phase Commands
        self.phase = Command('PHAS?', 'PHAS', Float(min=-360., max=719.999))
        self.reference_mode = Command('FMOD?', 'FMOD',
                                      Enum('internal', 'sweep', 'external'))
        self.frequency = Command('FREQ?', 'FREQ', Float(min=0.001, max=102000))
        self.frequency_sweep = Command('SWPT?', 'SWPT', Enum('linear', 'log'))
        self.start_frequency = Command('SLLM?', 'SLLM',
                                       Float(min=0.001, max=102000))
        self.stop_frequency = Command('SULM?', 'SULM',
                                      Float(min=0.001, max=102000))
        self.reference_slope = Command('RSLP?', 'RSLP',
                                       Enum('sine', 'rising', 'falling'))
        self.harmonic = Command('HARM?', 'HARM', Integer(min=1, max=32767))
        self.amplitude = Command('SLVL?', 'SLVL', Float(min=0.002, max=5.0))
        # Input and Filter Commands
        self.input = Command('ISRC?', 'ISRC', Enum('A', 'A-B', 'I'))
        self.input_gain = Command('IGAN?', 'IGAN', Enum('1 MOhm', '100 MOhm'))
        self.ground = Command('IGND?', 'IGND', Enum('float', 'ground'))
        self.coupling = Command('ICPL?', 'ICPL', Enum('AC', 'DC'))
        self.filter = Command('ILIN?', 'ILIN',
                              Enum('unfiltered', 'notch', '2xnotch', 'both'))
        # Gain and Timeconstant Commands
        self.sensitivity = Command(
            'SENS?', 'SENS',
            Enum(2e-9, 5e-9, 10e-9, 20e-9, 50e-9, 100e-9, 200e-9, 500e-9, 1e-6,
                 2e-6, 5e-6, 10e-6, 20e-6, 50e-6, 100e-6, 200e-6, 500e-6, 1e-3,
                 2e-3, 5e-3, 10e-3, 20e-3, 50e-3, 100e-3, 200e-3, 500e-3, 1))
        self.reserve_mode = Command('RMOD?', 'RMOD',
                                    Enum('max', 'manual', 'min'))
        self.reserve = Command('RSRV?', 'RSRV', Integer(min=0, max=5))
        self.time_constant = Command(
            'OFLT?', 'OFLT',
            Enum(10e-6, 30e-6, 100e-6, 300e-6, 1e-3, 3e-3, 10e-3, 30e-3,
                 100e-3, 300e-3, 1., 3., 10, 30, 100, 300, 1e3, 3e3, 10e3,
                 30e3))
        self.filter_slope = Command('OFSL?', 'OFSL', Enum(6, 12, 18, 24))
        self.syncronous_filtering = Command('SYNC?', 'SYNC', Boolean)
        # Output and Offset Commands
        self.ch1_display = Command(
            'FOUT? 1', 'FOUT 1,',
            Enum('x', 'r', 'theta', 'trace1', 'trace2', 'trace3', 'trace4'))
        self.ch2_display = Command(
            'FOUT? 2', 'FOUT 2,',
            Enum('y', 'r', 'theta', 'trace1', 'trace2', 'trace3', 'trace4'))
        self.x_offset_and_expand = Command(
            'OEXP? 1', 'OEXP 1,',
            (Float(min=-105., max=105.), Integer(min=1, max=256)))
        self.y_offset_and_expand = Command(
            'OEXP? 2', 'OEXP 2,',
            (Float(min=-105., max=105.), Integer(min=1, max=256)))
        self.r_offset_and_expand = Command(
            'OEXP? 3', 'OEXP 3,',
            (Float(min=-105., max=105.), Integer(min=1, max=256)))
        # Trace and Scan Commands
        self.traces = [
            Trace(transport, self._protocol, i) for i in range(1, 5)
        ]
        self.scan_sample_rate = Command(
            'SRAT?', 'SRAT',
            Enum(62.5e-3, 125e-3, 250e-3, 500e-3, 1, 2, 4, 8, 16, 32, 64, 128,
                 256, 512, 'trigger'))
        self.scan_length = Command('SLEN?', 'SLEN', Float(min=1))
        self.scan_mode = Command('SEND?', 'SEND', Enum('shot', 'loop'))
        # Display and Scale Commands
        # XXX Not shure about the difference between ADSP and ATRC command.
        self.active_display = Command('ADSP?', 'ADSP',
                                      Enum('full', 'top', 'bottom'))
        self.selected_display = Command('ATRC?', 'ATRC', Enum('top', 'bottom'))
        self.screen_format = Command('SMOD?', 'SMOD', Enum('single', 'dual'))
        self.monitor_display = Command('MNTR?', 'MNTR',
                                       Enum('settings', 'input/output'))
        self.full_display = Display(transport, self._protocol, 0)
        self.top_display = Display(transport, self._protocol, 1)
        self.bottom_display = Display(transport, self._protocol, 2)
        # Cursor Commands
        self.cursor = Cursor(transport, self._protocol)
        # Mark Commands
        self.marks = MarkList(transport, self._protocol)

        # Aux Input and Output Comnmands
        def aux_in(i):
            """Helper function to create an aux input command."""
            return Command(query=('OAUX? {0}'.format(i), Float))

        self.aux_input = CommandSequence(self._transport, self._protocol,
                                         (aux_in(i) for i in range(1, 5)))
        self.aux_output = tuple(
            Output(transport, self._protocol, i) for i in range(1, 5))
        self.start_on_trigger = Command('TSTR?', 'TSTR', Boolean)
        # Math Commands
        self.math_argument_type = Command('CAGT?', 'CAGT',
                                          Enum('trace', 'constant'))
        self.math_operation = Command(
            'COPR?', 'COPR',
            Enum('+', '-', '*', '/', 'sin', 'cos', 'tan', 'sqrt', '^2', 'log',
                 '10^x'))
        self.math_constant = Command('CARG?', 'CARG', Float)
        self.math_trace_argument = Command('CTRC?', 'CTRC',
                                           Integer(min=1, max=4))
        self.fit_function = Command('FTYP?', 'FTYP',
                                    Enum('line', 'exp', 'gauss'))
        self.fit_params = FitParameters(transport, self._protocol)
        self.statistics = Statistics(transport, self._protocol)
        # Store and Recall File Commands
        # TODO The filename syntax is not validated yet.
        self.filename = Command('FNAM?', 'FNAM', String(max=12))

        # Setup Commands
        self.interface = Command('OUTX?', 'OUTX', Enum('rs232', 'gpib'))
        self.overwrite_remote = Command('OVRM?', 'OVRM', Boolean)
        self.key_click = Command('KCLK?', 'KCLK', Boolean)
        self.alarm = Command('ALRM?', 'ALRM', Boolean)
        # TODO wrapp datetime commands with higher level interface.
        self.hours = Command('THRS?', 'THRS', Integer(min=0, max=23))
        self.minutes = Command('TMIN?', 'TMIN', Integer(min=0, max=59))
        self.seconds = Command('TSEC?', 'TSEC', Integer(min=0, max=59))
        self.month = Command('DMTH?', 'DMTH', Integer(min=1, max=12))
        self.day = Command('DDAY?', 'DDAY', Integer(min=1, max=31))
        self.year = Command('DYRS?', 'DYRS', Integer(min=0, max=99))
        self.plotter_mode = Command('PLTM?', 'PLTM', Enum('rs232', 'gpib'))
        self.plotter_baud_rate = Command('PLTB?', 'PLTB',
                                         Enum(300, 1200, 2400, 4800, 9600))
        self.plotter_address = Command('PLTA?', 'PLTA', Integer(min=0, max=30))
        self.plotting_speed = Command('PLTS?', 'PLTS', Enum('fast', 'slow'))
        self.trace_pen_number = Command('PNTR?', 'PNTR', Integer(min=1, max=6))
        self.grid_pen_number = Command('PNGD?', 'PNGD', Integer(min=1, max=6))
        self.alphanumeric_pen_number = Command('PNAL?', 'PNAL',
                                               Integer(min=1, max=6))
        self.cursor_pen_number = Command('PNCR?', 'PNCR', Integer(min=1,
                                                                  max=6))
        self.printer = Command('PRNT?', 'PRNT', Enum('epson', 'hp', 'file'))
        # Front Panel Controls and Auto Functions.
        # TODO ATRC.

        # Data Transfer Commands
        self.x = Command(('OUTP? 1', Float))
        self.y = Command(('OUTP? 2', Float))
        self.r = Command(('OUTP? 3', Float))
        self.theta = Command(('OUTP? 4', Float))
        self.fast_mode = Command('FAST?', 'FAST', Enum('off', 'dos',
                                                       'windows'))
        # Interface Commands
        self.access = Command('LOCL?', 'LOCL',
                              Enum('local', 'remote', 'lockout'))
示例#19
0
 def setUp(self):
     self._to_low = -11.
     self._to_big = 11.
     self._values = (1.,)
     self._serialized = map(str, self._values)
     self._type = Float(min=-10., max=10.)
示例#20
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)