utility#

Utility functions for the instrument coordinator and components.

Module Contents#

Functions#

search_settable_param(...)

Searches for a settable parameter in nested instrument hierarchies.

parameter_value_same_as_cache(→ bool)

Returns whether the value of a QCoDeS parameter is the same as the value in cache.

lazy_set(→ None)

Set the value of a QCoDeS parameter only if it is different from the value in cache.

check_already_existing_acquisition(→ None)

Verifies non-overlapping data in new_dataset and current_dataset.

add_acquisition_coords_binned(→ None)

Modifies the argument data_array,

add_acquisition_coords_nonbinned(→ None)

Modifies the argument data_array,

Attributes#

logger[source]#
search_settable_param(instrument: qcodes.instrument.base.InstrumentBase, nested_parameter_name: str) qcodes.parameters.parameter.Parameter[source]#

Searches for a settable parameter in nested instrument hierarchies.

For example instrument.submodule_1.channel_1.parameter.

Parameters:
  • instrument – The root QCoDeS instrument where the parameter resides.

  • nested_parameter_name – Hierarchical nested parameter name.

Returns:

Parameter:

parameter_value_same_as_cache(instrument: qcodes.instrument.base.InstrumentBase, parameter_name: str, val: object) bool[source]#

Returns whether the value of a QCoDeS parameter is the same as the value in cache.

Parameters:
  • instrument – The QCoDeS instrument to set the parameter on.

  • parameter_name – Name of the parameter to set.

  • val – Value to set it to.

Returns:

bool

lazy_set(instrument: qcodes.instrument.base.InstrumentBase, parameter_name: str, val: object) None[source]#

Set the value of a QCoDeS parameter only if it is different from the value in cache.

Parameters:
  • instrument – The QCoDeS instrument to set the parameter on.

  • parameter_name – Name of the parameter to set.

  • val – Value to set it to.

check_already_existing_acquisition(new_dataset: xarray.Dataset, current_dataset: xarray.Dataset) None[source]#

Verifies non-overlapping data in new_dataset and current_dataset.

If there is, it will raise an error.

Parameters:
  • new_dataset – New dataset.

  • current_dataset – Current dataset.

add_acquisition_coords_binned(data_array: xarray.DataArray, coords: list[dict], acq_index_dim_name: collections.abc.Hashable) None[source]#

Modifies the argument data_array, it adds the coords to it.

This function only applies to binned acquisitions.

Coordinates in the acquisition channels data is a list of dictionary, and each dictionary is a coordinate. In the return data however, it should be a dict, for each coords key it should store a list of the values.

xarray requires the coordinates to specify on which xarray dimension they are applied to. That’s why the acq_index_dim_name is used here. Note: dimension and coords are different.

add_acquisition_coords_nonbinned(data_array: xarray.DataArray, coords: dict, acq_index_dim_name: collections.abc.Hashable) None[source]#

Modifies the argument data_array, it adds the coords to it.

This function only applies to nonbinned acquisitions.

Coordinates in the acquisition channels data is a dictionary, and each dictionary is a coordinate. In the return data however, it should be a dict, for each coords key it should store a list of the values.

xarray requires the coordinates to specify on which xarray dimension they are applied to. That’s why the acq_index_dim_name is used here. Note: dimension and coords are different.