plesty.pm100d.sensors

What the sensor head fitted to a PM100D can and cannot be asked.

The meter’s SCPI vocabulary is fixed; what it can answer is not. A silicon photodiode has no pyroelectric element and no temperature probe, so MEAS:ENER? and MEAS:TEMP? are simply never answered. That silence is worse than an error: the transport reads it as a wedged instrument and escalates through a device clear and a session reopen, and repeating it wedges the meter for real.

So the gaps are recorded per sensor in sensor_capabilities.json and looked up at runtime, rather than hardcoded into whatever happens to be attached today.

Attributes

_CAPABILITIES_FILE

DEFAULT_KEY

Functions

load_capabilities(→ dict[str, Any])

Return the sensor capability map, keyed by sensor name.

unsupported_ops(→ list[str])

Return the operations sensor cannot perform.

param_limits(→ dict[str, tuple[float, float]])

Return the parameter ranges sensor actually accepts.

known_sensors(→ list[str])

Return the sensor names with a recorded entry.

read_sensor_name(→ str | None)

Read the fitted sensor's name from a connected device.

Module Contents

plesty.pm100d.sensors._CAPABILITIES_FILE
plesty.pm100d.sensors.DEFAULT_KEY = '_default'
plesty.pm100d.sensors.load_capabilities() dict[str, Any]

Return the sensor capability map, keyed by sensor name.

Returns:

The parsed document. Keys beginning with _ are metadata, except DEFAULT_KEY which is the fallback entry.

Return type:

dict[str, Any]

plesty.pm100d.sensors.unsupported_ops(sensor: str | None) list[str]

Return the operations sensor cannot perform.

Parameters:

sensor (str | None) – Sensor name as reported by SYST:SENS:IDN?, or None when it could not be read.

Returns:

Operation names to keep away from this sensor. An unknown sensor gets the conservative default — the union of every known head’s gaps — because driving an unanswerable query is what wedges the meter.

Return type:

list[str]

plesty.pm100d.sensors.param_limits(sensor: str | None) dict[str, tuple[float, float]]

Return the parameter ranges sensor actually accepts.

The schema carries the console-wide envelope on purpose — the same module serves every head — so the fitted sensor’s narrower limits belong here and are applied at connect.

Parameters:

sensor (str | None) – Sensor name as reported by SYST:SENS:IDN?.

Returns:

{parameter: (min, max)}, empty when nothing is recorded for this head. An unrecorded sensor keeps the console envelope rather than inheriting another head’s limits.

Return type:

dict[str, tuple[float, float]]

plesty.pm100d.sensors.known_sensors() list[str]

Return the sensor names with a recorded entry.

Return type:

list[str]

plesty.pm100d.sensors.read_sensor_name(device: Any) str | None

Read the fitted sensor’s name from a connected device.

Parameters:

device (Any) – A connected PM100D device.

Returns:

The sensor name (the first field of SYST:SENS:IDN?), or None when it cannot be read — in which case callers should fall back to the conservative default rather than assume the sensor is capable.

Return type:

str | None