mahos.inst.instrument.Instrument#

class mahos.inst.instrument.Instrument(name: str, conf: dict | None = None, prefix: str | None = None)#

Base class for Instrument.

Parameters:

conf – instrument’s local config. if None, empty dict is set.

Variables:
  • conf – instrument’s local config.

  • logger – configured logger.

Standard Instrument APIs#

Below is the list of standard instrument APIs. Override these methods (with the same signature) to expose the instrument’s functionality.

Instrument.start(label: str = '') bool#

Start the instrument operation. Returns True on success.

(if given) label specifies a subsystem of the instrument to start.

Instrument.stop(label: str = '') bool#

Stop the instrument operation. Returns True on success.

(if given) label specifies a subsystem of the instrument to stop.

Instrument.shutdown() bool#

Shutdown the instrument and get ready to hard power-off. Returns True on success.

Although default implementation is fall-back to close(), a different behaviour can be implemented. This function is meant to be a bit harder operation than close() and called by user request (rather than implicit call on InstrumentServer’s exit).

Instrument.pause(label: str = '') bool#

Pause the instrument operation. Returns True on success.

(if given) label specifies a subsystem of the instrument to pause.

Instrument.resume(label: str = '') bool#

Resume the instrument operation from pause. Returns True on success.

(if given) label specifies a subsystem of the instrument to resume.

Instrument.reset(label: str = '') bool#

Reset the instrument settings. Returns True on success.

(if given) label specifies a subsystem of the instrument to reset.

Instrument.set(key: str, value=None, label: str = '') bool#

Set an instrument setting or commanding value. Returns True on success.

(if given) label specifies a subsystem of the instrument.

Instrument.get(key: str, args=None, label: str = '')#

Get an instrument setting or measurement data.

(if given) label specifies a subsystem of the instrument.

Instrument.configure(params: dict, label: str = '') bool#

Configure the instrument settings. Returns True on success.

Instrument.get_param_dict(label: str = '') P.ParamDict[str, P.PDValue] | None#

Get ParamDict for label.

Instrument.get_param_dict_labels() list[str]#

Get list of available ParamDict labels.

Other Methods

check_required_conf(req_keys)

Check if required keys are defined in self.conf.

check_required_params(params, req_keys)

Check if required keys (req_keys) are defined in params.

close()

Close instrument resources (only once).

fail_with(msg)

Log error and return False.

full_name()

Get full name: (prefix->)ClassName(name)