Skip to content

Commit

Permalink
Merge pull request #1019 from BenediktBurger/SCPI-instrument-codebase
Browse files Browse the repository at this point in the history
Scpi instrument codebase
  • Loading branch information
CasperSchippers committed Mar 27, 2024
2 parents 1c8d1b2 + 8796058 commit 758f0ca
Show file tree
Hide file tree
Showing 74 changed files with 269 additions and 311 deletions.
4 changes: 2 additions & 2 deletions pymeasure/instruments/activetechnologies/AWG401x.py
Expand Up @@ -31,7 +31,7 @@

import pprint

from pymeasure.instruments import Instrument, Channel
from pymeasure.instruments import Instrument, Channel, SCPIUnknownMixin
from pymeasure.instruments.validators import strict_discrete_set, \
strict_range

Expand Down Expand Up @@ -349,7 +349,7 @@ class ChannelAWG(ChannelBase):
)


class AWG401x_base(Instrument):
class AWG401x_base(SCPIUnknownMixin, Instrument):
"""AWG-401x base class"""

def __init__(self, adapter,
Expand Down
4 changes: 2 additions & 2 deletions pymeasure/instruments/advantest/advantestR3767CG.py
Expand Up @@ -22,11 +22,11 @@
# THE SOFTWARE.
#

from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin
from pymeasure.instruments.validators import strict_range


class AdvantestR3767CG(Instrument):
class AdvantestR3767CG(SCPIUnknownMixin, Instrument):
""" Represents the Advantest R3767CG VNA. Implements controls to change the analysis
range and to retrieve the data for the trace.
"""
Expand Down
4 changes: 2 additions & 2 deletions pymeasure/instruments/advantest/advantestR624X.py
Expand Up @@ -23,7 +23,7 @@

import logging
from enum import IntEnum, IntFlag
from pymeasure.instruments import Instrument, Channel
from pymeasure.instruments import Instrument, Channel, SCPIUnknownMixin
from pymeasure.instruments.validators import truncated_range, strict_discrete_set, \
strict_range

Expand Down Expand Up @@ -429,7 +429,7 @@ def map_values(value, values):
return values[strict_discrete_set(value, values)]


class AdvantestR624X(Instrument):
class AdvantestR624X(SCPIUnknownMixin, Instrument):
""" Represents the Advantest R624X series (channel A and B) SourceMeter and provides a
high-level interface for interacting with the instrument.
Expand Down
4 changes: 2 additions & 2 deletions pymeasure/instruments/agilent/agilent33220A.py
Expand Up @@ -22,7 +22,7 @@
# THE SOFTWARE.
#

from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin
from pymeasure.instruments.validators import strict_discrete_set,\
strict_range, joined_validators
from time import time
Expand All @@ -42,7 +42,7 @@ def capitalize_string(string: str, *args, **kwargs):
string_validator = joined_validators(capitalize_string, strict_discrete_set)


class Agilent33220A(Instrument):
class Agilent33220A(SCPIUnknownMixin, Instrument):
"""Represents the Agilent 33220A Arbitrary Waveform Generator.
.. code-block:: python
Expand Down
4 changes: 2 additions & 2 deletions pymeasure/instruments/agilent/agilent33500.py
Expand Up @@ -25,7 +25,7 @@
# Parts of this code were copied and adapted from the Agilent33220A class.

import logging
from pymeasure.instruments import Instrument, Channel
from pymeasure.instruments import Instrument, Channel, SCPIUnknownMixin
from pymeasure.instruments.validators import strict_discrete_set, strict_range
from time import time
from pyvisa.errors import VisaIOError
Expand Down Expand Up @@ -356,7 +356,7 @@ def data_arb(self, arb_name, data_points, data_format="DAC"):
)


class Agilent33500(Instrument):
class Agilent33500(SCPIUnknownMixin, Instrument):
"""
Represents the Agilent 33500 Function/Arbitrary Waveform Generator family.
Expand Down
4 changes: 2 additions & 2 deletions pymeasure/instruments/agilent/agilent34410A.py
Expand Up @@ -22,10 +22,10 @@
# THE SOFTWARE.
#

from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin


class Agilent34410A(Instrument):
class Agilent34410A(SCPIUnknownMixin, Instrument):
"""
Represent the HP/Agilent/Keysight 34410A and related multimeters.
Expand Down
6 changes: 3 additions & 3 deletions pymeasure/instruments/agilent/agilent34450A.py
Expand Up @@ -25,14 +25,14 @@
import re
import logging

from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin
from pymeasure.instruments.validators import strict_discrete_set

log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())


class Agilent34450A(Instrument):
class Agilent34450A(SCPIUnknownMixin, Instrument):
"""
Represent the HP/Agilent/Keysight 34450A and related multimeters.
Expand Down Expand Up @@ -458,7 +458,7 @@ def configure_resistance(self, resistance_range="AUTO", wires=2, resolution="DEF
self.resistance_4w_range = resistance_range
else:
raise ValueError("Incorrect wires value, Agilent 34450A only supports 2 or 4 wire"
"resistance meaurement.")
"resistance measurement.")

def configure_frequency(self, measured_from="voltage_ac",
measured_from_range="AUTO", aperture="DEF"):
Expand Down
14 changes: 7 additions & 7 deletions pymeasure/instruments/agilent/agilent4156.py
Expand Up @@ -28,7 +28,7 @@
import numpy as np
import pandas as pd

from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin
from pymeasure.instruments.validators import (strict_discrete_set,
truncated_discrete_set,
strict_range)
Expand All @@ -42,7 +42,7 @@
######


class Agilent4156(Instrument):
class Agilent4156(SCPIUnknownMixin, Instrument):
""" Represents the Agilent 4155/4156 Semiconductor Parameter Analyzer
and provides a high-level interface for taking current-voltage (I-V) measurements.
Expand Down Expand Up @@ -426,7 +426,7 @@ def get_data(self, path=None):
##########


class SMU(Instrument):
class SMU(SCPIUnknownMixin, Instrument):
def __init__(self, adapter, channel, **kwargs):
super().__init__(
adapter,
Expand Down Expand Up @@ -649,7 +649,7 @@ def __validate_compl(self):
return values


class VMU(Instrument):
class VMU(SCPIUnknownMixin, Instrument):
def __init__(self, adapter, channel, **kwargs):
super().__init__(
adapter,
Expand Down Expand Up @@ -707,7 +707,7 @@ def channel_mode(self, mode):
self.check_errors()


class VSU(Instrument):
class VSU(SCPIUnknownMixin, Instrument):
def __init__(self, adapter, channel, **kwargs):
super().__init__(
adapter,
Expand Down Expand Up @@ -803,7 +803,7 @@ def channel_function(self, function):
#################


class VARX(Instrument):
class VARX(SCPIUnknownMixin, Instrument):
""" Base class to define sweep variable settings """

def __init__(self, adapter, var_name, **kwargs):
Expand Down Expand Up @@ -964,7 +964,7 @@ def __init__(self, adapter, **kwargs):
)


class VARD(Instrument):
class VARD(SCPIUnknownMixin, Instrument):
""" Class to handle all the definitions needed for VARD.
VARD is always defined in relation to VAR1.
"""
Expand Down
12 changes: 6 additions & 6 deletions pymeasure/instruments/agilent/agilent8257D.py
Expand Up @@ -22,11 +22,11 @@
# THE SOFTWARE.
#

from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin
from pymeasure.instruments.validators import truncated_range, strict_discrete_set


class Agilent8257D(Instrument):
class Agilent8257D(SCPIUnknownMixin, Instrument):
"""Represents the Agilent 8257D Signal Generator and
provides a high-level interface for interacting with
the instrument.
Expand Down Expand Up @@ -119,7 +119,7 @@ class Agilent8257D(Instrument):
amplitude_depth = Instrument.control(
":SOUR:AM:DEPT?", ":SOUR:AM:DEPT %g",
""" A floating point property that controls the amplitude modulation
in precent, which can take values from 0 to 100 %. """,
in percent, which can take values from 0 to 100 %. """,
validator=truncated_range,
values=[0, 100]
)
Expand Down Expand Up @@ -199,8 +199,8 @@ class Agilent8257D(Instrument):
low_freq_out_source = Instrument.control(
":SOUR:LFO:SOUR?", ":SOUR:LFO:SOUR %s",
"""A string property which controls the source of the low frequency output, which
can take the values 'internal [2]' for the inernal source, or 'function [2]' for an internal
function generator which can be configured.""",
can take the values 'internal [2]' for the internal source, or 'function [2]' for an
internal function generator which can be configured.""",
validator=strict_discrete_set,
values=LOW_FREQUENCY_SOURCES,
map_values=True
Expand Down Expand Up @@ -275,7 +275,7 @@ def config_amplitude_modulation(self, frequency=1e3, depth=100.0, shape='sine'):
""" Configures the amplitude modulation of the output signal.
:param frequency: A modulation frequency for the internal oscillator
:param depth: A linear depth precentage
:param depth: A linear depth percentage
:param shape: A string that describes the shape for the internal oscillator
"""
self.enable_amplitude_modulation()
Expand Down
4 changes: 2 additions & 2 deletions pymeasure/instruments/agilent/agilent8722ES.py
Expand Up @@ -22,7 +22,7 @@
# THE SOFTWARE.
#

from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin
from pymeasure.instruments.validators import discreteTruncate
from pymeasure.errors import RangeException
from pyvisa import VisaIOError
Expand All @@ -33,7 +33,7 @@
import warnings


class Agilent8722ES(Instrument):
class Agilent8722ES(SCPIUnknownMixin, Instrument):
""" Represents the Agilent8722ES Vector Network Analyzer
and provides a high-level interface for taking scans of the
scattering parameters.
Expand Down
14 changes: 7 additions & 7 deletions pymeasure/instruments/agilent/agilentB1500.py
Expand Up @@ -33,7 +33,7 @@
from pymeasure.instruments.validators import (strict_discrete_set,
strict_range,
strict_discrete_range)
from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin

log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
Expand All @@ -43,7 +43,7 @@
######################################


class AgilentB1500(Instrument):
class AgilentB1500(SCPIUnknownMixin, Instrument):
""" Represents the Agilent B1500 Semiconductor Parameter Analyzer
and provides a high-level interface for taking different kinds of
measurements.
Expand Down Expand Up @@ -124,7 +124,7 @@ def query_modules(self):
# i+1: channels start at 1 not at 0
except Exception:
raise NotImplementedError(
f'Module {module[0]} is not implented yet!')
f'Module {module[0]} is not implemented yet!')
return out

def initialize_smu(self, channel, smu_type, name):
Expand Down Expand Up @@ -165,7 +165,7 @@ def initialize_all_smus(self):
i += 1

def pause(self, pause_seconds):
""" Pauses Command Excecution for given time in seconds (``PA``)
""" Pauses Command Execution for given time in seconds (``PA``)
:param pause_seconds: Seconds to pause
:type pause_seconds: int
Expand Down Expand Up @@ -598,7 +598,7 @@ def meas_mode(self, mode, *args):
# ADC Setup: AAD, AIT, AV, AZ

def query_adc_setup(self):
"""Read ADC settings (55, 56) from the intrument.
"""Read ADC settings (55, 56) from the instrument.
"""
return {**self.query_learn_header(55), **self.query_learn_header(56)}

Expand Down Expand Up @@ -652,7 +652,7 @@ def adc_averaging(self, number, mode='Auto'):

@property
def adc_auto_zero(self):
""" Enable/Disable ADC zero function. Halfs the
""" Enable/Disable ADC zero function. Halves the
integration time, if off. (``AZ``)
:type: bool
Expand Down Expand Up @@ -1074,7 +1074,7 @@ def force(self, source_type, source_range, output, comp='',
:param source_range: Output range index or name
:type source_range: int or str
:param output: Source output value in A or V
:type outout: float
:type output: float
:param comp: Compliance value, defaults to previous setting
:type comp: float, optional
:param comp_polarity: Compliance polairty, defaults to auto
Expand Down
18 changes: 9 additions & 9 deletions pymeasure/instruments/agilent/agilentE4408B.py
Expand Up @@ -22,20 +22,27 @@
# THE SOFTWARE.
#

from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin
from pymeasure.instruments.validators import truncated_range

from io import StringIO
import numpy as np
import pandas as pd


class AgilentE4408B(Instrument):
class AgilentE4408B(SCPIUnknownMixin, Instrument):
""" Represents the AgilentE4408B Spectrum Analyzer
and provides a high-level interface for taking scans of
high-frequency spectrums
"""

def __init__(self, adapter, name="Agilent E4408B Spectrum Analyzer", **kwargs):
super().__init__(
adapter,
name,
**kwargs
)

start_frequency = Instrument.control(
":SENS:FREQ:STAR?;", ":SENS:FREQ:STAR %e Hz;",
""" A floating point property that represents the start frequency
Expand Down Expand Up @@ -76,13 +83,6 @@ class AgilentE4408B(Instrument):
"""
)

def __init__(self, adapter, name="Agilent E4408B Spectrum Analyzer", **kwargs):
super().__init__(
adapter,
name,
**kwargs
)

@property
def frequencies(self):
""" Returns a numpy array of frequencies in Hz that
Expand Down
6 changes: 3 additions & 3 deletions pymeasure/instruments/agilent/agilentE4980.py
Expand Up @@ -23,12 +23,12 @@
#


from pymeasure.instruments import Instrument
from pymeasure.instruments import Instrument, SCPIUnknownMixin
from pymeasure.instruments.validators import strict_discrete_set, strict_range
from pyvisa.errors import VisaIOError


class AgilentE4980(Instrument):
class AgilentE4980(SCPIUnknownMixin, Instrument):
"""Represents LCR meter E4980A/AL"""

ac_voltage = Instrument.control(":VOLT:LEV?", ":VOLT:LEV %g",
Expand Down Expand Up @@ -74,7 +74,7 @@ class AgilentE4980(Instrument):
- LSQ: Seriesinductance [H] and quality factor [number]
- LSRS: Series inductance [H] and series resistance [Ohm]
* RX: Resitance [Ohm] and reactance [Ohm]
* RX: Resistance [Ohm] and reactance [Ohm]
* ZTD: Impedance, magnitude [Ohm] and phase [deg]
* ZTR: Impedance, magnitude [Ohm] and phase [rad]
* GB: Conductance [S] and susceptance [S]
Expand Down
4 changes: 2 additions & 2 deletions pymeasure/instruments/aimtti/aimttiPL.py
Expand Up @@ -22,7 +22,7 @@
# THE SOFTWARE.
#

from pymeasure.instruments import Instrument, Channel
from pymeasure.instruments import Instrument, Channel, SCPIUnknownMixin
from pymeasure.instruments.validators import strict_discrete_set, strict_range


Expand Down Expand Up @@ -88,7 +88,7 @@ def __init__(self, parent, id, voltage_range: list = None, current_range: list =
)


class PLBase(Instrument):
class PLBase(SCPIUnknownMixin, Instrument):
"""Control AimTTI PL series power supplies.
Model number ending with -P or P(G) support this remote interface.
Expand Down

0 comments on commit 758f0ca

Please sign in to comment.