stoner_measurement.instruments.thorlabs.hdr50.ThorlabsHDR50

class stoner_measurement.instruments.thorlabs.hdr50.ThorlabsHDR50(serial_number: str, *, motor_factory: Callable[[str], Any] | None = None)[source]

Bases: MotorController

Control an HDR50/BSC201 through direct Thorlabs APT.dll calls.

connect() → None[source]

Open the controller connection and verify identity.

disconnect() → None[source]

Close the transport connection to the instrument.

Examples

>>> from stoner_measurement.instruments.transport import NullTransport
>>> from stoner_measurement.instruments.protocol import ScpiProtocol
>>> from stoner_measurement.instruments.base_instrument import BaseInstrument
>>> instr = BaseInstrument(NullTransport(), ScpiProtocol())
>>> instr.connect()
>>> instr.disconnect()
>>> instr.is_connected
False
classmethod discover_controllers() → list[AptControllerInfo][source]

Return attached controllers visible through APT.dll.

get_position() → float[source]

Return current angular position in degrees.

get_target_position() → float | None[source]

Return the current target angle in degrees, if known.

has_reached_target_position(tolerance: float = 0.01) → bool[source]

Return True when current and target positions are within tolerance.

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()
property is_connected: bool

True if the underlying transport is currently open.

Returns:

Connection state of the transport.

Return type:

(bool)

Examples

>>> from stoner_measurement.instruments.transport import NullTransport
>>> from stoner_measurement.instruments.protocol import ScpiProtocol
>>> from stoner_measurement.instruments.base_instrument import BaseInstrument
>>> instr = BaseInstrument(NullTransport(), ScpiProtocol())
>>> instr.is_connected
False
is_moving() → bool[source]

Return True when the motor is moving.

move_home(direction: MotorMoveDirection = MotorMoveDirection.CLOCKWISE) → None[source]

Move to the configured home position.

move_relative(angle: float, direction: MotorMoveDirection = MotorMoveDirection.CLOCKWISE) → None[source]

Move by angle degrees in direction using the absolute move API.

move_to_angle(angle: float, direction: MotorMoveDirection = MotorMoveDirection.CLOCKWISE) → None[source]

Move to an absolute angle in degrees.

preferred_connection_transport = 'Kinesis USB'
property serial_number: str

Return the configured controller serial number.

set_acceleration(acceleration: float) → None[source]

Set travel acceleration in degrees per second squared.

set_home(angle: float = 0.0) → None[source]

Set the current position reference to a home angle.

set_velocity(velocity: float) → None[source]

Set travel velocity in degrees per second.

property status: MotorStatus

Return a consolidated motor status snapshot.