American Magnetics Inc Drivers

Exceptions:

Classes:

AMI430SwitchHeater(parent, **kwargs)

AMIModel430(name, address[, reset, ...])

Driver for the American Magnetics Model 430 magnet power supply programmer.

AMIModel4303D(name, instrument_x, ...)

Driver for controlling three American Magnetics Model 430 magnet power supplies simultaneously for setting magnetic field vectors.

exception qcodes.instrument_drivers.american_magnetics.AMI430Exception[source]

Bases: Exception

class qcodes.instrument_drivers.american_magnetics.AMI430SwitchHeater(parent: AMIModel430, **kwargs: Unpack[InstrumentBaseKWArgs])[source]

Bases: InstrumentChannel

Attributes:

enabled

Parameter enabled

state

Parameter state.

in_persistent_mode

Parameter in_persistent_mode

current

Parameter current

heat_time

Parameter heat_time

cool_time

Parameter cool_time

Methods:

enabled: Parameter = self.add_parameter( "enabled", label="Switch Heater Enabled", get_cmd=self._check_enabled, set_cmd=lambda x: (self._enable() if x else self._disable()), vals=Bool(), )

Parameter enabled

state: Parameter = self.add_parameter( "state", label="Switch Heater On", get_cmd=self._check_state, set_cmd=lambda x: (self._on() if x else self._off()), vals=Bool(), )

Parameter state. Always False is the switch heater is not enabled

in_persistent_mode: Parameter = self.add_parameter( "in_persistent_mode", label="Persistent Mode", get_cmd="PERS?", val_mapping={True: 1, False: 0}, )

Parameter in_persistent_mode

current: Parameter = self.add_parameter( "current", label="Switch Heater Current", unit="mA", get_cmd="PS:CURR?", get_parser=float, set_cmd="CONF:PS:CURR {}", vals=Numbers(0, 125), )

Parameter current

heat_time: Parameter = self.add_parameter( "heat_time", label="Heating Time", unit="s", get_cmd="PS:HTIME?", get_parser=int, set_cmd="CONF:PS:HTIME {}", vals=Ints(5, 120), )

Parameter heat_time

cool_time: Parameter = self.add_parameter( "cool_time", label="Cooling Time", unit="s", get_cmd="PS:CTIME?", get_parser=int, set_cmd="CONF:PS:CTIME {}", vals=Ints(5, 3600), )

Parameter cool_time

disable() None[source]
enable() None[source]
check_enabled() bool[source]
on() None[source]
off() None[source]
check_state() bool[source]
parameters: dict[str, ParameterBase] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: dict[str, InstrumentModule | ChannelTuple] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

instrument_modules: dict[str, InstrumentModule] = {}

All the InstrumentModule of this instrument Usually populated via add_submodule().

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
metadata: dict[str, Any] = {}
exception qcodes.instrument_drivers.american_magnetics.AMI430Warning[source]

Bases: UserWarning

class qcodes.instrument_drivers.american_magnetics.AMIModel430(name: str, address: str, reset: bool = False, current_ramp_limit: float | None = None, **kwargs: Unpack[VisaInstrumentKWArgs])[source]

Bases: VisaInstrument

Driver for the American Magnetics Model 430 magnet power supply programmer.

This class controls a single magnet power supply. In order to use two or three magnets simultaneously to set field vectors, first instantiate the individual magnets using this class and then pass them as arguments to the AMIModel4303D virtual instrument classes.

Parameters:
  • name – a name for the instrument

  • address – VISA formatted address of the power supply programmer. Of the form TCPIP[board]::host address::port::SOCKET e.g. TCPIP0::192.168.0.1::7800::SOCKET

  • reset – Should the reset method be called on the instrument at init time

  • current_ramp_limit – A current ramp limit, in units of A/s

  • **kwargs – Additional kwargs are passed to the base class

Attributes:

default_terminator

The default terminator to use if the terminator is not specified when creating the instrument.

ramp_rate_units

Parameter ramp_rate_units

field_units

Parameter field_units

current_ramp_limit

Parameter current_ramp_limit

field_ramp_limit

Parameter field_ramp_limit

coil_constant

Parameter coil_constant

current_limit

Parameter current_limit

field_limit

Parameter field_limit

field

Parameter field

ramp_rate

Parameter ramp_rate

setpoint

Parameter setpoint

is_quenched

Parameter is_quenched

ramping_state

Parameter ramping_state

ramping_state_check_interval

Parameter ramping_state_check_interval

Methods:

set_field(value, *[, block, ...])

Ramp to a certain field

wait_while_ramping()

write_raw(cmd)

Low-level interface to visa_handle.write.

ask_raw(cmd)

Low-level interface to visa_handle.ask.

default_terminator: str | None = '\r\n'

The default terminator to use if the terminator is not specified when creating the instrument. None means use the default terminator from PyVisa.

ramp_rate_units: Parameter = self.add_parameter( "ramp_rate_units", get_cmd="RAMP:RATE:UNITS?", set_cmd=(lambda units: self._update_units(ramp_rate_units=units)), val_mapping={"seconds": 0, "minutes": 1}, )

Parameter ramp_rate_units

field_units: Parameter = self.add_parameter( "field_units", get_cmd="FIELD:UNITS?", set_cmd=(lambda units: self._update_units(field_units=units)), val_mapping={"kilogauss": 0, "tesla": 1}, )

Parameter field_units

current_ramp_limit: Parameter = self.add_parameter( "current_ramp_limit", get_cmd=lambda: self._current_ramp_limit, set_cmd=self._update_ramp_rate_limit, unit="A/s", )

Parameter current_ramp_limit

field_ramp_limit: Parameter = self.add_parameter( "field_ramp_limit", get_cmd=lambda: self.current_ramp_limit(), set_cmd=lambda x: self.current_ramp_limit(x), scale=1 / float(self.ask("COIL?")), unit="T/s", )

Parameter field_ramp_limit

coil_constant: Parameter = self.add_parameter( "coil_constant", get_cmd=self._update_coil_constant, set_cmd=self._update_coil_constant, vals=Numbers(0.001, 999.99999), )

Parameter coil_constant

current_limit: Parameter = self.add_parameter( "current_limit", unit="A", set_cmd="CONF:CURR:LIMIT {}", get_cmd="CURR:LIMIT?", get_parser=float, vals=Numbers(0, 80), )

Parameter current_limit

field_limit: Parameter = self.add_parameter( "field_limit", set_cmd=self.current_limit.set, get_cmd=self.current_limit.get, scale=1 / float(self.ask("COIL?")), )

Parameter field_limit

field: Parameter = self.add_parameter( "field", get_cmd="FIELD:MAG?", get_parser=float, set_cmd=self.set_field )

Parameter field

ramp_rate: Parameter = self.add_parameter( "ramp_rate", get_cmd=self._get_ramp_rate, set_cmd=self._set_ramp_rate )

Parameter ramp_rate

setpoint: Parameter = self.add_parameter( "setpoint", get_cmd="FIELD:TARG?", get_parser=float )

Parameter setpoint

is_quenched: Parameter = self.add_parameter( "is_quenched", get_cmd="QU?", val_mapping={True: 1, False: 0} )

Parameter is_quenched

ramping_state: Parameter = self.add_parameter( "ramping_state", get_cmd="STATE?", get_parser=int, val_mapping={ "ramping": 1, "holding": 2, "paused": 3, "manual up": 4, "manual down": 5, "zeroing current": 6, "quench detected": 7, "at zero current": 8, "heating switch": 9, "cooling switch": 10, }, )

Parameter ramping_state

ramping_state_check_interval: Parameter = self.add_parameter( "ramping_state_check_interval", initial_value=0.05, unit="s", vals=Numbers(0, 10), set_cmd=None, )

Parameter ramping_state_check_interval

set_field(value: float, *, block: bool = True, perform_safety_check: bool = True) None[source]

Ramp to a certain field

Parameters:
  • value – Value to ramp to.

  • block – Whether to wait unit the field has finished setting

  • perform_safety_check – Whether to set the field via a parent driver (if present), which might perform additional safety checks.

wait_while_ramping() str[source]
write_raw(cmd: str) None[source]

Low-level interface to visa_handle.write.

Parameters:

cmd – The command to send to the instrument.

ask_raw(cmd: str) str[source]

Low-level interface to visa_handle.ask.

Parameters:

cmd – The command to send to the instrument.

Returns:

The instrument’s response.

Return type:

str

visabackend: str = visabackend
visa_handle: pyvisa.resources.MessageBasedResource = visa_handle

The VISA resource used by this instrument.

visalib: str | None = visalib
parameters: dict[str, ParameterBase] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: dict[str, InstrumentModule | ChannelTuple] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

instrument_modules: dict[str, InstrumentModule] = {}

All the InstrumentModule of this instrument Usually populated via add_submodule().

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
metadata: dict[str, Any] = {}
class qcodes.instrument_drivers.american_magnetics.AMIModel4303D(name: str, instrument_x: AMIModel430 | str, instrument_y: AMIModel430 | str, instrument_z: AMIModel430 | str, field_limit: float | Iterable[CartesianFieldLimitFunction], **kwargs: Unpack[InstrumentBaseKWArgs])[source]

Bases: Instrument

Driver for controlling three American Magnetics Model 430 magnet power supplies simultaneously for setting magnetic field vectors.

The individual magnet power supplies can be passed in as either instances of AMIModel430 driver or as names of existing AMIModel430 instances. In the latter case, the instances will be found via the passed names.

Parameters:
  • name – a name for the instrument

  • instrument_x – AMIModel430 instance or a names of existing AMIModel430 instance for controlling the X axis of magnetic field

  • instrument_y – AMIModel430 instance or a names of existing AMIModel430 instance for controlling the Y axis of magnetic field

  • instrument_z – AMIModel430 instance or a names of existing AMIModel430 instance for controlling the Z axis of magnetic field

  • field_limit – a number for maximum allows magnetic field or an iterable of callable field limit functions that define region(s) of allowed values in 3D magnetic field space

  • **kwargs – kwargs are forwarded to base class.

Attributes:

cartesian_measured

Parameter cartesian_measured

x_measured

Parameter x_measured

y_measured

Parameter y_measured

z_measured

Parameter z_measured

spherical_measured

Parameter spherical_measured

phi_measured

Parameter phi_measured

theta_measured

Parameter theta_measured

field_measured

Parameter field_measured

cylindrical_measured

Parameter cylindrical_measured

rho_measured

Parameter rho_measured

cartesian

Parameter cartesian

x

Parameter x

y

Parameter y

z

Parameter z

spherical

Parameter spherical

phi

Parameter phi

theta

Parameter theta

field

Parameter field

cylindrical

Parameter cylindrical

rho

Parameter rho

block_during_ramp

Parameter block_during_ramp

vector_ramp_rate

Ramp rate along a line (vector) in 3D field space

Methods:

get_idn()

Parse a standard VISA *IDN? response into an ID dict.

ramp_simultaneously(setpoint, duration)

Ramp all axes simultaneously to the given setpoint and in the given time

calculate_axes_ramp_rates_for(start, ...)

Given starting and setpoint fields and expected ramp time calculates required ramp rates for x, y, z axes (in this order) where axes are ramped simultaneously.

calculate_vector_ramp_rate_from_duration(...)

calculate_axes_ramp_rates_from_vector_ramp_rate(...)

wait_while_all_axes_ramping()

Wait and blocks as long as any magnet axis is ramping.

any_axis_is_ramping()

Returns True if any of the magnet axes are currently ramping, or False if none of the axes are ramping.

pause()

Pause all magnet axes.

cartesian_measured: Parameter = self.add_parameter( "cartesian_measured", get_cmd=partial(self._get_measured, "x", "y", "z"), unit="T", )

Parameter cartesian_measured

x_measured: Parameter = self.add_parameter( "x_measured", get_cmd=partial(self._get_measured, "x"), unit="T" )

Parameter x_measured

y_measured: Parameter = self.add_parameter( "y_measured", get_cmd=partial(self._get_measured, "y"), unit="T" )

Parameter y_measured

z_measured: Parameter = self.add_parameter( "z_measured", get_cmd=partial(self._get_measured, "z"), unit="T" )

Parameter z_measured

spherical_measured: Parameter = self.add_parameter( "spherical_measured", get_cmd=partial(self._get_measured, "r", "theta", "phi"), unit="T", )

Parameter spherical_measured

phi_measured: Parameter = self.add_parameter( "phi_measured", get_cmd=partial(self._get_measured, "phi"), unit="deg" )

Parameter phi_measured

theta_measured: Parameter = self.add_parameter( "theta_measured", get_cmd=partial(self._get_measured, "theta"), unit="deg" )

Parameter theta_measured

field_measured: Parameter = self.add_parameter( "field_measured", get_cmd=partial(self._get_measured, "r"), unit="T" )

Parameter field_measured

cylindrical_measured: Parameter = self.add_parameter( "cylindrical_measured", get_cmd=partial(self._get_measured, "rho", "phi", "z"), unit="T", )

Parameter cylindrical_measured

rho_measured: Parameter = self.add_parameter( "rho_measured", get_cmd=partial(self._get_measured, "rho"), unit="T" )

Parameter rho_measured

cartesian: Parameter = self.add_parameter( "cartesian", get_cmd=partial(self._get_setpoints, ("x", "y", "z")), set_cmd=partial(self._set_setpoints, ("x", "y", "z")), unit="T", vals=Anything(), )

Parameter cartesian

x: Parameter = self.add_parameter( "x", get_cmd=partial(self._get_setpoints, ("x",)), set_cmd=partial(self._set_setpoints, ("x",)), unit="T", vals=Numbers(), )

Parameter x

y: Parameter = self.add_parameter( "y", get_cmd=partial(self._get_setpoints, ("y",)), set_cmd=partial(self._set_setpoints, ("y",)), unit="T", vals=Numbers(), )

Parameter y

parameters: dict[str, ParameterBase] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: dict[str, InstrumentModule | ChannelTuple] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

instrument_modules: dict[str, InstrumentModule] = {}

All the InstrumentModule of this instrument Usually populated via add_submodule().

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
metadata: dict[str, Any] = {}
z: Parameter = self.add_parameter( "z", get_cmd=partial(self._get_setpoints, ("z",)), set_cmd=partial(self._set_setpoints, ("z",)), unit="T", vals=Numbers(), )

Parameter z

spherical: Parameter = self.add_parameter( "spherical", get_cmd=partial(self._get_setpoints, ("r", "theta", "phi")), set_cmd=partial(self._set_setpoints, ("r", "theta", "phi")), unit="tuple?", vals=Anything(), )

Parameter spherical

phi: Parameter = self.add_parameter( "phi", get_cmd=partial(self._get_setpoints, ("phi",)), set_cmd=partial(self._set_setpoints, ("phi",)), unit="deg", vals=Numbers(), )

Parameter phi

theta: Parameter = self.add_parameter( "theta", get_cmd=partial(self._get_setpoints, ("theta",)), set_cmd=partial(self._set_setpoints, ("theta",)), unit="deg", vals=Numbers(), )

Parameter theta

field: Parameter = self.add_parameter( "field", get_cmd=partial(self._get_setpoints, ("r",)), set_cmd=partial(self._set_setpoints, ("r",)), unit="T", vals=Numbers(), )

Parameter field

cylindrical: Parameter = self.add_parameter( "cylindrical", get_cmd=partial(self._get_setpoints, ("rho", "phi", "z")), set_cmd=partial(self._set_setpoints, ("rho", "phi", "z")), unit="tuple?", vals=Anything(), )

Parameter cylindrical

rho: Parameter = self.add_parameter( "rho", get_cmd=partial(self._get_setpoints, ("rho",)), set_cmd=partial(self._set_setpoints, ("rho",)), unit="T", vals=Numbers(), )

Parameter rho

block_during_ramp: Parameter = self.add_parameter( "block_during_ramp", set_cmd=None, initial_value=True, unit="", vals=Bool() )

Parameter block_during_ramp

vector_ramp_rate = Parameter( name="vector_ramp_rate", instrument=self, unit="T/s", vals=Numbers(min_value=0.0), set_cmd=None, get_cmd=None, set_parser=self._set_vector_ramp_rate_units, docstring="Ramp rate along a line (vector) in 3D space. Only active" " if `ramp_mode='simultaneous'`.", )

Ramp rate along a line (vector) in 3D field space

get_idn() dict[str, str | None][source]

Parse a standard VISA *IDN? response into an ID dict.

Even though this is the VISA standard, it applies to various other types as well, such as IPInstruments, so it is included here in the Instrument base class.

Override this if your instrument does not support *IDN? or returns a nonstandard IDN string. This string is supposed to be a comma-separated list of vendor, model, serial, and firmware, but semicolon and colon are also common separators so we accept them here as well.

Returns:

A dict containing vendor, model, serial, and firmware.

ramp_simultaneously(setpoint: FieldVector, duration: float) None[source]

Ramp all axes simultaneously to the given setpoint and in the given time

The method calculates and sets the required ramp rates per magnet axis, and then initiates a ramp simultaneously on all the axes. The trajectory of the tip of the magnetic field vector is thus linear in 3D space, from the current field value to the setpoint.

If block_during_ramp parameter is True, the method will block until all axes finished ramping.

If block_during_ramp parameter is True, the ramp rates of individual magnet axes will be restored after the end of the ramp to their original values before the call of this method. If block_during_ramp parameter is False, call the wait_while_all_axes_ramping method when needed to restore the ramp rates of the individual magnet axes.

It is required for all axis instruments to have the same units for ramp rate and field, otherwise an exception is raised. The given setpoint and time are assumed to be in those common units.

Parameters:
  • setpointFieldVector setpoint

  • duration – time in which the setpoint field has to be reached on all axes

static calculate_axes_ramp_rates_for(start: FieldVector, setpoint: FieldVector, duration: float) tuple[float, float, float][source]

Given starting and setpoint fields and expected ramp time calculates required ramp rates for x, y, z axes (in this order) where axes are ramped simultaneously.

static calculate_vector_ramp_rate_from_duration(start: FieldVector, setpoint: FieldVector, duration: float) float[source]
static calculate_axes_ramp_rates_from_vector_ramp_rate(start: FieldVector, setpoint: FieldVector, vector_ramp_rate: float) tuple[float, float, float][source]
wait_while_all_axes_ramping() None[source]

Wait and blocks as long as any magnet axis is ramping. After the ramping is finished, also resets the individual ramp rates of the magnet axes if those were made to be restored, e.g. by using simultaneous ramp mode.

any_axis_is_ramping() bool[source]

Returns True if any of the magnet axes are currently ramping, or False if none of the axes are ramping.

pause() None[source]

Pause all magnet axes.