Measure

Measurement orchestration: run a sweep, persist it, and register it for live plotting.

class qanary.measure.Station(name)[source]

Bases: object

Collection of instruments and named parameters recorded by a measurement.

Parameters:

name (str) – Human-readable station name.

add_parameter(name, label, param, param_type='gate')[source]

Add a named parameter to the station.

A sequence is represented by a MultiChannelParameter; a single QCoDeS parameter is aliased with ParameterMixin.

Parameters:
  • name (str) – Name used in measurement metadata and datasets.

  • label (str) – Human-readable label.

  • param (Parameter | Sequence[Parameter]) – Parameter or channels to register.

  • param_type (str) – Parameter category stored in snapshots. Defaults to "gate".

Returns:

Registered station

parameter.

Return type:

ParameterMixin | MultiChannelParameter

Raises:

ValueError – If another station parameter already uses name.

remove_parameter(pm)[source]

Remove a previously registered parameter.

Parameters:

pm (ParameterMixin) – Parameter returned by add_parameter().

Raises:

ValueError – If pm is not registered with this station.

class qanary.measure.Measurement(wafer_id, device_type, sample_name, experiment_name, station, data_location, metadata, fridge_name='', save_interval=0.1, nc_snapshot_during_run=False, git_repo='~/.measurement-hashes')[source]

Bases: object

Configure, acquire, publish, and persist one Qanary measurement.

Create a measurement and reserve its output paths.

Parameters:
  • wafer_id (str) – Wafer identifier used in the output path.

  • device_type (str) – Device type used in the output path.

  • sample_name (str) – Sample name used in the output path.

  • experiment_name (str) – Experiment name used in the output path.

  • station (Station) – Instruments and parameters to snapshot.

  • data_location (str) – Root directory for completed measurements.

  • metadata (dict) – User metadata stored on the resulting dataset.

  • fridge_name (str) – Optional suffix for the measurement-hash repository. Defaults to an empty string.

  • save_interval (float) – Minimum time in seconds between live and disk checkpoints. Defaults to 0.1.

  • nc_snapshot_during_run (bool) – Also write best-effort netCDF snapshots during acquisition. Defaults to False.

  • git_repo (str) – Repository used to record measurement hashes. Defaults to "~/.measurement-hashes".

Notes

Completed data is written below data_location/wafer_id/device_type/sample_name/experiment_name. Live recovery checkpoints are temporary and stored under the Qanary application directory (QANARY_HOME, ~/.qanary by default).

get_installed_packages()[source]

Return installed Python distributions as requirements text.

Returns:

name==version lines suitable for dataset metadata, or an

empty string when neither package-listing command is available.

Return type:

str

run(sweeps, dependents, interrupt=<function Measurement.<lambda>>, rampdown_on_interrupt=False, verbose=False, no_hashing=False)[source]

Acquire a measurement and finalize it to netCDF.

Parameters:
  • sweeps (Sweep | CircularSweep | Sequence[Sweep | dict]) – A sweep, nested slow sweeps, or slow sweeps followed by one buffered-tree mapping.

  • dependents (list) – QCoDeS parameters read at every unbuffered point. Buffered dependents belong in the buffered-tree mapping instead.

  • interrupt (Callable) – Callback checked during acquisition. A truthy result interrupts the run. Defaults to always false.

  • rampdown_on_interrupt (bool) – Ramp swept parameters to zero after a KeyboardInterrupt. Defaults to False.

  • verbose (bool) – Log checkpoint operations. Defaults to False.

  • no_hashing (bool) – Skip recording the completed file’s hash in the measurement-hash repository. Defaults to False.

Raises:

Notes

Partial data is finalized on interruption or failure before the original exception is re-raised. The method returns None; use data for the completed file path.

qanary.measure.run(sweeps, dependents, wafer_id, device_type, sample_name, experiment_name, metadata={}, station=None, data_location='./test/', interrupt=<function <lambda>>, rampdown_on_interrupt=False, location_return=False, verbose=False, no_hashing=False, *args, **kwargs)[source]

Create and run a Measurement in one call.

Parameters:
  • sweeps (Sweep | CircularSweep | Sequence[Sweep | dict]) – Sweep definition accepted by Measurement.run().

  • dependents (list) – Unbuffered QCoDeS parameters to record.

  • wafer_id (str) – Wafer identifier used in the output path.

  • device_type (str) – Device type used in the output path.

  • sample_name (str) – Sample name used in the output path.

  • experiment_name (str) – Experiment name used in the output path.

  • metadata (dict) – Extra metadata stored on the dataset.

  • station (Station) – Instruments and parameters to snapshot.

  • data_location (str) – Root directory for completed measurements. Defaults to "./test/".

  • interrupt (Callable) – Callback checked during acquisition.

  • rampdown_on_interrupt (bool) – Ramp swept parameters to zero after a KeyboardInterrupt. Defaults to False.

  • location_return (bool) – Return the output path after the run. Defaults to False.

  • verbose (bool) – Log checkpoint operations. Defaults to False.

  • no_hashing (bool) – Skip recording the completed file’s hash. Defaults to False.

  • *args – Additional positional arguments forwarded to Measurement.

  • **kwargs – Additional keyword arguments forwarded to Measurement.

Returns:

Final netCDF path when location_return is true; otherwise

None.

Return type:

str | None

Raises:

ValueError – If station is not provided.