instrumentserver.testing.dummy_instruments.generic#

Classes

DummyChannel(*args, **kwargs)

DummyInstrumentRandomNumber(*args, **kwargs)

A dummy instrument with a few parameters that have random numbers generated on demand

DummyInstrumentTimeout(*args, **kwargs)

A dummy instrument to test timeout situations.

DummyInstrumentWithFlags(*args, **kwargs)

Dummy instrument whose parameters return IntFlag values.

DummyInstrumentWithSubmodule(*args, **kwargs)

A dummy instrument with submodules.

FieldVectorIns(*args, **kwargs)

class used to develop json serialization and guis

MutableInterfaceInstrument(*args, **kwargs)

Dummy whose parameters, methods, and submodules can change at runtime.

SerializationInstrument(*args, **kwargs)

Dummy that returns representative values across the Client transport.

StatusFlag(*values)

An IntFlag mirroring drivers like the Yokogawa GS200 status byte.

SweepRequest(center_hz, span_hz, metadata, ...)

Serializable request used by Client transport tests and examples.

SweepResult(frequency_hz, magnitude_db)

Serializable result used by Client transport tests and examples.

class instrumentserver.testing.dummy_instruments.generic.DummyChannel(*args: Any, **kwargs: Any)[source]#

Bases: Instrument

ask_raw(cmd: str) str[source]#

Return a minimal response to identification queries.

dummy_function(*args, **kwargs)[source]#

Dummy function for specific channels used for testing

class instrumentserver.testing.dummy_instruments.generic.DummyInstrumentRandomNumber(*args: Any, **kwargs: Any)[source]#

Bases: Instrument

A dummy instrument with a few parameters that have random numbers generated on demand

generate_data(name: str)[source]#
get(param_name)[source]#

Shortcut for getting a parameter from its name.

Parameters:

param_name – The name of a parameter of this instrument.

Returns:

The current value of the parameter.

Note

This is deprecated. Call get directly on the parameter.

class instrumentserver.testing.dummy_instruments.generic.DummyInstrumentTimeout(*args: Any, **kwargs: Any)[source]#

Bases: Instrument

A dummy instrument to test timeout situations.

ask_raw(cmd: str) str[source]#

Answer identification queries without touching timeout behavior.

get_random()[source]#
get_random_timeout(wait_time=10)[source]#
class instrumentserver.testing.dummy_instruments.generic.DummyInstrumentWithFlags(*args: Any, **kwargs: Any)[source]#

Bases: Instrument

Dummy instrument whose parameters return IntFlag values.

Mirrors the Yokogawa GS200 status/event register parameters, which store IntFlag instances as their value. Used to test that station snapshots containing flag values serialize (and round-trip) correctly.

get_condition()[source]#
get_status()[source]#
class instrumentserver.testing.dummy_instruments.generic.DummyInstrumentWithSubmodule(*args: Any, **kwargs: Any)[source]#

Bases: Instrument

A dummy instrument with submodules.

ask_raw(cmd)[source]#

Dummy ask_raw so *IDN? and similar SCPI queries don’t explode the GUI.

close() None[source]#

Irreversibly stop this instrument and free its resources.

Subclasses should override this if they have other specific resources to close.

dummy_function(*args, **kwargs)[source]#

Such a dumb dummy function here doing nothing other than printing and occupying your precious, precious terminal space.

test_func(a, b, *args, c: List[int] = [10, 11], **kwargs)[source]#

This is a test function, of course you knew this from the tittle but It’s nice to have documentation, isn’t it?

Parameters:
  • a – Very nice parameter.

  • b – Even nicer parameter

  • c – This one sucks though.

class instrumentserver.testing.dummy_instruments.generic.FieldVectorIns(*args: Any, **kwargs: Any)[source]#

Bases: Instrument

class used to develop json serialization and guis

ask_raw(cmd: str) str[source]#

Return a minimal response to identification queries.

generic_function()[source]#
get_complex()[source]#
get_complex_list()[source]#
get_field()[source]#
get_starting_parameter()[source]#
set_complex(value: complex)[source]#
set_complex_list(value)[source]#
set_field(field_vector: FieldVector)[source]#
set_starting_parameter(new_value)[source]#
class instrumentserver.testing.dummy_instruments.generic.MutableInterfaceInstrument(*args: Any, **kwargs: Any)[source]#

Bases: Instrument

Dummy whose parameters, methods, and submodules can change at runtime.

add_dynamic_interface()[source]#

Add one parameter, method, and submodule for Proxy update tests.

ask_raw(cmd: str) str[source]#

Return a minimal response to identification queries.

remove_dynamic_interface()[source]#

Remove the runtime interface added by add_dynamic_interface().

class instrumentserver.testing.dummy_instruments.generic.SerializationInstrument(*args: Any, **kwargs: Any)[source]#

Bases: Instrument

Dummy that returns representative values across the Client transport.

ask_raw(cmd: str) str[source]#

Return a minimal response to identification queries.

echo(value)[source]#

Return value unchanged.

get_nested_status()[source]#

Return an enum nested in a list.

get_numeric_text()[source]#

Return numeric-looking text so decoder coercion can be tested.

get_set()[source]#

Return a set so transport container conversion can be tested.

get_status()[source]#

Return an importable top-level enum member.

get_tuple()[source]#

Return a tuple so transport container conversion can be tested.

run_sweep(request)[source]#

Return a three-point sweep for a SweepRequest.

class instrumentserver.testing.dummy_instruments.generic.StatusFlag(*values)[source]#

Bases: IntFlag

An IntFlag mirroring drivers like the Yokogawa GS200 status byte.

On Python >= 3.11 flag members are iterable and a single-bit member iterates to itself, which is what triggers the snapshot serialization recursion bug this instrument is used to test.

EAV = 4#
ESB = 32#
MAV = 16#
class instrumentserver.testing.dummy_instruments.generic.SweepRequest(center_hz: float, span_hz: float, metadata: dict[str, str]=<factory>)[source]#

Bases: object

Serializable request used by Client transport tests and examples.

attributes: ClassVar[tuple[str, ...]] = ('center_hz', 'span_hz', 'metadata')#
center_hz: float#
metadata: dict[str, str]#
span_hz: float#
class instrumentserver.testing.dummy_instruments.generic.SweepResult(frequency_hz: list[float], magnitude_db: list[float])[source]#

Bases: object

Serializable result used by Client transport tests and examples.

attributes: ClassVar[tuple[str, ...]] = ('frequency_hz', 'magnitude_db')#
frequency_hz: list[float]#
magnitude_db: list[float]#