Ejemplo n.º 1
0
 def output(self):
     """
     Gets the specified output port.
     
     :type: :class:`SRSDG645.Output`
     """
     return ProxyList(self, self.Output, self.Outputs)
Ejemplo n.º 2
0
 def measurement(self):
     """
     Gets a specific oscilloscope measurement object. The desired channel is
     specified like one would access a list.
     
     :rtype: `_TDS5xxMeasurement`
     """
     return ProxyList(self, _TekTDS5xxMeasurement, xrange(3))
Ejemplo n.º 3
0
 def math(self):
     """
     Gets a data source object corresponding to the MATH channel.
     
     :rtype: `_TekTDS5xxDataSource`
     """
     return ProxyList(
         self,
         lambda s, idx: _TekTDS5xxDataSource(s, "MATH{}".format(idx + 1)),
         xrange(3))
Ejemplo n.º 4
0
    def channel(self):
        """
        Gets a channel object for the function generator. This should use
        `~instruments.util_fns.ProxyList` to achieve this.

        The number of channels accessable depends on the value
        of FunctionGenerator._channel_count

        :rtype: `FunctionGenerator.Channel`
        """
        return ProxyList(self, self.Channel, range(self._channel_count))
Ejemplo n.º 5
0
 def sensor(self):
     """
     Gets a specific sensor object. The desired sensor is specified like
     one would access a list.
     
     For instance, this would query the temperature of the first sensor::
     
     >>> itc = ik.other.OxfordITC503.open_gpibusb('/dev/ttyUSB0', 1)
     >>> print itc.sensor[0].temperature
     """
     return ProxyList(self, OxfordITC503.Sensor, xrange(3))
Ejemplo n.º 6
0
def test_ProxyList_invalid_idx():
    class ProxyChild(object):
        def __init__(self, parent, name):
            self._parent = parent
            self._name = name

    parent = object()

    proxy_list = ProxyList(parent, ProxyChild, range(5))

    _ = proxy_list[10]  # Should raise IndexError
Ejemplo n.º 7
0
 def channel(self):
     '''
     Gets a specific channel object. The desired channel is specified like 
     one would access a list.
     
     :rtype: `_HP6624aChannel`
     
     .. seealso::
         `HP6624a` for example using this property.
     '''
     return ProxyList(self, _HP6624aChannel, xrange(self.channel_count))
Ejemplo n.º 8
0
def test_ProxyList_length():
    class ProxyChild(object):
        def __init__(self, parent, name):
            self._parent = parent
            self._name = name

    parent = object()

    proxy_list = ProxyList(parent, ProxyChild, range(10))

    eq_(len(proxy_list), 10)
Ejemplo n.º 9
0
 def sensor(self):
     """
     Gets a specific sensor object. The desired sensor is specified like
     one would access a list.
     
     :rtype: `~PicowattAVS47.Sensor`
     
     .. seealso::
         `PicowattAVS47` for an example using this property.
     """
     return ProxyList(self, PicowattAVS47.Sensor, xrange(8))
Ejemplo n.º 10
0
    def channel(self):
        """
        Gets a specific channel object. The desired channel is specified like
        one would access a list.

        :rtype: `EpqisDemoInstrument.Channel`

        .. seealso::
            `EpqisDemoInstrument` for example using this property.
        """
        return ProxyList(self, EpqisDemoInstrument.Channel,
                         range(self._channel_count))
Ejemplo n.º 11
0
    def channel(self):
        """
        Gets a specific channel object.

        For example, the following would set the coupling of channel 1:

        >>>> counter = ik.keithley.Keithley775A.open_gpibusb("/dev/ttyUSB0", 10)
        >>>> counter.channel[0].coupling = counter.Coupling.DC

        :rtype: `Keithley775A.Channel`
        """
        return ProxyList(self, Keithley775A.Channel, range(2))
Ejemplo n.º 12
0
    def channel(self):
        """
        Gets an iterator or list for easy Pythonic access to the various
        channel objects on the oscilloscope instrument.

        Example:
            >>> import instruments as ik
            >>> import instruments.units as u
            >>> inst = ik.teledyne.MAUI.open_visa("TCPIP0::192.168.0.10::INSTR")
            >>> channel = inst.channel[0]  # get first channel
        """
        return ProxyList(self, self.Channel, range(self.number_channels))
Ejemplo n.º 13
0
    def math(self):
        """
        Gets an iterator or list for easy Pythonic access to the various
        math data sources objects on the oscilloscope instrument.

        Example:
            >>> import instruments as ik
            >>> import instruments.units as u
            >>> inst = ik.teledyne.MAUI.open_visa("TCPIP0::192.168.0.10::INSTR")
            >>> math = inst.math[0]  # get first math function
        """
        return ProxyList(self, self.Math, range(self.number_functions))
    def channel(self):
        """
        Gets the specific channel object.
        This channel is accessed as a list in the following manner::

        >>> import instruments as ik
        >>> osa = ik.yokogawa.Yokogawa6370.open_gpibusb('/dev/ttyUSB0')
        >>> dat = osa.channel["A"].data # Gets the data of channel 0

        :rtype: `list`[`~Yokogawa6370.Channel`]
        """
        return ProxyList(self, Yokogawa6370.Channel, Yokogawa6370.Traces)
Ejemplo n.º 15
0
 def channel(self):
     """
     Gets a specific oscilloscope channel object. The desired channel is 
     specified like one would access a list.
     
     For instance, this would transfer the waveform from the first channel::
     
     >>> tek = ik.tektronix.TekTDS5xx.open_tcpip('192.168.0.2', 8888)
     >>> [x, y] = tek.channel[0].read_waveform()
     
     :rtype: `_TekTDS5xxChannel`
     """
     return ProxyList(self, _TekTDS5xxChannel, xrange(4))
Ejemplo n.º 16
0
    def measurement(self):
        """
        Gets an iterator or list for easy Pythonic access to the various
        measurement data sources objects on the oscilloscope instrument.

        Example:
            >>> import instruments as ik
            >>> import instruments.units as u
            >>> inst = ik.teledyne.MAUI.open_visa("TCPIP0::192.168.0.10::INSTR")
            >>> msr = inst.measurement[0]  # get first measurement parameter
        """
        return ProxyList(self, self.Measurement,
                         range(self.number_measurements))
Ejemplo n.º 17
0
def test_ProxyList_basics():
    class ProxyChild(object):
        def __init__(self, parent, name):
            self._parent = parent
            self._name = name

    parent = object()

    proxy_list = ProxyList(parent, ProxyChild, range(10))

    child = proxy_list[0]
    assert child._parent is parent
    assert child._name == 0
Ejemplo n.º 18
0
    def channel(self):
        """
        Gets a specific channel object. The desired channel is specified like
        one would access a list.

        For instance, this would print the counts of the first channel::

        >>> cc = ik.qubitekk.CC1.open_serial('COM8', 19200, timeout=1)
        >>> print(cc.channel[0].count)

        :rtype: `CC1.Channel`
        """
        return ProxyList(self, CC1.Channel, range(self._channel_count))
Ejemplo n.º 19
0
def test_ProxyList_iterator():
    class ProxyChild(object):
        def __init__(self, parent, name):
            self._parent = parent
            self._name = name

    parent = object()

    proxy_list = ProxyList(parent, ProxyChild, range(10))

    i = 0
    for item in proxy_list:
        eq_(item._name, i)
        i = i + 1
Ejemplo n.º 20
0
 def channel(self):
     '''
     Gets a specific channel object. 
     
     The desired channel is accessed by passing an EnumValue from 
     `~SRSDG645.Channels`. For example, to access channel A:
     
     >>> inst.channel[inst.Channels.A]
     
     See the example in `SRSDG645` for a more complete example.
     
     :rtype: `_SRSDG645Channel`
     '''
     return ProxyList(self, _SRSDG645Channel, SRSDG645.Channels)
Ejemplo n.º 21
0
 def channel(self):
     """
     Gets the specific power supply channel object. Since the Yokogawa7651
     is only equiped with a single channel, a list with a single element
     will be returned.
     
     This (single) channel is accessed as a list in the following manner::
     
     >>> yoko = ik.other.Yokogawa7651.open_gpibusb('/dev/ttyUSB0', 10)
     >>> yoko.channel[0].voltage = 1 # Sets output voltage to 1V
     
     :rtype: `~Yokogawa7651.Channel`
     """
     return ProxyList(self, Yokogawa7651.Channel, [0])
Ejemplo n.º 22
0
    def channel(self):
        """
        Gets a specific Keithley 2182 channel object. The desired channel is
        specified like one would access a list.

        Although not default, the 2182 has up to two channels.

        For example, the following would print the measurement from channel 1:

        >>> meter = ik.keithley.Keithley2182.open_gpibusb("/dev/ttyUSB0", 10)
        >>> print meter.channel[0].measure()

        :rtype: `Keithley2182.Channel`
        """
        return ProxyList(self, Keithley2182.Channel, range(2))
    def channel(self):
        """
        Gets a specific channel on the AWG2000. The desired channel is accessed
        like one would access a list.

        Example usage:

        >>> import instruments as ik
        >>> inst = ik.tektronix.TekAWG2000.open_gpibusb("/dev/ttyUSB0", 1)
        >>> print(inst.channel[0].frequency)

        :return: A channel object for the AWG2000
        :rtype: `TekAWG2000.Channel`
        """
        return ProxyList(self, self.Channel, range(2))
Ejemplo n.º 24
0
    def laser(self):
        """
        Gets a specific Topmode laser object. The desired laser is
        specified like one would access a list.

        For example, the following would print the wavelength from laser 1:

        >>> import instruments as ik
        >>> import instruments.units as u
        >>> tm = ik.toptica.TopMode.open_serial('/dev/ttyUSB0', 115200)
        >>> print(tm.laser[0].wavelength)

        :rtype: `~TopMode.Laser`
        """
        return ProxyList(self, self.Laser, range(2))
Ejemplo n.º 25
0
    def channel(self):
        """
        Gets a specific channel on the HS9000. The desired channel is accessed
        like one would access a list.

        Example usage:

        >>> import instruments as ik
        >>> hs = ik.holzworth.HS9000.open_tcpip("192.168.0.2", 8080)
        >>> print(hs.channel[0].frequency)

        :return: A channel object for the HS9000
        :rtype: `~HS9000.Channel`
        """
        return ProxyList(self, self.Channel, self._channel_idxs())
Ejemplo n.º 26
0
    def channel(self):
        """
        Gets a specific channel object. The desired channel is specified like
        one would access a list.

        For instance, this would print the counts of the first channel::

        >>> import instruments as ik
        >>> mhs = ik.minghe.MHS5200.open_serial(vid=1027, pid=24577,
        baud=19200, timeout=1)
        >>> print(mhs.channel[0].frequency)

        :rtype: `list`[`MHS5200.Channel`]
        """
        return ProxyList(self, MHS5200.Channel, range(self._channel_count))
Ejemplo n.º 27
0
    def sensor(self):
        """
        Gets a specific sensor object. The desired sensor is specified like
        one would access a list.

        For instance, this would query the temperature of the first sensor::

        >>> bridge = Lakeshore340.open_serial("COM5")
        >>> print(bridge.sensor[0].temperature)

        The Lakeshore 340 supports up to 2 sensors (index 0-1).

        :rtype: `~Lakeshore340.Sensor`
        """
        return ProxyList(self, Lakeshore340.Sensor, range(2))
Ejemplo n.º 28
0
def test_ProxyList_invalid_idx_enum():
    class ProxyChild(object):
        def __init__(self, parent, name):
            self._parent = parent
            self._name = name

    class MockEnum(Enum):
        a = "aa"
        b = "bb"

    parent = object()

    proxy_list = ProxyList(parent, ProxyChild, MockEnum)

    _ = proxy_list['c']  # Should raise IndexError
Ejemplo n.º 29
0
 def channel(self):
     """
     Gets a specific channel object. The desired channel is specified like 
     one would access a list. 
     
     For instance, this would query the resistance of the first channel::
     
     >>> import instruments as ik
     >>> bridge = ik.lakeshore.Lakeshore370.open_serial("COM5")
     >>> print bridge.channel[0].resistance
     
     The Lakeshore 370 supports up to 16 channels (index 0-15).
     
     :rtype: `~Lakeshore370.Channel`
     """
     return ProxyList(self, Lakeshore370.Channel, xrange(16))
Ejemplo n.º 30
0
 def ref(self):
     """
     Gets a specific oscilloscope reference channel object. The desired 
     channel is specified like one would access a list.
     
     For instance, this would transfer the waveform from the first channel::
     
     >>> tek = ik.tektronix.TekTDS5xx.open_tcpip('192.168.0.2', 8888)
     >>> [x, y] = tek.ref[0].read_waveform()
     
     :rtype: `_TekTDS5xxDataSource`
     """
     return ProxyList(
         self,
         lambda s, idx: _TekTDS5xxDataSource(s, "REF{}".format(idx + 1)),
         xrange(4))