stoner_measurement.instruments.oxford.mercury_ips.OxfordMercuryIPS¶
- class stoner_measurement.instruments.oxford.mercury_ips.OxfordMercuryIPS(transport: BaseTransport, protocol: BaseProtocol | None = None, *, device_uid: str = 'GRPZ')[source]¶
Bases:
MagnetController,MagnetSupplyDriver for an Oxford Instruments Mercury iPS magnet power supply.
The Mercury iPS uses a native text protocol, including over GPIB. Commands and queries follow the pattern:
READ:DEV:<uid>:PSU:SIG:<signal> SET:DEV:<uid>:PSU:SIG:<signal>:<value>
Responses carry a
STAT:DEV:<uid>:PSU:…prefix with the value appended after the final colon (e.g.STAT:DEV:PSU.M1:PSU:SIG:FLD:+1.23456T).All field values are in tesla and ramp rates in tesla per minute.
- Variables:
transport (BaseTransport) – Transport used for instrument I/O.
protocol (BaseProtocol) – Protocol used to format and parse instrument messages.
device_uid (str) – Mercury iPS device UID used in all
READ/SETcommands. Defaults to the single-axis group"GRPZ". Use the appropriate group UID for another axis; ACTN, STAT and SWHT are group settings.
Examples
>>> from stoner_measurement.instruments.oxford import OxfordMercuryIPS >>> from stoner_measurement.instruments.transport import NullTransport >>> t = NullTransport( ... responses=[b"IDN:OXFORD INSTRUMENTS:MERCURY iPS:12345:2.7.0\n"] * 2, ... ) >>> mps = OxfordMercuryIPS(transport=t) >>> mps.connect() >>> mps.identify() 'IDN:OXFORD INSTRUMENTS:MERCURY iPS:12345:2.7.0' >>> mps.disconnect()
- abort_ramp() None[source]¶
Abort an active ramp, holding the output at its current value.
Sends
SET:DEV:<uid>:PSU:ACTN:HOLDto immediately stop any active ramp. To ramp to zero instead, useramp_to_field()with a target of0.0.- Raises:
ConnectionError – If the transport is not open.
- property current: float¶
Return output current in amps.
- Returns:
Measured magnet supply current in amps.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
- property field: float¶
Return output field in tesla.
- Returns:
Measured magnetic field in tesla as reported by the instrument.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
- get_firmware_version() str[source]¶
Return the firmware version from the identity string.
- Returns:
Firmware field of the
*IDN?response (e.g."2.7.0"), or an empty string if not parseable.- Return type:
(str)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> mps.get_firmware_version() '2.7.0'
- get_model() str[source]¶
Return the model name from the identity string.
- Returns:
Model field of the native or comma-separated
*IDN?response, or an empty string if not parseable.- Return type:
(str)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> mps.get_model() 'Mercury iPS'
- go_to_zero() None[source]¶
Ramp the supply output to zero.
Sends
SET:DEV:<uid>:PSU:ACTN:RTOZto the instrument.
- property heater: bool¶
Return the persistent switch heater state.
- Returns:
Truewhen the switch heater is on,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.
Sends
SET:DEV:<uid>:PSU:SIG:SWHT:OFFto the instrument.- Raises:
ConnectionError – If the transport is not open.
- heater_on() None[source]¶
Energise the persistent switch heater.
Sends
SET:DEV:<uid>:PSU:SIG:SWHT:ONto the instrument.- Raises:
ConnectionError – If the transport is not open.
- hold() None[source]¶
Hold the present output without changing field.
Sends
SET:DEV:<uid>:PSU:ACTN:HOLDto the instrument.
- identify() str[source]¶
Return the instrument identity string.
- Returns:
Native identity string returned by
*IDN?, normallyIDN:OXFORD INSTRUMENTS:MERCURY iPS:<serial>:<firmware>.- Return type:
(str)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> mps.identify() 'Oxford Instruments,Mercury iPS,12345,2.7.0'
- property limits: MagnetLimits¶
Return the configured software operating limits.
- Returns:
Cached current/field/ramp limits set via
set_limits().- Return type:
- property magnet_constant: float¶
Return the software magnet constant in tesla per amp.
- Returns:
Field-to-current conversion factor in T A⁻¹ held by this driver instance.
- Return type:
(float)
- pause_ramp() None[source]¶
Pause an active ramp, holding the output at its current value.
Sends
SET:DEV:<uid>:PSU:ACTN:HOLDto the instrument.- Raises:
ConnectionError – If the transport is not open.
- property ramp_rate_current: float | None¶
Return the programmed current ramp rate in amps per minute.
- ramp_to_current(current: float, *, wait: bool = False) None[source]¶
Programme a current target and begin ramping.
- Parameters:
current (float) – Target current in amps.
- Keyword Parameters:
wait (bool) – When
True, block until the ramp completes. Defaults toFalse.- Raises:
ConnectionError – If the transport is not open.
- ramp_to_field(field: float, *, wait: bool = False) None[source]¶
Programme a field target and begin ramping.
- Parameters:
field (float) – Target field in tesla.
- Keyword Parameters:
wait (bool) – When
True, block until the ramp completes. Defaults toFalse.- Raises:
ConnectionError – If the transport is not open.
- ramp_to_target() None[source]¶
Start ramping to the currently programmed field setpoint.
Sends
SET:DEV:<uid>:PSU:ACTN:RTOSto the instrument.- Raises:
ConnectionError – If the transport is not open.
- return_to_local() None[source]¶
Leave local/remote selection to the Mercury front panel.
The native protocol has no PSU:CLOC command. The driver never locks the front panel; select Local there as described in manual section 9.5.
- set_limits(limits: MagnetLimits) None[source]¶
Set software operating limits for this driver instance.
- Parameters:
limits (MagnetLimits) – Limit configuration to cache for runtime checks.
- set_magnet_constant(tesla_per_amp: float) None[source]¶
Set the software magnet constant used for current/field conversions.
- Parameters:
tesla_per_amp (float) – Field-to-current conversion factor in T A⁻¹.
- Raises:
ValueError – If tesla_per_amp is not positive.
- set_ramp_rate_current(rate: float) None[source]¶
Set the current ramp rate.
Converts rate in amps per minute to tesla per minute using the configured magnet constant, then calls
set_ramp_rate_field().- Parameters:
rate (float) – Ramp rate in amps per minute.
- Raises:
ConnectionError – If the transport is not open.
ValueError – If rate 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 is negative.
- set_target_current(current: float) None[source]¶
Set the target output current.
Converts current to a field setpoint using the configured magnet constant and sends a
SET:DEV:<uid>:PSU:SIG:FSETcommand.- Parameters:
current (float) – Desired target current in amps.
- Raises:
ConnectionError – If the transport is not open.
- 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.
- property status: MagnetStatus¶
Return one magnet snapshot under the shared instrument lock.
- property voltage: float¶
Return output voltage in volts.
- Returns:
Measured output voltage in volts.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
- write(command: str, slow: int | None = None) None[source]¶
Send a native SET and consume its matching acknowledgement.
- Parameters:
command (str) – Complete native SET command without terminator.
- Keyword Parameters:
slow (int | None) – Optional transport delay in milliseconds.
- Raises:
ValueError – The command is not a native SET.
InstrumentError – The reply rejects or does not acknowledge the SET.