stoner_measurement.instruments.xray.legacy_diffractometer.LegacyXrayDiffractometer

class stoner_measurement.instruments.xray.legacy_diffractometer.LegacyXrayDiffractometer(transport, protocol: ~stoner_measurement.instruments.xray.protocol.LegacyXrayProtocol | None = None, *, mechanics: ~stoner_measurement.instruments.xray_diffractometer.DiffractometerMechanics | None = None, pre_read_delay_s: float = 0.01, retry_snapshot_once: bool = True, sleep: ~collections.abc.Callable[[float], None] = <built-in function sleep>, monotonic: ~collections.abc.Callable[[], float] = <built-in function monotonic>)[source]

Bases: XrayDiffractometer

Control the two host-stepped axes and scalar counter over a byte stream.

DISPLAY_NAME = 'Legacy X-ray Diffractometer'
confirm_identity() → str[source]

Confirm communication by decoding a snapshot (there is no ID query).

count(duration_s: float, *, cancel: Event | Callable[[], bool] | None = None) → CountResult[source]

Perform a host-timed count and guarantee the stop opcode.

disable_theta() → None[source]

Send the controller’s theta motor-disable operation.

disable_two_theta() → None[source]

Send the controller’s 2-theta motor-disable operation.

identify() → str[source]

Return the instrument identification string (*IDN?).

Sends the standard IEEE 488.2 *IDN? query and returns the response. Instruments that do not support *IDN? should override this method.

Returns:

Identification string returned by the instrument.

Return type:

(str)

Raises:

ConnectionError – If the transport is not open.

Examples

>>> from stoner_measurement.instruments.transport import NullTransport
>>> from stoner_measurement.instruments.protocol import ScpiProtocol
>>> from stoner_measurement.instruments.base_instrument import BaseInstrument
>>> t = NullTransport(responses=[b"ACME,Model1,SN001,v1.0\n"])
>>> instr = BaseInstrument(t, ScpiProtocol())
>>> instr.connect()
>>> instr.identify()
'ACME,Model1,SN001,v1.0'
>>> instr.disconnect()
move_coupled(theta_deg: float, speed_deg_per_min: float, *, two_theta_offset_deg: float = 0.0, cancel: Event | Callable[[], bool] | None = None) → XraySnapshot[source]

Move both axes to 2theta = 2 * theta + offset with interleaved steps.

move_theta(angle_deg: float, speed_deg_per_min: float, *, cancel: Event | Callable[[], bool] | None = None, backlash: bool = True) → XraySnapshot[source]

Move theta to an absolute angular coordinate.

move_two_theta(angle_deg: float, speed_deg_per_min: float, *, cancel: Event | Callable[[], bool] | None = None, backlash: bool = True) → XraySnapshot[source]

Move 2-theta to an absolute angular coordinate.

read_snapshot() → XraySnapshot[source]

Read one atomic snapshot, with one flush-and-retry on framing failure.

reset_limit_latch() → None[source]

Reset the controller’s hardware limit latch.

start_count() → None[source]

Start the scalar detector counter.

step_theta(direction: AxisDirection, steps: int = 1, *, interval_s: float = 0.01, cancel: Event | Callable[[], bool] | None = None) → XraySnapshot[source]

Step the theta axis by an integer number of hardware steps.

step_two_theta(direction: AxisDirection, steps: int = 1, *, interval_s: float = 0.01, cancel: Event | Callable[[], bool] | None = None) → XraySnapshot[source]

Step the 2-theta axis by an integer number of hardware steps.

stop_count() → None[source]

Stop the scalar detector counter.

zero_theta() → None[source]

Change the hardware theta datum to zero.

zero_two_theta() → None[source]

Change the hardware 2-theta datum to zero.