def __init__(self, transport): protocol = slave.protocol.IEC60488(msg_data_sep=' ', msg_term='\r', resp_data_sep=' ', resp_term='\r') super(SR5113, self).__init__(transport, protocol) self.backlight = Command('BL', 'BL', Boolean) self.contrast = Command('LCD', 'LCD', Integer(min=0, max=15)) self.identification = Command(query=('ID', String)) self.version = Command(query=('VER', String)) self.remote = Command('REMOTE', 'REMOTE', Enum(True, False)) self.status = Command(query=('ST', Register(SR5113.STATUS))) # TODO check if lines are readable. Check 40 character limit. self.line = CommandSequence(self._transport, self._protocol, [ Command('LINE 1', 'LINE 1\r', String(max=40)), Command('LINE 2', 'LINE 2\r', String(max=40)), ]) self.coarse_gain = Command('CG', 'CG', Enum(*SR5113.COARSE_GAIN)) self.fine_gain = Command('FG', 'FG', Enum(*SR5113.FINE_GAIN)) self.gain_vernier = Command('GV', 'GV', Integer(min=0, max=15)) self.input_coupling = Command('CP', 'CP', Enum('ac', 'dc')) self.dynamic_reserve = Command('DR', 'DR', Enum('low noise', 'high reserve')) self.input_mode = Command('IN', 'IN', Enum('A', 'A-B')) self.time_constant = Command('TC', 'TC', Enum('1 s', '10 s')) self.filter_mode = Command('FLT', 'FLT', Enum(*SR5113.FILTER_MODE)) self.filter_frequency = Command( 'FF', 'FF', [Enum('low', 'high'), Enum(*SR5113.FREQUENCIES)])
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)
def __init__(self, transport, protocol): super(Cursor, self).__init__(transport, protocol) self.seek_mode = Command('CSEK?', 'CSEK', Enum('max', 'min', 'mean')) self.width = Command('CWID?', 'CWID', Enum('off', 'narrow', 'wide', 'spot')) self.vertical_division = Command('CDIV?', 'CDIV', Enum(8, 10, None)) self.control_mode = Command('CLNK?', 'CLNK', Enum('linked', 'separate')) self.readout_mode = Command('CDSP?', 'CDSP', Enum('delay', 'bin', 'fsweep', 'time')) self.bin = Command('CBIN?', 'CBIN', Integer)
def __init__(self, transport, protocol): super(Heater, self).__init__(transport, protocol) self.manual_output = Command('MOUT?', 'MOUT', Float) self.output = Command(('HTR?', Float)) self.range = Command( 'HTRRNG?', 'HTRRNG', Enum('off', '31.6 uA', '100 uA', '316 uA', '1 mA', '3.16 mA', '10 mA', '31.6 mA', '100 mA') ) self.status = Command( ('HTRST?', Enum('no error', 'heater open error')) )
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))
def __init__(self, transport, protocol, idx): super(Relay, self).__init__(transport, protocol) idx = int(idx) self.config = Command( 'RELAY? {0}'.format(idx), 'RELAY {0},'.format(idx), [ Enum('off', 'on', 'alarm', 'zone'), Enum('scan', *range(1, 17)), Enum('low', 'high', 'both') ] ) self.status = Command(('RELAYST? {0}'.format(idx), Boolean))
def __init__(self, connection, channel): super(Output, self).__init__(connection) if not channel in (1, 2): raise ValueError('Invalid Channel number. Valid are either 1 or 2') self.channel = channel self.analog = Command('ANALOG? {0}'.format(channel), 'ANALOG {0},'.format(channel), [Boolean, Enum('off', 'input', 'manual', 'loop'), #INPUT, Enum('kelvin', 'celsius', 'sensor', 'linear', start=1), Float, Float, Float]) self.value = Command(('AOUT? {0}'.format(channel), Float))
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)])
def __init__(self, transport, protocol, channel): super(Output, self).__init__(transport, protocol) if not channel in (1, 2): raise ValueError('Invalid Channel number. Valid are either 1 or 2') self.channel = channel mode = 'off', 'channel', 'manual', 'zone' mode = mode + ('still',) if channel == 2 else mode self.analog = Command('ANALOG? {0}'.format(channel), 'ANALOG {0},'.format(channel), [Enum('unipolar', 'bipolar'), Enum(*mode), Enum('kelvin', 'ohm', 'linear', start=1), Float, Float, Float]) self.value = Command(('AOUT? {0}'.format(channel), Float))
def auto_offset(self, quantity): """Automatically offsets the given quantity. :param quantity: The quantity to offset, either 'x', 'y' or 'r' """ self._write(('AOFF', Enum('x', 'y', 'r', start=1), quantity))
def snap(self, *args): """Records multiple values at once. It takes two to six arguments specifying which values should be recorded together. Valid arguments are 'x', 'y', 'r', 'theta', 'aux1', 'aux2', 'aux3', 'aux4', 'frequency', 'trace1', 'trace2', 'trace3' and 'trace4'. snap is faster since it avoids communication overhead. 'x' and 'y' are recorded together, as well as 'r' and 'theta'. Between these pairs, there is a delay of approximately 10 us. 'aux1', 'aux2', 'aux3' and 'aux4' have am uncertainty of up to 32 us. It takes at least 40 ms or a period to calculate the frequency. E.g.:: lockin.snap('x', 'theta', 'trace3') """ length = len(args) if not 2 <= length <= 6: msg = 'snap takes 2 to 6 arguments, {0} given.'.format(length) raise TypeError(msg) # The program data type. param = Enum('x', 'y', 'r', 'theta', 'aux1', 'aux2', 'aux3', 'aux4', 'frequency', 'trace1', 'trace2', 'trace3', 'trace4') # construct command, cmd = 'SNAP?', (Float, ) * length, (param, ) * length return self._ask(cmd, *args)
def auto_offset(self, signal): """Executes the auto offset command for the selected signal. :param i: Can either be 'X', 'Y' or 'R'. """ self._write(('AOFF', Enum('X', 'Y', 'R', start=1)), signal)
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')
def take_data_triggered(self, mode): """Starts triggered data acquisition. :param mode: If mode is 'curve', a trigger signal starts the acquisition of a complete curve or set of curves. If its 'point', only a single data point is stored. """ self._write(('TDT', Enum('curve', 'point')), mode)
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_)
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)))
def __init__(self, transport, protocol, location): super(Display, self).__init__(transport, protocol) location = int(location) self.config = Command( 'DISPLOC? {0}'.format(location), 'DISPLOC {0},'.format(location), [ Integer(min=0, max=16), Enum('kelvin', 'ohm', 'linear', 'min', 'max', start=1), Integer(min=4, max=6) ] )
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)))
def __init__(self, transport, protocol, idx): super(Trace, self).__init__(transport, protocol) self.idx = idx = int(idx) self.value = Command(('OUTR? {0}'.format(idx), Float)) quantities = Enum('1', 'x', 'y', 'r', 'theta', 'xn', 'yn', 'rn', 'Al1', 'Al2', 'Al3', 'Al4', 'F', 'x**2', 'y**2', 'r**2', 'theta**2', 'xn**2', 'yn**2', 'rn**2', 'Al1**2', 'Al2**2', 'Al3**2', 'Al4**2', 'F**2') self.definition = Command( 'TRCD? {0}'.format(idx), 'TRCD {0},'.format(idx), (quantities, quantities, quantities, Boolean))
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]))
def levelmeter(self, rate): """Changes the measuring rate of the levelmeter. :param rate: Valid are 'on', 'off', 'continuous' and 'hourly'. 'on' turns on the level meter, takes a reading and turns itself off. In 'continuous' mode, the readings are constantly updated. If no reading is requested within 60 seconds, the levelmeter will be turned off. 'off' turns off hourly readings. .. note:: It takes approximately 10 seconds until a measured level is available. """ # TODO: Check what 'off' actually does. Manual says it just deactivates # hourly readings and opcode 0 should be used to deactivate. self._write(('LEVELON', Enum('on', 'continuous', 'hourly', 'off')), rate)
def smooth(self, window): """Smooths the active display's data trace within the time window of the active chart display. :param window: The smoothing window in points. Valid are 5, 11, 17, 21 and 25. .. note:: Smoothing takes some time. Check the status byte to see when the operation is done. A running scan will be paused until the smoothing is complete. .. warning:: The SR850 will generate an error if the active display trace is not stored when the smooth command is executed. """ self._write(('SMTH', Enum(5, 11, 17, 21, 25)), window)
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))
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'))
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)) )
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)
def __init__(self, transport, protocol, idx): super(InputChannel, self).__init__(transport, protocol) self.index = idx = int(idx) self.alarm = Command( 'ALARM ? {0}'.format(idx), 'ALARM {0},'.format(idx), [Boolean, Enum('kelvin', 'ohm', 'linear'), Float, Float, Float, Boolean] ) self.alarm_status = Command( ('ALARMST? {0}'.format(idx), [Boolean, Boolean]) ) self.autoscan = Command( 'SCAN? {0}'.format(idx), 'SCAN {0},'.format(idx), Boolean ) self.config = Command( 'INSET? {0}'.format(idx), 'INSET {0},'.format(idx), [ Boolean, Integer(min=1, max=200), Integer(min=3, max=200), Enum('no curve', *range(20)), Enum('negative', 'positive', start=1) ] ) self.excitation_power = Command(('RDGPWR? {0}'.format(idx), Float)) self.filter = Command( 'FILTER? {0}'.format(idx), 'FILTER {0},'.format(idx), [Boolean, Integer(min=1, max=200), Integer(min=1, max=80)] ) self.kelvin = Command(('RDGK? {0}'.format(idx), Float)) self.linear = Command(('LDAT? {0}'.format(idx), Float)) self.linear_equation = Command( 'LINEAR? {0}'.format(idx), 'LINEAR {0},'.format(idx), [ Enum('slope-intercept', 'point-slope'), Float, # m value Enum('kelvin', 'celsius', 'sensor units', start=1), Enum('value', '+sp1', '-sp1', '+sp2', '-sp2', start=1), Float, # b value ] ) self.minmax = Command(('MDAT? {0}'.format(idx), [Float, Float])) self.minmax_parameter = Command( 'MNMX? {0}'.format(idx), 'MNMX {0},'.format(idx), Enum('kelvin', 'ohm', 'linear'), ) self.reading_status = Command(( 'RDGST? {0}'.format(idx), Register({ 0: 'cs overload', # current source overload 1: 'vcm overload', # voltage common mode overload 2: 'vmix overload', # differential overload 3: 'vdif overload', # mixer overload 4: 'range over', 5: 'range under', 6: 'temp over', 7: 'temp under', }) )) self.resistance = Command(('RDGR? {}'.format(idx), Float)) self.resistance_range = Command( 'RDGRNG? {0}'.format(idx), 'RDGRNG {0},'.format(idx), [ Enum('voltage', 'current'), Integer(min=1, max=22), Integer(min=1, max=22), Boolean, Boolean ] )
def __init__(self, connection): super(Heater, self).__init__(connection) self.output = Command(('HTR?', Float)) self.range = Command('RANGE?', 'RANGE', Integer(min=0, max=5)) self.status = Command(('HTRST?', Enum(*self.ERROR_STATUS)))
def __init__(self, connection, name): super(Input, self).__init__(connection) self.name = name = str(name) # The reading status register, used in linear_status, reading_status # and minmax_status. rds = Register(dict((v, k) for k, v in self.READING_STATUS.items())) self.alarm = Command('ALARM? {0}'.format(name), 'ALARM {0},'.format(name), [Boolean, Enum('kelvin', 'celsius', 'sensor', 'linear'), Float, Float, Boolean, Boolean]) self.alarm_status = Command(('ALARMST?', [Boolean, Boolean])) self.celsius = Command(('CRDG? {0}'.format(name), Float)) self.filter = Command('FILTER? {0}'.format(name), 'FILTER {0},'.format(name), [Boolean, Integer(min=0), Integer(min=0, max=100)]) self.set = Command('INSET? {0}'.format(name), 'INSET {0},'.format(name), [Boolean, Enum('off', 'on', 'pause')]) self.curve = Command('INCRV? {0}'.format(name), 'INCRV {0},'.format(name), Integer(min=0, max=60)) self.input_type = Command('INTYPE? {0}'.format(name), 'INTYPE {0},'.format(name), [Enum('special', 'Si', 'GaAlAs', 'Pt100 250 Ohm', 'Pt100 500 Ohm', 'Pt1000', 'RhFe', 'Carbon-Glass', 'Cernox', 'RuOx', 'Ge', 'Capacitor', 'Thermocouple'), Enum('special', 'volt', 'ohm'), Enum('special', '-', '+'), # XXX Volt and Ampere? Enum('off', '30nA', '100nA', '300nA', '1uA', '3uA', '10uA', '30uA', '100uA', '300uA', '1mA', '10mV', '1mV'), Enum('1mV', '2.5mV', '5mV', '10mV', '25mV', '50mV', '100mV', '250mV', '500mV', '1V', '2.5V', '5V', '7.5V', start=1)]) self.kelvin = Command(('KRDG? {0}'.format(name), Float)) self.sensor_units = Command(('SRDG? {0}'.format(name), Float)) self.linear = Command(('LDAT? {0}'.format(name), Float)) leq = [ Enum('slope-intercept', 'point-slope'), Float, # m value Enum('kelvin', 'celsius', 'sensor units', start=1), Enum('value', '+sp1', '-sp1', '+sp2', '-sp2', start=1), Float, # b value ] self.linear_equation = Command('LINEAR? {0}'.format(name), 'LINEAR {0},'.format(name), leq) self.linear_status = Command(('LDATST? {0}'.format(name), rds)) self.reading_status = Command(('RDGST? {0}'.format(name), rds)) self.minmax = Command(('MDAT? {0}'.format(name), [Float, Float])) self.minmax_parameter = Command('MNMX? {0}'.format(name), 'MNMX {0},'.format(name), [Enum('on', 'pause'), Enum('kelvin', 'celsius', 'sensor units', 'linear')]) self.minmax_status = Command(('MDATST? {0}'.format(name), rds, rds))
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))