Driver Utils¶
-
class
instrumental.drivers.
VisaMixin
¶ -
query
(message, *args, **kwds)¶ Query the instrument’s VISA resource with
message
-
write
(message, *args, **kwds)¶ Write
message
to the instrument’s VISA resource
-
resource
¶ VISA resource
-
Helpful utilities for writing drivers.
-
instrumental.drivers.util.
check_units
(*pos, **named)¶ Decorator to enforce the dimensionality of input args and return values.
Allows strings and anything that can be passed as a single arg to
pint.Quantity
.@check_units(value='V') def set_voltage(value): pass # `value` will be a pint.Quantity with Volt-like units
-
instrumental.drivers.util.
unit_mag
(*pos, **named)¶ Decorator to extract the magnitudes of input args and return values.
Allows strings and anything that can be passed as a single arg to
pint.Quantity
.@unit_mag(value='V') def set_voltage(value): pass # The input must be in Volt-like units and `value` will be a raw number # expressing the magnitude in Volts
-
instrumental.drivers.util.
check_enums
(**kw_args)¶ Decorator to type-check input arguments as enums.
Allows strings and anything that can be passed to
as_enum
.@check_enums(mode=SampleMode) def set_mode(mode): pass # `mode` will be of type SampleMode
-
instrumental.drivers.util.
as_enum
(enum_type, arg)¶ Check if arg is an instance or key of enum_type, and return that enum
-
instrumental.drivers.util.
visa_timeout_context
(*args, **kwds)¶ Context manager for temporarily setting a visa resource’s timeout.
with visa_timeout_context(rsrc, 100): ... # `rsrc` will have a timeout of 100 ms within this block