qblox_scheduler.analysis#
Module containing analysis functionalities.
Submodules#
- qblox_scheduler.analysis.base_analysis
- qblox_scheduler.analysis.calibration
- qblox_scheduler.analysis.conditional_oscillation_analysis
- qblox_scheduler.analysis.cosine_analysis
- qblox_scheduler.analysis.data
- qblox_scheduler.analysis.data_handling
- qblox_scheduler.analysis.fitting_models
- qblox_scheduler.analysis.helpers
- qblox_scheduler.analysis.interpolation_analysis
- qblox_scheduler.analysis.optimization_analysis
- qblox_scheduler.analysis.readout_calibration_analysis
- qblox_scheduler.analysis.single_qubit_timedomain
- qblox_scheduler.analysis.spectroscopy_analysis
- qblox_scheduler.analysis.time_of_flight_analysis
- qblox_scheduler.analysis.types
Classes#
A basic analysis that extracts the data from the latest file matching the label |
|
A basic analysis that extracts the data from the latest file matching the label |
|
Exemplary analysis subclass that fits a cosine to a dataset. |
|
Class which represents all data related to an experiment. This allows the user to |
|
Manages output directory paths for Qblox Scheduler data storage. |
|
An analysis class which generates a 2D interpolating plot for each yi variable in |
|
An analysis class which extracts the optimal quantities from an N-dimensional |
|
Normalizes the data from an AllXY experiment and plots against an ideal curve. |
|
Analysis class for a qubit spin-echo experiment, |
|
Fits a cosine curve to Rabi oscillation data and finds the qubit drive |
|
Fits a decaying cosine curve to Ramsey data (possibly with artificial detuning) |
|
Analysis class for a qubit T1 experiment, |
|
Analysis for a spectroscopy experiment of a hanger resonator. |
Functions#
Reshapes the acquisitions dataset or dataarray |
Package Contents#
- class Basic2DAnalysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
BaseAnalysisA basic analysis that extracts the data from the latest file matching the label and plots and stores the data in the experiment container.
- class BasicAnalysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
BaseAnalysisA basic analysis that extracts the data from the latest file matching the label and plots and stores the data in the experiment container.
- class CosineAnalysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
qblox_scheduler.analysis.base_analysis.BaseAnalysisExemplary analysis subclass that fits a cosine to a dataset.
- process_data()[source]#
In some cases, you might need to process the data, e.g., reshape, filter etc., before starting the analysis. This is the method where it should be done.
See
process_data()for an implementation example.
- run_fitting()[source]#
Fits a
CosineModelto the data.
- class AnalysisDataContainer(tuid: str, name: str)[source]#
Class which represents all data related to an experiment. This allows the user to run experiments and store data. The class serves as an initial interface and uses the directory paths set by OutputDirectoryManager.
- tuid#
- day_folder#
- data_folder#
- classmethod load_dataset(tuid: quantify_core.data.types.TUID, name: str = DATASET_NAME) xarray.Dataset[source]#
Loads a dataset specified by a tuid.
- Parameters:
tuid – A
TUIDstring. It is also possible to specify only the first part of a tuid.name – Name of the dataset.
- Returns:
: The dataset.
- classmethod load_dataset_from_path(path: pathlib.Path | str) xarray.Dataset[source]#
Loads a
Datasetwith a specific engine preference.Before returning the dataset
AdapterH5NetCDF.recover()is applied.This function tries to load the dataset until success with the following engine preference:
"h5netcdf""netcdf4"No engine specified (
load_dataset()default)
- Parameters:
path – Path to the dataset.
- Returns:
: The loaded dataset.
- write_dataset(dataset: xarray.Dataset) None[source]#
Writes the quantify dataset to the directory specified by ~.data_folder.
- Parameters:
dataset – The dataset to be written to the directory
- save_snapshot(snapshot: dict[str, Any] | None = None, compression: Literal['bz2', 'gzip', 'lzma'] | None = None) None[source]#
Writes the snapshot to disk as specified by ~.data_folder.
- Parameters:
snapshot – The snapshot to be written to the directory
compression – The compression type to use. Can be one of ‘gzip’, ‘bz2’, ‘lzma’. Defaults to None, which means no compression.
- classmethod get_latest_tuid(contains: str = '') quantify_core.data.types.TUID[source]#
Returns the most recent tuid.
Tip
This function is similar to
get_tuids_containing()but is preferred if one is only interested in the most recentTUIDfor performance reasons.- Parameters:
contains – An optional string contained in the experiment name.
- Returns:
: The latest TUID.
- Raises:
FileNotFoundError – No data found.
- classmethod get_tuids_containing(contains: str = '', t_start: datetime.datetime | str | None = None, t_stop: datetime.datetime | str | None = None, max_results: int = sys.maxsize, reverse: bool = False) list[quantify_core.data.types.TUID][source]#
Returns a list of tuids containing a specific label.
Tip
If one is only interested in the most recent
TUID,get_latest_tuid()is preferred for performance reasons.- Parameters:
contains – A string contained in the experiment name.
t_start – datetime to search from, inclusive. If a string is specified, it will be converted to a datetime object using
parse. If no value is specified, will use the year 1 as a reference t_start.t_stop – datetime to search until, exclusive. If a string is specified, it will be converted to a datetime object using
parse. If no value is specified, will use the current time as a reference t_stop.max_results – Maximum number of results to return. Defaults to unlimited.
reverse – If False, sorts tuids chronologically, if True sorts by most recent.
- Returns:
list A list of
TUID: objects.- Raises:
FileNotFoundError – No data found.
- classmethod locate_experiment_container(tuid: str) pathlib.Path[source]#
Returns the experiment container for the given tuid.
- class OutputDirectoryManager[source]#
Manages output directory paths for Qblox Scheduler data storage.
The class maintains a single instance throughout the application lifecycle, ensuring consistent directory management.
- _datadir#
The current data directory path. Private attribute managed through setter and getter methods.
- Type:
str or Path
- DATADIR: ClassVar[pathlib.Path]#
- classmethod set_datadir(datadir: pathlib.Path | str | None = None) None[source]#
Sets the data directory.
- Parameters:
datadir (pathlib.Path or str or None) – Path of the data directory. If set to
None, resets the datadir to the default datadir (<top_level>/data).
- classmethod get_datadir() pathlib.Path[source]#
Returns the current data directory.
- Returns:
: The current data directory.
- acq_coords_to_dims(data: xarray.Dataset, coords: list[collections.abc.Hashable], acq_channels: collections.abc.Iterable[collections.abc.Hashable] | None = None) xarray.Dataset[source]#
- acq_coords_to_dims(data: xarray.DataArray, coords: list[collections.abc.Hashable], acq_channels: collections.abc.Iterable[collections.abc.Hashable] | None = None) xarray.DataArray
Reshapes the acquisitions dataset or dataarray so that the given coords become dimensions. It can also reshape from a 1 dimensional data to a multi-dimensional data along the given coords. If a dataset is given, all acquisition channels are reshaped, unless acq_channels are given.
- Parameters:
data – The data to be converted to multi-dimensions. Can be a Dataset or a DataArray.
coords – The coords keys that needs to be converted to dimensions.
acq_channels – In case of a Dataset, these acquisition channels need to be converted.
- Returns:
A DataArray or Dataset that has multi-dimensional dimensions along the specified coords.
- Raises:
ValueError – If there are no coords or if the data does not contain the acquisition index dimension name.
- class InterpolationAnalysis2D(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
qblox_scheduler.analysis.base_analysis.BaseAnalysisAn analysis class which generates a 2D interpolating plot for each yi variable in the dataset.
- class OptimizationAnalysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
qblox_scheduler.analysis.base_analysis.BaseAnalysisAn analysis class which extracts the optimal quantities from an N-dimensional interpolating experiment.
- run(minimize: bool = True)[source]#
- Parameters:
minimize – Boolean which determines whether to report the minimum or the maximum. True for minimize. False for maximize.
- Returns:
OptimizationAnalysis: The instance of this analysis.
- class AllXYAnalysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
SingleQubitTimedomainAnalysisNormalizes the data from an AllXY experiment and plots against an ideal curve.
See section 2.3.2 of :cite:t:`reed_entanglement_2013` for an explanation of the AllXY experiment and it’s applications in diagnosing errors in single-qubit control pulses.
- run()[source]#
Executes the analysis using specific datapoints as calibration points.
- Returns:
AllXYAnalysis: The instance of this analysis.
- process_data()[source]#
Processes the data so that the analysis can make assumptions on the format.
Populates self.dataset_processed.S21 with the complex (I,Q) valued transmission, and if calibration points are present for the 0 and 1 state, populates self.dataset_processed.pop_exc with the excited state population.
- class EchoAnalysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
SingleQubitTimedomainAnalysis,_DecayFigMixinAnalysis class for a qubit spin-echo experiment, which fits an exponential decay and extracts the T2_echo time.
- run_fitting()[source]#
Fit the data to
ExpDecayModel.
- class RabiAnalysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
SingleQubitTimedomainAnalysisFits a cosine curve to Rabi oscillation data and finds the qubit drive amplitude required to implement a pi-pulse.
The analysis will automatically rotate the data so that the data lies along the axis with the best SNR.
- run(calibration_points: bool = True)[source]#
- Parameters:
calibration_points – Specifies if the data should be rotated so that it lies along the axis with the best SNR.
- Returns:
RabiAnalysis: The instance of this analysis.
- class RamseyAnalysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
SingleQubitTimedomainAnalysis,_DecayFigMixinFits a decaying cosine curve to Ramsey data (possibly with artificial detuning) and finds the true detuning, qubit frequency and T2* time.
- run(artificial_detuning: float = 0, qubit_frequency: float = None, calibration_points: bool | Literal['auto'] = 'auto')[source]#
- Parameters:
artificial_detuning – The detuning in Hz that will be emulated by adding an extra phase in software.
qubit_frequency – The initial recorded value of the qubit frequency (before accurate fitting is done) in Hz.
calibration_points – Indicates if the data analyzed includes calibration points. If set to
True, will interpret the last two data points in the dataset as \(|0\rangle\) and \(|1\rangle\) respectively. If"auto", will usehas_calibration_points()to determine if the data contains calibration points.
- Returns:
RamseyAnalysis: The instance of this analysis.
- run_fitting()[source]#
Fits a
DecayOscillationModelto the data.
- class T1Analysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
SingleQubitTimedomainAnalysis,_DecayFigMixinAnalysis class for a qubit T1 experiment, which fits an exponential decay and extracts the T1 time.
- run_fitting()[source]#
Fit the data to
ExpDecayModel.
- class ResonatorSpectroscopyAnalysis(dataset: xarray.Dataset | None = None, tuid: quantify_core.data.types.TUID | str | None = None, label: str = '', settings_overwrite: dict | None = None, plot_figures: bool = True)[source]#
Bases:
qblox_scheduler.analysis.base_analysis.BaseAnalysisAnalysis for a spectroscopy experiment of a hanger resonator.
- process_data()[source]#
Verifies that the data is measured as magnitude and phase and casts it to a dataset of complex valued transmission \(S_{21}\).
- run_fitting()[source]#
Fits a
ResonatorModelto the data.