コード例 #1
0
class GenericInstrument(FakeInstrument):
    #  Use truncated_range as this easily lets us test for the range boundaries
    fake_ctrl = Instrument.control(
        "",
        "%d",
        "docs",
        validator=truncated_range,
        values=(1, 10),
        dynamic=True,
    )
    fake_setting = Instrument.setting(
        "%d",
        "docs",
        validator=truncated_range,
        values=(1, 10),
        dynamic=True,
    )
    fake_measurement = Instrument.measurement(
        "",
        "docs",
        values={
            'X': 1,
            'Y': 2,
            'Z': 3
        },
        map_values=True,
        dynamic=True,
    )
コード例 #2
0
ファイル: agilent33521A.py プロジェクト: ralfcb/pymeasure
class Agilent33521A(Agilent33500):
    """Represents the Agilent 33521A Function/Arbitrary Waveform Generator.
    This documentation page shows only methods different from the parent class :doc:`Agilent33500 <agilent33500>`.

    """
    def __init__(self, adapter, **kwargs):
        super(Agilent33521A, self).__init__(adapter, **kwargs)

    frequency = Instrument.control(
        "FREQ?",
        "FREQ %f",
        """ A floating point property that controls the frequency of the output
        waveform in Hz, from 1 uHz to 30 MHz, depending on the specified function.
        Can be set. """,
        validator=strict_range,
        values=[1e-6, 30e+6],
    )

    arb_srate = Instrument.control(
        "FUNC:ARB:SRAT?",
        "FUNC:ARB:SRAT %f",
        """ An floating point property that sets the sample rate of the currently selected 
        arbitrary signal. Valid values are 1 µSa/s to 250 MSa/s. This can be set. """,
        validator=strict_range,
        values=[1e-6, 250e6],
    )
コード例 #3
0
ファイル: anritsuMG3692C.py プロジェクト: bklebel/pymeasure
class AnritsuMG3692C(Instrument):
    """ Represents the Anritsu MG3692C Signal Generator
    """
    power = Instrument.control(
        ":POWER?;", ":POWER %g dBm;",
        """ A floating point property that represents the output power
        in dBm. This property can be set. """
    )
    frequency = Instrument.control(
        ":FREQUENCY?;", ":FREQUENCY %e Hz;",
        """ A floating point property that represents the output frequency
        in Hz. This property can be set. """
    )

    def __init__(self, resourceName, **kwargs):
        super().__init__(
            resourceName,
            "Anritsu MG3692C Signal Generator",
            **kwargs
        )

    @property
    def output(self):
        """ A boolean property that represents the signal output state.
        This property can be set to control the output.
        """
        return int(self.ask(":OUTPUT?")) == 1

    @output.setter
    def output(self, value):
        if value:
            self.write(":OUTPUT ON;")
        else:
            self.write(":OUTPUT OFF;")

    def enable(self):
        """ Enables the signal output.
        """
        self.output = True

    def disable(self):
        """ Disables the signal output.
        """
        self.output = False

    def shutdown(self):
        """ Shuts down the instrument, putting it in a safe state.
        """
        # TODO: Implement modulation
        self.modulation = False
        self.disable()
コード例 #4
0
ファイル: apsin12G.py プロジェクト: moritzj29/pymeasure
class APSIN12G(Instrument):
    """ Represents the Anapico APSIN12G Signal Generator with option 9K,
    HP and GPIB. """
    FREQ_LIMIT = [9e3, 12e9]
    POW_LIMIT = [-30, 27]

    power = Instrument.control(
        "SOUR:POW:LEV:IMM:AMPL?;", "SOUR:POW:LEV:IMM:AMPL %gdBm;",
        """ A floating point property that represents the output power
        in dBm. This property can be set. """,
        validator=strict_range,
        values=POW_LIMIT
    )
    frequency = Instrument.control(
        "SOUR:FREQ:CW?;", "SOUR:FREQ:CW %eHz;",
        """ A floating point property that represents the output frequency
        in Hz. This property can be set. """,
        validator=strict_range,
        values=FREQ_LIMIT
    )
    blanking = Instrument.control(
        ":OUTP:BLAN:STAT?", ":OUTP:BLAN:STAT %s",
        """ A string property that represents the blanking of output power
        when frequency is changed. ON makes the output to be blanked (off) while
        changing frequency. This property can be set. """,
        validator=strict_discrete_set,
        values=['ON', 'OFF']
    )
    reference_output = Instrument.control(
        "SOUR:ROSC:OUTP:STAT?", "SOUR:ROSC:OUTP:STAT %s",
        """ A string property that represents the 10MHz reference output from
        the synth. This property can be set. """,
        validator=strict_discrete_set,
        values=['ON', 'OFF']
    )

    def __init__(self, resourceName, **kwargs):
        super(APSIN12G, self).__init__(
            resourceName,
            "Anapico APSIN12G Signal Generator",
            **kwargs
        )

    def enable_rf(self):
        """ Enables the RF output. """
        self.write("OUTP:STAT 1")

    def disable_rf(self):
        """ Disables the RF output. """
        self.write("OUTP:STAT 0")
コード例 #5
0
ファイル: fluke7341.py プロジェクト: moritzj29/pymeasure
class Fluke7341(Instrument):
    """ Represents the compact constant temperature bath from Fluke
    """

    set_point = Instrument.control(
        "s",
        "s=%g",
        """ A `float` property to set the bath temperature set-point.
                                   Valid values are  in the range -40 to 150 °C.
                                   The unit is as defined in property :attr:`~.unit`. This property
                                   can be read
                                   """,
        validator=strict_range,
        values=(-40, 150),
    )

    unit = Instrument.control(
        "u",
        "u=%s",
        """ A string property that controls the temperature
                              unit. Possible values are `c` for Celsius and `f` for Fahrenheit`.""",
        validator=strict_discrete_set,
        values=('c', 'f'),
    )

    temperature = Instrument.measurement(
        "t",
        """ Read the current bath temperature.
                                         The unit is as defined in property :attr:`unit`.""",
    )

    id = Instrument.measurement(
        "*ver",
        """ Read the instrument model """,
        preprocess_reply=lambda x: x,
        get_process=lambda x: "Fluke,{},NA,{}".format(x[0][4:], x[1]))

    def __init__(self, resource_name, **kwargs):
        super().__init__(resource_name,
                         "Fluke 7341",
                         timeout=2000,
                         write_termination='\r\n',
                         preprocess_reply=lambda x: x.split()[1],
                         includeSCPI=False,
                         **kwargs)

        if isinstance(self.adapter, VISAAdapter):
            self.adapter.connection.baud_rate = 2400
コード例 #6
0
 class Fake(FakeInstrument):
     x = Instrument.control("",
                            "%d",
                            "",
                            validator=strict_discrete_set,
                            values=range(10),
                            dynamic=dynamic)
コード例 #7
0
 class Fake(FakeInstrument):
     x = Instrument.control(
         "",
         "%d,%d",
         "",
         dynamic=dynamic,
     )
コード例 #8
0
 class Fake(FakeInstrument):
     x = Instrument.setting(
         "OUT %d",
         "",
         set_process=lambda v: int(bool(v)),
         dynamic=dynamic,
     )
コード例 #9
0
ファイル: test_visa.py プロジェクト: xieyong8410/pymeasure
def test_correct_visa_kwarg():
    """Confirm that the query_delay kwargs gets passed through to the VISA connection."""
    instr = Instrument(adapter='ASRL1::INSTR',
                       name='delayed',
                       query_delay=0.5,
                       visa_library='@sim')
    assert instr.adapter.connection.query_delay == approx(0.5)
コード例 #10
0
ファイル: agilent4156.py プロジェクト: moritzj29/pymeasure
class VAR1(VARX):
    """ Class to handle all the specific definitions needed for VAR1.
    Most common methods are inherited from base class.
    """

    def __init__(self, resourceName, **kwargs):
        super().__init__(
            resourceName,
            "VAR1",
            **kwargs
        )

    spacing = Instrument.control(
        ":PAGE:MEAS:VAR1:SPAC?",
        ":PAGE:MEAS:VAR1:SPAC %s",
        """
        Selects the sweep type of VAR1.

        - Values: :code:`LINEAR`, :code:`LOG10`, :code:`LOG25`, :code:`LOG50`.
        """,
        validator=strict_discrete_set,
        values={'LINEAR': 'LIN', 'LOG10': 'L10',
                'LOG25': 'L25', 'LOG50': 'L50'},
        map_values=True,
        check_set_errors=True,
        check_get_errors=True
    )
コード例 #11
0
ファイル: agilent4156.py プロジェクト: moritzj29/pymeasure
class VAR2(VARX):
    """ Class to handle all the specific definitions needed for VAR2.
    Common methods are imported from base class.
    """

    def __init__(self, resourceName, **kwargs):
        super().__init__(
            resourceName,
            "VAR2",
            **kwargs
        )

    points = Instrument.control(
        ":PAGE:MEAS:VAR2:POINTS?",
        ":PAGE:MEAS:VAR2:POINTS %g",
        """
        Sets the number of sweep steps of VAR2.
        You use this command only if there is an SMU or VSU
        whose function (FCTN) is VAR2.

        .. code-block:: python

            instr.var2.points = 10
        """,
        validator=strict_discrete_set,
        values=range(1, 128),
        check_set_errors=True,
        check_get_errors=True
    )
コード例 #12
0
 def __init__(self, instrument):
     super().__init__(instrument, command_prefix="POWer")
     self.unit = Instrument.control(
         self._cmd("UNIT?"), self._cmd("UNIT %s"),
         "Power Unit setting, W or dBm",
         validator=lambda v: strict_discrete_set(v, ("W", "dBm", "dbm"))
         )
コード例 #13
0
class BKPrecision9130B(Instrument):
    """ Represents the BK Precision 9130B DC Power Supply interface for interacting with
    the instrument. """

    current = Instrument.control(
        'MEASure:SCALar:CURRent:DC?',
        'SOURce:CURRent:LEVel:IMMediate:AMPLitude %g',
        """Floating point property used to control current of the selected channel.""",
        validator=truncated_range,
        values=[0, 3]
    )

    source_enabled = Instrument.control(
        'SOURce:CHANnel:OUTPut:STATe?',
        'SOURce:CHANnel:OUTPut:STATe %d',
        """A boolean property that controls whether the source is enabled, takes values
        True or False. """,
        validator=strict_discrete_set,
        values={True: 1, False: 0},
        map_values=True
    )

    channel = Instrument.control(
        'INSTrument:SELect?',
        'INSTrument:SELect CH%d',
        f"""An integer property used to control which channel is selected. Can only take
        values {CHANNEL_NUMS}.""",
        validator=strict_discrete_set,
        values=CHANNEL_NUMS,
        get_process=lambda x: int(x[2])
    )

    def __init__(self, adapter, **kwargs):
        super(BKPrecision9130B, self).__init__(
            adapter, "BK Precision 9130B Source", **kwargs
        )

    @property
    def voltage(self):
        """Floating point property used to control voltage of the selected channel."""
        return float(self.ask("MEASure:SCALar:VOLTage:DC?"))

    @voltage.setter
    def voltage(self, level):
        voltage_range = [0, 5] if self.channel == 3 else [0, 30]
        new_level = truncated_range(level, voltage_range)
        self.write("SOURce:VOLTage:LEVel:IMMediate:AMPLitude %g" % new_level)
コード例 #14
0
 class Fake(FakeInstrument):
     x = Instrument.control("",
                            "%d",
                            "",
                            validator=strict_discrete_set,
                            values=[4, 5, 6, 7],
                            map_values=True,
                            dynamic=dynamic)
コード例 #15
0
class Keithley6487(Instrument):
    """
    Keithley 6487 Picoammeter
    """
    ##############
    # Properties #
    ##############

    # sweep_state = Instrument.measurement(
    #     ":SOUR:VOLT:SWE:STAT?",
    #     """ Query if sweep running: 1 = sweep in progress. """
    # )
    buffer_size = Instrument.measurement(
        ":TRAC:POIN:ACT?",
        """ Returns number of readings actually stored in buffer. """)

    ###########
    # Methods #
    ###########

    def __init__(self, adapter, **kwargs):
        super(Keithley6487, self).__init__(adapter, "Keithley 6487", **kwargs)

    def reset(self):
        self.write("*RST")

    def configure_sweep(self, start, stop, step, delay, nplc, polarity):
        self.write('SYST:ZCH OFF')
        log.info("Zero-checking turned off")
        self.write('AVER:COUN {:d}'.format(3))
        self.write('AVER:TCON {:s}'.format('rep'))
        self.write('AVER ON')
        self.write('SENS:CURR:NPLC {:0.2f}'.format(nplc))
        self.write('SOUR:VOLT:SWE:STAR {:0.1f}'.format(start))
        log.info("Sweep start value set")
        if polarity == 'Anode':
            self.write('SOUR:VOLT:SWE:STOP {:0.1f}'.format(-stop))
        if polarity == 'Cathode':
            self.write('SOUR:VOLT:SWE:STOP {:0.1f}'.format(stop))
        self.write('SOUR:VOLT:SWE:STEP {:0.2f}'.format(step))
        self.write('SOUR:VOLT:SWE:DEL {:0.3f}'.format(delay / 1e3))
        self.write('FORM:ELEM ALL')  # Include all elements in the trace data
        self.write('FORM:SREG ASC'
                   )  # Set output format of status register to ascii (decimal)
        self.write('ARM:COUN {:d}'.format(int(abs((stop - start) / step) + 1)))

    def start_sweep(self):
        self.write("SOUR:VOLT:SWE:INIT")
        self.write("INIT")

    def sweep_state(self):
        self.write("*CLS")
        try:
            resp = int(self.ask("*STB?"))
            resp = resp & 0x80
        except:
            resp = 1
        return resp
コード例 #16
0
        def __init__(self, parent_instrument, command_prefix="POWer"):
            super().__init__(parent_instrument)
            self.cmd_prefix = command_prefix

            # setting properties requiring methods of class
            # properties need to be set as attributes of class not of instance
            setattr(self.__class__, 'auto_range', Instrument.control(
                self._cmd("RANGe:Auto?"), self._cmd("RANGe:Auto %d"),
                "Auto Range Setting",
                set_process=lambda v: bool(v), get_process=lambda v: bool(v)
                ))
            setattr(self.__class__, 'range_min', Instrument.measurement(
                self._cmd("RANGe? MINimum"), "Minimum settable range"))
            setattr(self.__class__, 'range_max', Instrument.measurement(
                self._cmd("RANGe? MAXimum"), "Maximum settable range"))
            setattr(self.__class__, 'reference_min', Instrument.measurement(
                self._cmd("REFerence? MINimum"),
                "Minimum settable reference value"))
            setattr(self.__class__, 'reference_state', Instrument.control(
                self._cmd("REFerence:STATe?"), self._cmd("REFerence:STATe %d"),
                "Switch to delta mode",
                set_process=lambda v: bool(v)))
            setattr(self.__class__, 'reference_max', Instrument.measurement(
                self._cmd("REFerence? MAXimum"),
                "Maximum settable reference value"))
            setattr(self.__class__, 'reference_default',
                    Instrument.measurement(self._cmd("REFerence? DEFault"),
                                           "Default reference value"))
コード例 #17
0
 class Fake(FakeInstrument):
     x = Instrument.control(
         "",
         "JUNK%d",
         "",
         preprocess_reply=lambda v: v.replace('JUNK', ''),
         dynamic=dynamic,
         cast=int,
     )
コード例 #18
0
ファイル: hp8116a.py プロジェクト: bklebel/pymeasure
 def _boolean_control(identifier, state_index, docs, inverted=False, **kwargs):
     return Instrument.control(
         'CST', identifier + '%d', docs,
         validator=strict_discrete_set,
         values=[True, False],
         get_process=lambda x: inverted ^ bool(int(x[state_index][1])),
         set_process=lambda x: int(inverted ^ x),
         **kwargs
     )
コード例 #19
0
class AH2700A(AH2500A):
    """ Andeen Hagerling 2700A Precision Capacitance Bridge implementation
    """
    def __init__(self,
                 adapter,
                 name="Andeen Hagerling 2700A Precision Capacitance Bridge",
                 timeout=5000,
                 **kwargs):
        super(AH2700A, self).__init__(adapter,
                                      name=name,
                                      timeout=timeout,
                                      **kwargs)

    id = Instrument.measurement("*IDN?",
                                """ Reads the instrument identification """)

    config = Instrument.measurement(
        "SHOW ALL",
        """ Read out configuration """,
    )

    frequency = Instrument.control(
        "SH FR",
        "FR %.1f",
        """test frequency used for the measurements. Allowed are values between
        50 and 20000 Hz. The device selects the closest possible frequency to
        the given value.""",
        validator=strict_range,
        values=[50, 20000],
        # typical reply: "FREQUENCY      1200.0 Hz"
        get_process=lambda v: float(AH2500A._renumeric.search(v).group(0)),
    )

    def reset(self):
        """ Resets the instrument. """
        self.write("*RST")

    def trigger(self):
        """
        Triggers a new measurement without blocking and waiting for the return
        value.
        """
        self.write("*TRG")
        self._triggered = True
コード例 #20
0
class E364A(Instrument):
    """
    Agilent E3648A Dual Output DC Power Supply
    """
    ##############
    # Properties #
    ##############
    voltage = Instrument.control(":VOLT?",
                                 ":VOLT %0.2f",
                                 """ Voltage output of the power supply """,
                                 validator=strict_range,
                                 values=[0, 20.0])
    current = Instrument.control(":CURR?",
                                 ":CURR %0.2f",
                                 """ Current output of the power supply """,
                                 validator=strict_range,
                                 values=[0, 5.0])
    output = Instrument.control(
        "INST:SEL?",
        "INST:SEL $s",
        """ Which power supply output is to be used (OUTP1 or OUTP2) """,
        validator=strict_discrete_set,
        values=["OUTP1", "OUTP2"])
    enabled = Instrument.control("OUTP?",
                                 "OUTP %s",
                                 """ Enable or disable power supply output """,
                                 validator=strict_discrete_set,
                                 values=["ON", "OFF"])

    ###########
    # Methods #
    ###########
    def __init__(self, adapter, **kwargs):
        super(E364A, self).__init__(adapter, "Agilent E3648", **kwargs)

    def reset(self):
        self.write("*RST")

    def apply(self, voltage, current):
        self.write("APPL {:0.2f}, {:0.2f}".format(voltage, current))

    def trigger(self):
        self.write("TRIG:SOUR IMM")
        self.write("INIT")
コード例 #21
0
 class Fake(FakeInstrument):
     x = Instrument.control(
         "",
         "JUNK%d",
         "",
         validator=strict_range,
         values=[0, 10],
         get_process=lambda v: int(v.replace('JUNK', '')),
         dynamic=dynamic,
     )
コード例 #22
0
 class Fake(FakeInstrument):
     x = Instrument.control(
         "",
         "%d",
         "",
         validator=strict_range,
         values=[5e-3, 120e-3],
         get_process=lambda v: v * 1e-3,
         set_process=lambda v: v * 1e3,
         dynamic=dynamic,
     )
コード例 #23
0
 class Fake(FakeInstrument):
     x = Instrument.measurement(
         "",
         "",
         values={
             'X': 1,
             'Y': 2,
             'Z': 3
         },
         map_values=True,
         dynamic=dynamic,
     )
コード例 #24
0
 class Fake(FakeInstrument):
     x = Instrument.control("",
                            "%d",
                            "",
                            validator=strict_discrete_set,
                            values={
                                5: 1,
                                10: 2,
                                20: 3
                            },
                            map_values=True,
                            dynamic=dynamic)
コード例 #25
0
ファイル: agilent34410A.py プロジェクト: moritzj29/pymeasure
class Agilent34410A(Instrument):
    """
    Represent the HP/Agilent/Keysight 34410A and related multimeters.

    Implemented measurements: voltage_dc, voltage_ac, current_dc, current_ac, resistance,
    resistance_4w
    """
    # only the most simple functions are implemented
    voltage_dc = Instrument.measurement("MEAS:VOLT:DC? DEF,DEF", "DC voltage, in Volts")

    voltage_ac = Instrument.measurement("MEAS:VOLT:AC? DEF,DEF", "AC voltage, in Volts")

    current_dc = Instrument.measurement("MEAS:CURR:DC? DEF,DEF", "DC current, in Amps")

    current_ac = Instrument.measurement("MEAS:CURR:AC? DEF,DEF", "AC current, in Amps")

    resistance = Instrument.measurement("MEAS:RES? DEF,DEF", "Resistance, in Ohms")

    resistance_4w = Instrument.measurement(
        "MEAS:FRES? DEF,DEF", "Four-wires (remote sensing) resistance, in Ohms")

    def __init__(self, adapter, **kwargs):
        super(Agilent34410A, self).__init__(
            adapter, "HP/Agilent/Keysight 34410A Multimeter", **kwargs
        )
コード例 #26
0
class HP34401A(Instrument):
    """ Represents the HP 34401A instrument.
    """

    voltage_dc = Instrument.measurement("MEAS:VOLT:DC? DEF,DEF",
                                        "DC voltage, in Volts")

    voltage_ac = Instrument.measurement("MEAS:VOLT:AC? DEF,DEF",
                                        "AC voltage, in Volts")

    current_dc = Instrument.measurement("MEAS:CURR:DC? DEF,DEF",
                                        "DC current, in Amps")

    current_ac = Instrument.measurement("MEAS:CURR:AC? DEF,DEF",
                                        "AC current, in Amps")

    resistance = Instrument.measurement("MEAS:RES? DEF,DEF",
                                        "Resistance, in Ohms")

    resistance_4w = Instrument.measurement(
        "MEAS:FRES? DEF,DEF",
        "Four-wires (remote sensing) resistance, in Ohms")

    def __init__(self, resourceName, **kwargs):
        super(HP34401A, self).__init__(resourceName, "HP 34401A", **kwargs)
コード例 #27
0
class SR510(Instrument):
    TIME_CONSTANTS = {1e-3: 1, 3e-3: 2, 10e-3: 3, 30e-3: 4, 100e-3: 5,
                      300e-3: 6, 1: 7, 3: 8, 10: 9, 30: 10, 100: 11, }

    SENSITIVITIES = {10e-9: 1, 20e-9: 2, 50e-9: 3, 100e-9: 4, 200e-9: 5, 500e-9: 6,
                     1e-6: 7, 2e-6: 8, 5e-6: 9, 10e-6: 10, 20e-6: 11, 50e-6: 12, 100e-6: 13,
                     200e-6: 14, 500e-6: 15, 1e-3: 16, 2e-3: 17, 5e-3: 18, 10e-3: 19, 20e-3: 20,
                     50e-3: 21, 100e-3: 22, 200e-3: 23, 500e-3: 24, }

    phase = Instrument.control("P", "P %g",
                               """A float property that represents the SR510 reference to input
                               phase offset in degrees. Queries return values between -180 and
                               180 degrees. This property can be set with a range of values
                               between -999 to 999 degrees. Set values are mapped internal in the
                               lockin to -180 and 180 degrees.""",
                               validator=truncated_range,
                               values=[-999, 999],
                               )

    time_constant = Instrument.control("T1", "T1,%d",
                                       """A float property that represents the SR510 PRE filter time constant.
                                          This property can be set.""",
                                       validator=truncated_discrete_set,
                                       values=TIME_CONSTANTS,
                                       map_values=True,
                                       )

    sensitivity = Instrument.control("G", "G%d",
                                     """A float property that represents the SR510 sensitivity value.
                                        This property can be set.""",
                                     validator=truncated_discrete_set,
                                     values=SENSITIVITIES,
                                     map_values=True,
                                     )

    frequency = Instrument.measurement("F",
                                       """A float property representing the SR510 input reference
                                       frequency""",
                                       )

    status = Instrument.measurement("Y",
                                    """A string property representing the bits set within the SR510
                                    status byte""",
                                    get_process=lambda s: bin(int(s))[2:],
                                    )

    output = Instrument.measurement("Q",
                                    """A float property that represents the SR510 output voltage in
                                    Volts.""",
                                    )

    def __init__(self, resourceName, **kwargs):
        kwargs.setdefault('write_termination', '\r')
        super(SR510, self).__init__(
            resourceName,
            "Stanford Research Systems SR510 Lock-in amplifier",
            includeSCPI=False,
            **kwargs,
        )
コード例 #28
0
class ANC300Controller(Instrument):
    """ Attocube ANC300 Piezo stage controller with several axes

    :param host: host address of the instrument
    :param axisnames: a list of axis names which will be used to create
                      properties with these names
    :param passwd: password for the attocube standard console
    :param query_delay: delay between sending and reading (default 0.05 sec)
    :param kwargs: Any valid key-word argument for TelnetAdapter
    """
    version = Instrument.measurement(
        "ver", """ Version number and instrument identification """)

    controllerBoardVersion = Instrument.measurement(
        "getcser", """ Serial number of the controller board """)

    def __init__(self, host, axisnames, passwd, query_delay=0.05, **kwargs):
        kwargs['query_delay'] = query_delay
        super().__init__(AttocubeConsoleAdapter(host, 7230, passwd, **kwargs),
                         "attocube ANC300 Piezo Controller",
                         includeSCPI=False,
                         **kwargs)
        self._axisnames = axisnames
        for i, axis in enumerate(axisnames):
            setattr(self, axis, Axis(self, i + 1))

    def ground_all(self):
        """ Grounds all axis of the controller. """
        for attr in self._axisnames:
            attribute = getattr(self, attr)
            if isinstance(attribute, Axis):
                attribute.mode = 'gnd'

    def stop_all(self):
        """ Stop all movements of the axis. """
        for attr in self._axisnames:
            attribute = getattr(self, attr)
            if isinstance(attribute, Axis):
                attribute.stop()
コード例 #29
0
class ThorlabsPro8000(Instrument):
    """Represents Thorlabs Pro 8000 modular laser driver"""
    SLOTS = range(1, 9)
    LDC_POLARITIES = ['AG', 'CG']
    STATUS = ['ON', 'OFF']

    def __init__(self, resourceName, **kwargs):
        super(ThorlabsPro8000, self).__init__(resourceName,
                                              "Thorlabs Pro 8000", **kwargs)
        self.write(':SYST:ANSW VALUE')

    # Code for general purpose commands (mother board related)
    slot = Instrument.control(":SLOT?",
                              ":SLOT %d",
                              "Slot selection. Allowed values are: {}"
                              "".format(SLOTS),
                              validator=strict_discrete_set,
                              values=SLOTS,
                              map_values=False)

    # Code for LDC-xxxx daughter boards (laser driver)
    LDCCurrent = Instrument.control(":ILD:SET?", ":ILD:SET %g",
                                    """Laser current.""")
    LDCCurrentLimit = Instrument.control(
        ":LIMC:SET?", ":LIMC:SET %g",
        """Set Software current Limit (value must be lower than hardware current limit)."""
    )
    LDCPolarity = Instrument.control(
        ":LIMC:SET?",
        ":LIMC:SET %s",
        """Set laser diode polarity. Allowed values are: {}""".format(
            LDC_POLARITIES),
        validator=strict_discrete_set,
        values=LDC_POLARITIES,
        map_values=False)
    LDCStatus = Instrument.control(
        ":LASER?",
        ":LASER %s",
        """Set laser diode status. Allowed values are: {}""".format(STATUS),
        validator=strict_discrete_set,
        values=STATUS,
        map_values=False)

    # Code for TED-xxxx daughter boards (TEC driver)
    TEDStatus = Instrument.control(
        ":TEC?",
        ":TEC %s",
        """Set TEC status. Allowed values are: {}""".format(STATUS),
        validator=strict_discrete_set,
        values=STATUS,
        map_values=False)
    TEDSetTemperature = Instrument.control(":TEMP:SET?", ":TEMP:SET %g",
                                           """Set TEC temperature""")
コード例 #30
0
 class Fake(FakeInstrument):
     x = Instrument.control(
         "",
         "%d",
         "",
         validator=strict_discrete_set,
         values={
             'X': 1,
             'Y': 2,
             'Z': 3
         },
         map_values=True,
         dynamic=dynamic,
     )