stoner_measurement.plugins.trace.k6221_multi_sr830.Keithley6221_MultiSR830Plugin

class stoner_measurement.plugins.trace.k6221_multi_sr830.Keithley6221_MultiSR830Plugin(parent=None)[source]

Bases: TracePlugin

Measure one swept 6221 parameter with one or more supported lock-ins.

Use this plugin when a Keithley 6221 provides an AC excitation and one or more SRS SR830 or SIGNAL RECOVERY 7265 lock-in amplifiers measure the response. It is designed for experiments where you want to scan the waveform amplitude, offset, or frequency and record one or more lock-in outputs for each point.

In the configuration tabs you first choose the 6221 connection and source settings, including the GPIB resource, the waveform parameter to scan, the fixed sine settings that are not being swept, the trigger-link output line, and the source-range policy. The same page also provides common lock-in settings such as time constant, auto-ranging thresholds, and the cooldown multiple used to decide how long to wait between successive readings. A resistance-conversion option can be enabled to add derived resistance channels from the measured lock-in voltages. When channel statistics are enabled, these channels also advertise mean outputs named instance.label.output.resistance, with units of ohms. Per-point auto-ranging skips lock-ins with nonzero output offsets, preserving their offset scaling while other lock-ins continue to adjust independently.

The second tab contains the lock-in configuration table. Each column represents one instrument. For each lock-in you choose its model and set a human-readable label, resource string, selected output channels, sensitivity, whether it participates in auto-sensitivity, harmonic, input source, coupling, filter slope, line rejection, and numeric or automatic reference phase. Choices depend on the selected model. SR830 entries also provide output offset, expand factor, and reserve mode. Multiple outputs may be selected for each lock-in using separate check boxes for X, Y, R, and THETA. Reset Lockin defaults to enabled for each instrument and controls resets during both connect and configure. Temporary settings readback and auto-offset actions preserve the instrument settings. If overload remains at the end of configuration, the plugin waits for the longer of three time constants and the read cooldown, clears status where supported, and checks once more before reporting a persistent overload.

The scan generator defines the swept values. The plugin returns one shared-x trace named Signals, with columns named from lock-in labels and selected outputs. Resistance conversion adds derived columns for non-angular outputs.

Channel selectors expose these configured columns before acquisition. configured_trace_data() returns an empty Signals schema by trace identifier, reflecting lock-in labels, selected outputs and derived channels.

The runtime lifecycle follows a persistent-output model: configure() leaves the 6221 output enabled, each measure() reuses that configured source state to acquire a fresh scan, and disconnect() turns the output off.

Variables:
  • _6221_resource (str) – VISA resource string for the Keithley 6221 current source.

  • _scan_mode (WaveformScanMode) – Which 6221 waveform parameter is scanned: amplitude, offset, or frequency.

  • _waveform_amplitude (float) – Fixed sine-wave amplitude in amps when amplitude is not the scanned quantity. This is interpreted as a zero-to-peak current.

  • _waveform_offset (float) – Fixed DC current offset in amps when offset is not the scanned quantity.

  • _waveform_frequency (float) – Fixed sine-wave frequency in hertz when frequency is not the scanned quantity.

  • _phase_marker_tlink (int) – Trigger-link output line used by the 6221 phase marker.

  • _time_constant (float) – Common lock-in time constant in seconds.

  • _filter_slope (int) – Legacy migration default for the per-lock-in filter slope.

  • _input_coupling (LockInInputCoupling) – Legacy migration default for per-lock-in input coupling.

  • _line_filter (LockInLineFilter) – Legacy migration default for per-lock-in line rejection.

  • _read_rate_multiple (float) – Multiplier applied to the time constant when enforcing a minimum interval between readings.

  • _auto_sensitivity_enabled (bool) – Master enable for automatic sensitivity adjustment.

  • _auto_sensitivity_low (float) – Lower signal-to-full-scale ratio threshold for auto-sensitivity.

  • _auto_sensitivity_high (float) – Upper signal-to-full-scale ratio threshold for auto-sensitivity.

  • _offset_enabled (bool) – When True, apply stored or measured output-offset corrections to X, Y, and R readings.

  • _source_range_mode (str) – 6221 source-range policy: "AUTO", "BEST", or "FIXED".

  • _resistance_enabled (bool) – When True, emit derived resistance channels for non-angular lock-in outputs.

  • _lockin_entries (list[LockInEntry]) – Per-lock-in configuration entries defining labels, resources, outputs, sensitivity, harmonic, phase, and related settings.

  • instance_name (str) – Inherited Python identifier for this instance in the Script tab and QtConsole.

  • comment (str) – Inherited optional note displayed beside this step.

  • sequence_engine (SequenceEngine | None) – Inherited owning engine and its live namespace; None while detached.

  • scan_generator (BaseScanGenerator) – Inherited generator defining acquisition source values.

  • data (dict[str, TraceData]) – Inherited latest trace tables, keyed by trace name; inspect each table through its df attribute.

  • status (TraceStatus) – Inherited acquisition status, including data availability and errors.

Keyword Parameters:

parent (QObject | None) – Optional Qt parent object.

Examples

With an instance named k6221_multi_sr830 in the sequence, use the QtConsole to inspect or edit it before running. Substitute your instance name if different; result data reflects completed steps:

k6221_multi_sr830._time_constant = 0.1
k6221_multi_sr830._lockin_entries
k6221_multi_sr830.data
auto_offset() → None[source]

Enable the 6221, settle, and run auto-offset on all configured lock-in output channels.

For each lock-in and each output that supports an offset channel (X, Y, R), this method sends the SR830 AOFF command and reads back the resulting offset percentage, storing it in LockInEntry.auto_offsets. The stored offsets are applied as additive corrections to subsequent measurements when _offset_enabled is True.

Raises:

RuntimeError – If the instruments are not connected.

auto_offset_temporary_lockins(indices: list[int]) → None[source]

Auto-offset selected supported lock-ins using temporary connections.

configure() → None[source]

Apply the stored 6221 and lock-in settings to connected hardware.

On successful completion the 6221 output is left enabled so subsequent measurements can reuse the configured waveform without reconfiguration. The output is disabled in disconnect().

connect() → None[source]

Open the 6221 and all configured lock-in connections.

declared_outputs() → PluginOutputs[source]

Declare lock-in traces and source/statistic scalars with their units.

disconnect() → None[source]

Disable the 6221 output and close all active instrument sessions.

property name: str

Return the unique plugin identifier.

offset_addition_changed

Qt signal.

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

types is normally a sequence of individual types.  Each type is either a
type object or a string that is the name of a C++ type.  Alternatively
each type could itself be a sequence of types each describing a different
overloaded signal.
name is the optional C++ name of the signal.  If it is not specified then
the name of the class attribute that is bound to the signal is used.
revision is the optional revision of the signal that is exported to QML.
If it is not specified then 0 is used.
arguments is the optional sequence of the names of the signal's arguments.
read_temporary_instrument_settings(indices: list[int]) → tuple[dict[str, float], list[tuple[int, dict[str, Any]]]][source]

Read the 6221 and selected lock-ins without retaining their connections.

set_scan_generator_class(cls) → None[source]

Replace the scan generator class and update the displayed units.

to_json() → dict[str, Any][source]

Serialise the plugin configuration to a JSON-compatible dictionary.

property x_label: str

Return the label for the scanned 6221 sine parameter.

property x_units: str

Return the unit for the scanned 6221 sine parameter.

property y_label: str

Return the default dependent-axis label.

property y_units: str

Return the default dependent-axis unit.