qcodes_contrib_drivers.drivers.StanfordResearchSystems package

Submodules

qcodes_contrib_drivers.drivers.StanfordResearchSystems.CS580 module

QCoDeS-Driver for Stanford Research Systems CS580 current source: https://www.thinksrs.com/products/cs580.html

Authors:

Julien Barrier, <julien@julienbarrier.eu>

class qcodes_contrib_drivers.drivers.StanfordResearchSystems.CS580.CS580(*args: Any, **kwargs: Any)[source]

Bases: VisaInstrument

Class to represent an SRS CS580 current source

status: beta-version

Parameters:
  • name (str) – name for the instrument

  • address (str) – Visa resource name to connect

  • terminator (str) – Visa terminator

get_idn() → Dict[str, str | None][source]

Return the Instrument Identifier Message

get_overload() → str[source]

Reads the current avlue of the signal overload status.

reset() → None[source]

Reset the CS580 to its default configuration

qcodes_contrib_drivers.drivers.StanfordResearchSystems.DG645 module

class qcodes_contrib_drivers.drivers.StanfordResearchSystems.DG645.DG645(*args: Any, **kwargs: Any)[source]

Bases: VisaInstrument

Qcodes driver for SRS DG645 digital delay generator.

local() → None[source]

Go to local.

remote() → None[source]

Go to remote.

reset() → None[source]

Reset instrument.

save_settings(location: int) → None[source]

Save instrument settings to given location.

Parameters:

location – Location to which to save the settings (in [1..9]).

self_calibrate() → None[source]

Run auto-calibration routine.

self_test() → None[source]

Run self-test routine.

trigger() → None[source]

Initiates a single trigger if instrument is in single shot mode.

wait() → None[source]

Wait for all prior commands to execute before continuing.

CHANNEL_MAPPING = {'A': 2, 'B': 3, 'C': 4, 'D': 5, 'E': 6, 'F': 7, 'G': 8, 'H': 9, 'T0': 0, 'T1': 1}
DISPLAY_MAPPING = {'advanced_trig_enable': 4, 'burst_T0_config': 14, 'burst_count': 9, 'burst_delay': 8, 'burst_mode': 7, 'burst_period': 10, 'channel_delay': 11, 'channel_output_levels': 12, 'channel_output_polarity': 13, 'prescale_config': 6, 'trig_holdoff': 5, 'trig_line': 3, 'trig_rate': 0, 'trig_single_shot': 2, 'trig_thresh': 1}
OUTPUT_MAPPING = {'AB': 1, 'CD': 2, 'EF': 3, 'GH': 4, 'T0': 0}
POLARITY_MAPPING = {'+': 1, '-': 0}
PRESCALE_MAPPING = {'AB': 1, 'CD': 2, 'EF': 3, 'GH': 4, 'trig': 0}
TRIGGER_MAPPING = {'ext_falling': 2, 'ext_rising': 1, 'internal': 0, 'line': 6, 'single': 5, 'single_ext_falling': 4, 'single_ext_rising': 3}

qcodes_contrib_drivers.drivers.StanfordResearchSystems.SIM900 module

class qcodes_contrib_drivers.drivers.StanfordResearchSystems.SIM900.SIM900(*args: Any, **kwargs: Any)[source]

Bases: VisaInstrument

Stanford Research Systems SIM900 mainframe.

Modules communicate through the mainframe using packet-mode commands, without switching the host connection into transparent mode. The driver expects newline-terminated module responses and exclusive use of the port buffers. Module streaming must be stopped before issuing queries.

Parameters:
  • name – Instrument name.

  • address – VISA resource address.

  • query_delay – Seconds between polls of a module’s input buffer.

  • **kwargs – Forwarded to qcodes.instrument.VisaInstrument. For a serial connection, configure the VISA handle’s baud rate to match the mainframe if it differs from the power-on default of 9600 baud.

ask_port(port: int, cmd: str) → str[source]

Flush stale input, send a query and read a complete module response.

Uses the mainframe’s timeout (seconds) while waiting for the module. A timeout raises TimeoutError, including any partial response.

flush(port: int | None = None) → None[source]

Flush input buffers for one port, or all ports if omitted.

in_waiting(port: int) → int[source]

Return the number of bytes waiting in a module’s input buffer.

read_port(port: int, nbytes: int | None = None) → str[source]

Read bytes already available from a module, without stripping terminators.

If omitted, nbytes is obtained from the input buffer count. An empty buffer returns an empty string. An explicit count must not exceed the available bytes: the mainframe rejects such RAWN queries.

scan_ports() → list[str | None][source]

Return ID strings for ports 1 through 8, or None for unresponsive ports.

Each module is given query_delay seconds to start responding. Input buffers are flushed before scanning; do not scan during streaming.

write_port(port: int, cmd: str) → None[source]

Send a command to a module in port 1 through 8.

default_terminator: str | None = '\n'

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

default_timeout: float | None = 4

The default timeout in seconds if the timeout is not specified when creating the instrument. None means no timeout e.g. wait forever.

class qcodes_contrib_drivers.drivers.StanfordResearchSystems.SIM900.SIM900Module(parent: SIM900, name: str, port: int, **kwargs: Unpack[InstrumentBaseKWArgs])[source]

Bases: InstrumentChannel[SIM900]

Base class for a module connected to a SIM900 port.

Register the instance with parent.add_submodule(name, module) to include its parameters in station snapshots.

Parameters:
ask(cmd: str) → str[source]

Query this module’s port.

write(cmd: str) → None[source]

Write to this module’s port.

IDN: Parameter[str, Self] = self.add_parameter( "IDN", get_cmd="*IDN?", set_cmd=False )

The module identification string, not the mainframe identity.

qcodes_contrib_drivers.drivers.StanfordResearchSystems.SIM928 module

class qcodes_contrib_drivers.drivers.StanfordResearchSystems.SIM928.SIM928(*args: Any, **kwargs: Any)[source]

Bases: VisaInstrument

A driver for Stanford Research Systems SIM 928 DC source modules installed in a SIM900 mainframe.

Parameters:
  • name (str) – An identifier for this instrument, particularly for attaching it to a Station.

  • address (str) – The visa resource name to use to connect.

  • slot_names (Dict[int]) – An dictionary that optionally maps slot numbers to user-defined module names. Default {}.

  • timeout (int, float) – Seconds to allow for responses. Default 5.

  • metadata (Optional[Dict]) – Additional static metadata to add to this instrument’s JSON snapshot.

static byte_to_bits(x)[source]

Convert an integer to a list of bits

Parameters:

x (int) – The number to convert.

Returns:

A list of the lowest 8 bits of x where True represents 1 and False 0.

Return type:

list[bool]

ask_module(i, cmd)[source]

Write a command string to a module and return a response.

Parameters:
  • i (int, str) – Slot number or module name (as in slot_names) of the module to ask from.

  • cmd (str) – The VISA query string.

Returns:

The response string from the module.

check_module_errors(i, raiseexc=True)[source]

Check if any errors have occurred on module i and clear the status registers.

Parameters:
  • i (int, str) – Slot number or module name (as in slot_names) of the module to check the error of.

  • raiseexc (bool) – If true, raises an exception if any errors have occurred. Default True.

Returns:

A list of strings with the error messages that have occurred.

Return type:

list[str]

find_modules()[source]

Query the SIM900 mainframe for which slots have a SIM928 module present.

Returns:

A list of slot numbers where a SIM928 module is present (starting

from 1)

get_module_idn(i)[source]

Get the vendor, model, serial number and firmware version of a module.

Parameters:

i (int, str) – Slot number or module name (as in slot_names) of the module whose id is returned.

Returns:

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

get_module_status(i)[source]

Gets and clears the status bytes corresponding to the registers ESR, CESR and OVSR of module i.

Parameters:

i (int, str) – Slot number or module name (as in slot_names) of the module to get the status of.

Returns:

The bytes corresponding to standard event, communication error and overload statuses of module i

Return type:

int, int, int

get_voltage(i)[source]

Get the output voltage of a module.

Parameters:

i (int, str) – Slot number or module name (as in slot_names) of the module to get the voltage of.

Returns:

The current voltage of module i as a float.

reset_module(i)[source]

Sends the SIM Reset signal to module i.

Causes a break signal (MARK level) to be asserted for 100 milliseconds to module i. Upon receiving the break signal the modul will flush its internal input buffer, reset its command parser, and default to 9600 baud communications.

Parameters:

i (int, str) – Slot number or module name (as in slot_names) of the module to reset.

set_smooth(voltagedict, equitime=False)[source]

Set the voltages as specified in voltagedict` smoothly, by changing the output on each module at a rate ``volt_#_step/smooth_timestep.

Parameters:
  • voltagedict (Dict[float]) – A dictionary where keys are module slot numbers or names and values are the desired output voltages.

  • equitime (bool) – If True, uses smaller step sizes for some of the modules so that all modules reach the desired value at the same time.

set_voltage(i, voltage)[source]

Set the output voltage of a module.

Parameters:
  • i (int, str) – Slot number or module name (as in slot_names) of the module to set the voltage of.

  • voltage (float) – The value to set the voltage to.

write_module(i, cmd)[source]

Write a command string to a module with NO response expected.

Parameters:
  • i (int, str) – Slot number or module name (as in slot_names) of the module to write to.

  • cmd (str) – The VISA command string.

qcodes_contrib_drivers.drivers.StanfordResearchSystems.SIM960 module

class qcodes_contrib_drivers.drivers.StanfordResearchSystems.SIM960.SIM960(parent: SIM900, name: str, port: int, **kwargs: Unpack[InstrumentBaseKWArgs])[source]

Bases: SIM900Module

Stanford Research Systems SIM960 analog PID controller in a SIM900 mainframe.

The SIM960 is a double-width module. Use the port to which its connector is attached, not the adjacent slot covered by its panel.

Construction sets numeric response tokens and CRLF response termination but does not change any PID settings or enable the output.

Parameters:
  • parent – SIM900 mainframe.

  • name – Submodule name.

  • port – Mainframe port to which the module is connected.

  • **kwargs – Forwarded to SIM900Module.

start_ramping(enable: bool) → None[source]

Continue (True) or pause (False) an active setpoint ramp.

A pending ramp can only be started using the front-panel Ramp Start/Stop button; this command cannot initiate it.

derivative: Parameter[float, Self] = self.add_parameter( "derivative", label="Derivative gain", unit="s", get_cmd="DERV?", set_cmd="DERV {:.2g}", get_parser=float, vals=Numbers(1e-6, 10), )

Derivative gain; does not enable derivative action.

derivative_enable: Parameter[bool, Self] = self.add_parameter( "derivative_enable", get_cmd="DCTL?", set_cmd="DCTL {}", val_mapping={False: 0, True: 1}, )

Enable derivative action.

display: Parameter[str, Self] = self.add_parameter( "display", get_cmd="DISP?", set_cmd="DISP {}", val_mapping={ "gain": 0, "integral": 1, "derivative": 2, "offset": 3, "ramp_rate": 4, "setpoint": 5, "manual_output": 6, "output_limit_upper": 7, "output_limit_lower": 8, "setpoint_monitor": 9, "measure_monitor": 10, "error_monitor": 11, "output_monitor": 12, }, )

Select the front-panel display field.

error_monitor: Parameter[float, Self] = self.add_parameter( "error_monitor", unit="V", get_cmd="EMON?", set_cmd=False, get_parser=float, )

Single measurement of the proportional-amplified error.

gain: Parameter[float, Self] = self.add_parameter( "gain", label="Proportional gain", unit="V/V", get_cmd="GAIN?", set_cmd="GAIN {:.2g}", get_parser=float, vals=MultiType(Numbers(-1000, -0.1), Numbers(0.1, 1000)), )

Signed proportional gain. Setting gain also changes polarity.

integral: Parameter[float, Self] = self.add_parameter( "integral", label="Integral gain", unit="1/s", get_cmd="INTG?", set_cmd="INTG {:.2g}", get_parser=float, vals=Numbers(0.01, 500000), )

Integral gain; does not enable integral action.

integral_enable: Parameter[bool, Self] = self.add_parameter( "integral_enable", get_cmd="ICTL?", set_cmd="ICTL {}", val_mapping={False: 0, True: 1}, )

Enable integral action.

manual_output: Parameter[float, Self] = self.add_parameter( "manual_output", unit="V", get_cmd="MOUT?", set_cmd="MOUT {:.3f}", get_parser=float, vals=Numbers(-10, 10), )

Manual output voltage; does not change output mode.

measure_monitor: Parameter[float, Self] = self.add_parameter( "measure_monitor", unit="V", get_cmd="MMON?", set_cmd=False, get_parser=float, )

Single measurement of the Measure input.

offset: Parameter[float, Self] = self.add_parameter( "offset", label="Output offset", unit="V", get_cmd="OFST?", set_cmd="OFST {:.3f}", get_parser=float, vals=Numbers(-10, 10), )

Output offset, with millivolt resolution.

offset_enable: Parameter[bool, Self] = self.add_parameter( "offset_enable", get_cmd="OCTL?", set_cmd="OCTL {}", val_mapping={False: 0, True: 1}, )

Enable the output offset.

output_limit_lower: Parameter[float, Self] = self.add_parameter( "output_limit_lower", unit="V", get_cmd="LLIM?", set_cmd=self._set_output_limit_lower, get_parser=float, vals=Numbers(-10, 10), )

Lower output limit, with 10 mV resolution, not above the upper limit.

output_limit_upper: Parameter[float, Self] = self.add_parameter( "output_limit_upper", unit="V", get_cmd="ULIM?", set_cmd=self._set_output_limit_upper, get_parser=float, vals=Numbers(-10, 10), )

Upper output limit, with 10 mV resolution, not below the lower limit.

output_mode: Parameter[str, Self] = self.add_parameter( "output_mode", get_cmd="AMAN?", set_cmd="AMAN {}", val_mapping={"manual": 0, "pid": 1}, )

Select manual output or PID control.

output_monitor: Parameter[float, Self] = self.add_parameter( "output_monitor", unit="V", get_cmd="OMON?", set_cmd=False, get_parser=float, )

Single measurement of the output voltage.

polarity: Parameter[str, Self] = self.add_parameter( "polarity", get_cmd="APOL?", set_cmd="APOL {}", val_mapping={"negative": 0, "positive": 1}, )

Controller polarity. Setting polarity overrides the sign of gain.

proportional_enable: Parameter[bool, Self] = self.add_parameter( "proportional_enable", get_cmd="PCTL?", set_cmd="PCTL {}", val_mapping={False: 0, True: 1}, )

Enable proportional action.

ramp_enable: Parameter[bool, Self] = self.add_parameter( "ramp_enable", get_cmd="RAMP?", set_cmd="RAMP {}", val_mapping={False: 0, True: 1}, )

Enable constant-slew-rate internal setpoint changes.

ramp_rate: Parameter[float, Self] = self.add_parameter( "ramp_rate", unit="V/s", get_cmd="RATE?", set_cmd="RATE {:.2g}", get_parser=float, vals=Numbers(1e-3, 1e4), )

Slew rate for internal setpoint ramps.

ramp_status: Parameter[str, Self] = self.add_parameter( "ramp_status", get_cmd="RMPS?", set_cmd=False, val_mapping={"idle": 0, "pending": 1, "ramping": 2, "paused": 3}, )

Current setpoint ramp state.

setpoint: Parameter[float, Self] = self.add_parameter( "setpoint", unit="V", get_cmd="SETP?", set_cmd="SETP {:.3f}", get_parser=float, vals=Numbers(-10, 10), )

Internal setpoint, with millivolt resolution.

setpoint_monitor: Parameter[float, Self] = self.add_parameter( "setpoint_monitor", unit="V", get_cmd="SMON?", set_cmd=False, get_parser=float, )

Single measurement of the setpoint input to the error amplifier.

setpoint_source: Parameter[str, Self] = self.add_parameter( "setpoint_source", get_cmd="INPT?", set_cmd="INPT {}", val_mapping={"internal": 0, "external": 1}, )

Select the internal setpoint or the front-panel Setpoint input.

qcodes_contrib_drivers.drivers.StanfordResearchSystems.SR570 module

class qcodes_contrib_drivers.drivers.StanfordResearchSystems.SR570.SR570(*args: Any, **kwargs: Any)[source]

Bases: VisaInstrument

QCoDeS driver for the Stanford Research Systems SR570 Low-Noise Current Preamplifier.

This is a real driver and it will talk to your instrument (as opposed to SR560 from QCoDeS).

It can’t listen to it, so make sure that you either reset or set parameters before reading them.

(Resetting the device will update the parameters’ value with their reset value as per documentation.)

The device can also be accessed via TCP/IP if exposed via something like:

socat /dev/ttyUSB0,echo=0,b9600,cstopb=1,parenb=0,raw tcp-listen:20570,reuseaddr,nodelay
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.

reset() → None[source]

qcodes_contrib_drivers.drivers.StanfordResearchSystems.SR844 module

class qcodes_contrib_drivers.drivers.StanfordResearchSystems.SR844.ChannelTrace(name: str, channel: int, **kwargs: Any)[source]

Bases: ParameterWithSetpoints

Parameter class for the two channel buffers

__init__(name: str, channel: int, **kwargs: Any) → None[source]
Parameters:
  • name – The name of the parameter

  • channel – The relevant channel (1 or 2). The name should match this.

get_buffer_length() → int[source]
get_raw() → Any[source]

get_raw is called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively for Parameter a suitable method is automatically generated if get_cmd is supplied to the parameter constructor. The method is automatically wrapped to provide a get method on the parameter instance.

parse_binary(rawdata: bytes) → NDArray[source]
poll_raw_binary_data(N: int) → Any[source]
update_unit() → None[source]
class qcodes_contrib_drivers.drivers.StanfordResearchSystems.SR844.GeneratedSetPoints(sweep_array: Iterable[float | int] = array([0., 0.11111111, 0.22222222, 0.33333333, 0.44444444, 0.55555556, 0.66666667, 0.77777778, 0.88888889, 1.]), *args: Any, **kwargs: Any)[source]

Bases: Parameter

A parameter that generates a setpoint array from start, stop and num points parameters.

get_raw() → Any[source]

get_raw is called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively for Parameter a suitable method is automatically generated if get_cmd is supplied to the parameter constructor. The method is automatically wrapped to provide a get method on the parameter instance.

set_raw(value: Iterable[float | int]) → None[source]

set_raw is called to perform the actual setting of a parameter on the instrument. This method should either be overwritten to perform the desired operation or alternatively for Parameter a suitable method is automatically generated if set_cmd is supplied to the parameter constructor. The method is automatically wrapped to provide a set method on the parameter instance.

update_units_if_constant_sample_rate() → None[source]

If the buffer is filled at a constant sample rate, update the unit to “s” and label to “Time”; otherwise do nothing

class qcodes_contrib_drivers.drivers.StanfordResearchSystems.SR844.SR844(*args: Any, **kwargs: Any)[source]

Bases: VisaInstrument

This is the qcodes driver for the Stanford Research Systems SR844 Lock-in Amplifier

decrement_sensitivity() → bool[source]

Decrement the sensitivity setting of the lock-in. This is equivalent to pushing the sensitivity down button on the front panel. This has no effect if the sensitivity is already at the minimum.

Returns:

Whether or not the sensitivity was actually changed.

get_display_value(channel: int, disp: str) → int[source]
increment_sensitivity() → bool[source]

Increment the sensitivity setting of the lock-in. This is equivalent to pushing the sensitivity up button on the front panel. This has no effect if the sensitivity is already at the maximum.

Returns:

Whether or not the sensitivity was actually changed.

set_sweep_parameters(sweep_param: Parameter, start: float, stop: float, n_points: int = 10, label: str | None = None) → None[source]
snap(*parameters: str) → Tuple[float, ...][source]

Get between 2 and 6 parameters at a single instant. This provides a coherent snapshot of measured signals. Pick up to 6 from: X, Y, R, θ, the aux inputs 1-2, frequency, or what is currently displayed on channels 1 and 2.

Reading X and Y (or R and θ) gives a coherent snapshot of the signal. Snap is important when the time constant is very short, a time constant less than 100 ms.

Parameters:

*parameters – From 2 to 6 strings of names of parameters for which the values are requested. including: ‘x’, ‘y’, ‘r’, ‘p’, ‘phase’ or ‘θ’, ‘aux1’, ‘aux2’, ‘freq’, ‘ch1’, and ‘ch2’.

Returns:

A tuple of floating point values in the same order as requested.

Examples

>>> lockin.snap('x','y') -> tuple(x,y)
>>> lockin.snap('aux1','aux2','freq','phase')
>>> -> tuple(aux1,aux2,freq,phase)

Note

Volts for x, y, r, and aux 1-4 Degrees for θ Hertz for freq Unknown for ch1 and ch2. It will depend on what was set.

  • If X,Y,R and θ are all read, then the values of X,Y are recorded approximately 10 µs apart from R,θ. Thus, the values of X and Y may not yield the exact values of R and θ from a single snap.

  • The values of the Aux Inputs may have an uncertainty of up to 32 µs.

  • The frequency is computed only every other period or 40 ms, whichever is longer.

update_ch_unit(channel: int) → None[source]
SNAP_PARAMETERS = {'aux1': '6', 'aux2': '7', 'ch1': '9', 'ch2': '10', 'freq': '8', 'p': '5', 'phase': '5', 'r_dbm': '4', 'r_v': '3', 'x': '1', 'y': '2', 'θ': '5'}
sensitivity_value_map = {1e-07: 0, 3e-07: 1, 1e-06: 2, 3e-06: 3, 1e-05: 4, 3e-05: 5, 0.0001: 6, 0.0003: 7, 0.001: 8, 0.003: 9, 0.01: 10, 0.03: 11, 0.1: 12, 0.3: 13, 1: 14}
value_sensitivity_map = {0: 1e-07, 1: 3e-07, 2: 1e-06, 3: 3e-06, 4: 1e-05, 5: 3e-05, 6: 0.0001, 7: 0.0003, 8: 0.001, 9: 0.003, 10: 0.01, 11: 0.03, 12: 0.1, 13: 0.3, 14: 1}

Module contents