stoner_measurement.instruments.simulated.SimulatedMagnetController¶
- class stoner_measurement.instruments.simulated.SimulatedMagnetController(transport=None, protocol=None)[source]¶
Bases:
MagnetControllerSimple simulated superconducting magnet controller.
- abort_ramp() None[source]¶
Abort ramping immediately and hold the output at its current value.
- Raises:
ConnectionError – If the transport is not open.
- property current: float¶
Return the current output in amps.
- Returns:
Instantaneous output current in amps.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
- property field: float¶
Return the magnetic field output in tesla.
- Returns:
Estimated magnetic field in tesla derived from the output current and the configured magnet constant.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
- get_firmware_version() str[source]¶
Return the firmware version string.
- Returns:
Firmware version as reported by the device.
- Return type:
(str)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> mc.get_firmware_version() '1.0'
- get_model() str[source]¶
Return the instrument model identifier string.
- Returns:
Instrument model identifier as reported by the device.
- Return type:
(str)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> mc.get_model() 'TestMagnet'
- property heater: bool¶
Return the persistent switch heater state.
- Returns:
Truewhen the persistent switch heater is energised,Falsewhen it is off.- Return type:
(bool)
- Raises:
ConnectionError – If the transport is not open.
- heater_off() None[source]¶
De-energise the persistent switch heater.
- Raises:
ConnectionError – If the transport is not open.
- heater_on() None[source]¶
Energise the persistent switch heater.
- Raises:
ConnectionError – If the transport is not open.
- 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 limits: MagnetLimits¶
Return the configured operating limits.
- Returns:
Maximum permitted current, field, and ramp rate.
- Return type:
- Raises:
ConnectionError – If the transport is not open.
- property magnet_constant: float¶
Return the magnet constant in tesla per amp.
- Returns:
Field-to-current conversion factor in T A⁻¹.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
- pause_ramp() None[source]¶
Pause an active ramp, holding the output at its current value.
- Raises:
ConnectionError – If the transport is not open.
- ramp_to_current(current: float, *, wait: bool = False) None[source]¶
Set a new target current and begin ramping.
- Parameters:
current (float) – Desired target current in amps.
- Keyword Parameters:
wait (bool) – If
True, block until the target is reached. Defaults toFalse.- Raises:
ConnectionError – If the transport is not open.
ValueError – If current exceeds the configured maximum.
- ramp_to_field(field: float, *, wait: bool = False) None[source]¶
Set a new target field and begin ramping.
- Parameters:
field (float) – Desired target field in tesla.
- Keyword Parameters:
wait (bool) – If
True, block until the target is reached. Defaults toFalse.- Raises:
ConnectionError – If the transport is not open.
ValueError – If field exceeds the configured maximum.
- ramp_to_target() None[source]¶
Start ramping the output towards the currently programmed target.
- Raises:
ConnectionError – If the transport is not open.
- set_limits(limits: MagnetLimits) None[source]¶
Set operating limits for the controller.
- Parameters:
limits (MagnetLimits) – Maximum current, field, and ramp rate limits to apply.
- Raises:
ConnectionError – If the transport is not open.
- set_magnet_constant(tesla_per_amp: float) None[source]¶
Set the magnet constant used for field calculations.
- Parameters:
tesla_per_amp (float) – Field-to-current conversion factor in T A⁻¹.
- Raises:
ConnectionError – If the transport is not open.
ValueError – If tesla_per_amp is not positive.
- set_ramp_rate_current(rate: float) None[source]¶
Set the current ramp rate.
- Parameters:
rate (float) – Ramp rate in amps per minute.
- Raises:
ConnectionError – If the transport is not open.
ValueError – If rate exceeds the configured maximum or is negative.
- set_ramp_rate_field(rate: float) None[source]¶
Set the field ramp rate.
- Parameters:
rate (float) – Ramp rate in tesla per minute.
- Raises:
ConnectionError – If the transport is not open.
ValueError – If rate exceeds the configured maximum or is negative.
- set_target_current(current: float) None[source]¶
Set the target output current.
- Parameters:
current (float) – Desired target current in amps.
- Raises:
ConnectionError – If the transport is not open.
ValueError – If current exceeds the configured maximum.
- set_target_field(field: float) None[source]¶
Set the target magnetic field.
- Parameters:
field (float) – Desired target field in tesla.
- Raises:
ConnectionError – If the transport is not open.
ValueError – If field exceeds the configured maximum.
- property status: MagnetStatus¶
Return a consolidated status snapshot.
- Returns:
Current operational state, output readings, and heater status.
- Return type:
- Raises:
ConnectionError – If the transport is not open.
- property voltage: float¶
Return the output voltage in volts.
- Returns:
Instantaneous output voltage in volts.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.