Standard Methods

The common device API shared by every Plesty device (connection, I/O and lifecycle). See Usage for how to use them.

connect() bool

standard

Open the VISA connection to the PM100D.

Returns:

True if the connection is successfully open, False otherwise.

disconnect() NoneType

standard

Close the VISA connection and release all resources.

identity() str

standard

Return the instrument identification string (\*IDN?).

Returns:

Identification string in the form 'THORLABS,PM100D,<serial>,<firmware>'.

check_errors() list

standard

Query the error queue and return any active error messages.

Returns:

Empty list when the device reports no error (0,"No error"); a one-element list containing the raw error string otherwise.

check_operatability() bool

standard

Return True if the VISA session is open.

Returns:

True when the traffic manager exists and its session is open.

write(key: str, value: str | float | int | bool) bool

standard

Write a configuration parameter value to the device after validation.

Parameters:
  • key (str) – Name of the parameter to write (as listed on the Parameters page).

  • value (str | float | int | bool) – New value; validated against the parameter’s type and range before being sent to the device.

Returns:

True if the write succeeded, False otherwise (e.g. a permission check failed).

query(key: str) Any

standard

Query a configuration parameter value from the device.

Parameters:

key (str) – Name of the parameter to read (as listed on the Parameters page).

Returns:

The parameter’s current value, converted to its declared type.

reset() NoneType

standard

Send \*RST to return the instrument to its factory default state.

clear() NoneType

standard

Send \*CLS to clear the status registers and error queue.

status() DeviceStatus

standard

Return a point-in-time snapshot of the device’s operational state.

Returns:

The current DeviceStatus.

set_data_path(path: str | os.PathLike[str]) str

standard

Set the directory where this device stores acquired data.

Parameters:

path (str | os.PathLike[str]) – Target directory, absolute or relative to the device’s default data path.

Returns:

The directory now in effect, in the configured spelling of its data root — a mapped drive stays a mapped drive; resolution is used for the containment checks only.

get_data_path() str

standard

Return the directory currently used for acquired data.

Returns:

The directory in effect, in its configured spelling: the last one set by a client, or the device’s configured default. The directory is created if missing — the configured default is otherwise never created anywhere (construction is side-effect-free), and vendor software validating the directory rejects one that does not exist (plesty-lib#31).