Instrument classes¶
-
class
pymeasure.instruments.
Instrument
(adapter, name, includeSCPI=True, **kwargs)¶ This provides the base class for all Instruments, which is independent of the particular Adapter used to connect for communication to the instrument. It provides basic SCPI commands by default, but can be toggled with
includeSCPI
.- Parameters
adapter – An
Adapter
objectname – A string name
includeSCPI – A boolean, which toggles the inclusion of standard SCPI commands
-
ask
(command)¶ Writes the command to the instrument through the adapter and returns the read response.
- Parameters
command – command string to be sent to the instrument
-
check_errors
()¶ Return any accumulated errors. Must be reimplemented by subclasses.
-
clear
()¶ Clears the instrument status byte
-
static
control
(get_command, set_command, docs, validator=<function Instrument.<lambda>>, values=(), map_values=False, get_process=<function Instrument.<lambda>>, set_process=<function Instrument.<lambda>>, check_set_errors=False, check_get_errors=False, **kwargs)¶ Returns a property for the class based on the supplied commands. This property may be set and read from the instrument.
- Parameters
get_command – A string command that asks for the value
set_command – A string command that writes the value
docs – A docstring that will be included in the documentation
validator – A function that takes both a value and a group of valid values and returns a valid value, while it otherwise raises an exception
values – A list, tuple, range, or dictionary of valid values, that can be used as to map values if
map_values
is True.map_values – A boolean flag that determines if the values should be interpreted as a map
get_process – A function that take a value and allows processing before value mapping, returning the processed value
set_process – A function that takes a value and allows processing before value mapping, returning the processed value
check_set_errors – Toggles checking errors after setting
check_get_errors – Toggles checking errors after getting
-
property
id
¶ Requests and returns the identification of the instrument.
-
static
measurement
(get_command, docs, values=(), map_values=None, get_process=<function Instrument.<lambda>>, command_process=<function Instrument.<lambda>>, check_get_errors=False, **kwargs)¶ Returns a property for the class based on the supplied commands. This is a measurement quantity that may only be read from the instrument, not set.
- Parameters
get_command – A string command that asks for the value
docs – A docstring that will be included in the documentation
values – A list, tuple, range, or dictionary of valid values, that can be used as to map values if
map_values
is True.map_values – A boolean flag that determines if the values should be interpreted as a map
get_process – A function that take a value and allows processing before value mapping, returning the processed value
command_process – A function that take a command and allows processing before executing the command, for both getting and setting
check_get_errors – Toggles checking errors after getting
-
read
()¶ Reads from the instrument through the adapter and returns the response.
-
reset
()¶ Resets the instrument.
-
static
setting
(set_command, docs, validator=<function Instrument.<lambda>>, values=(), map_values=False, set_process=<function Instrument.<lambda>>, check_set_errors=False, **kwargs)¶ Returns a property for the class based on the supplied commands. This property may be set, but raises an exception when being read from the instrument.
- Parameters
set_command – A string command that writes the value
docs – A docstring that will be included in the documentation
validator – A function that takes both a value and a group of valid values and returns a valid value, while it otherwise raises an exception
values – A list, tuple, range, or dictionary of valid values, that can be used as to map values if
map_values
is True.map_values – A boolean flag that determines if the values should be interpreted as a map
set_process – A function that takes a value and allows processing before value mapping, returning the processed value
check_set_errors – Toggles checking errors after setting
-
shutdown
()¶ Brings the instrument to a safe and stable state
-
values
(command, **kwargs)¶ Reads a set of values from the instrument through the adapter, passing on any key-word arguments.
-
write
(command)¶ Writes the command to the instrument through the adapter.
- Parameters
command – command string to be sent to the instrument
-
class
pymeasure.instruments.
Mock
(wait=0.1, **kwargs)¶ Bases:
pymeasure.instruments.instrument.Instrument
Mock instrument for testing.
-
get_time
()¶ Get elapsed time
-
get_voltage
()¶ Get the voltage.
-
get_wave
()¶ Get wave.
-
reset_time
()¶ Reset the timer to 0 s.
-
set_output_voltage
(value)¶ Set the voltage.
-
set_time
(value)¶ Wait for the timer to reach the specified time. If value = 0, reset.
-
property
time
¶ Get elapsed time
-
property
voltage
¶ Get the voltage.
-
property
wave
¶ Get wave.
-