ExperimentOptions#
Module: exa.core.experiment_options
- class ExperimentOptions(*, readout_mode='complex', readout_programming_mode='classic', active_reset_cycles=None, used_measure_operations={'heralding': 'measure', 'reset_at_end': 'measure', 'terminal': 'measure_fidelity'}, repetitions=256, subscribed_components=None, exclude_operations_for=None, data_size_safety_switch=True, force_ragged_data=False, **extra_data)#
Bases:
BaseModelOptions for controlling experiment behavior.
Options change the behavior of the experiment execution in a way that is specific to the experiment type. Unlike instrument settings, these are not propagated to the instruments.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Attributes
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Defines what type of final readout the experiment uses, see
ReadoutModefor the possible values.How the experiment handles final readout, heralding and reset, see
ReadoutProgrammingModefor the possible values.Number of active
resetoperations inserted at the beginning of each segment for each active qubit, in their ownTimeBox.Names of the measurement QuantumOp the various
readout_programming_modes use when building the circuits.Averaging used in the experiment.
Components that are read out in the experiment.
Dictionary containing operations that are excluded from the experiment for given components.
If
Truedoes not allow runs that would result in excessive amounts of data, possibly straining the DB.If
Falsethe result datasets will be reshaped to an N-dimensional box based on the segment (hard sweeps) dimensions, whenever that is possible.Methods
Construct an ExperimentOptions instance from specified state provided as a dictionary.
Extract state of the current experiment options as a dictionary.
- Parameters:
- readout_mode: str#
Defines what type of final readout the experiment uses, see
ReadoutModefor the possible values.
- readout_programming_mode: str#
How the experiment handles final readout, heralding and reset, see
ReadoutProgrammingModefor the possible values.
- active_reset_cycles: int | None#
Number of active
resetoperations inserted at the beginning of each segment for each active qubit, in their ownTimeBox. Uses the default implementation ofreset.Nonemeans active reset is not used but instead reset is done by waiting (relaxation), using the default implementation of thereset_waitoperation. Integer values smaller than 1 result in neither active nor reset by wait being used, in which case any reset operations must be explicitly added in the circuit generation function.
- used_measure_operations: dict[str, str]#
Names of the measurement QuantumOp the various
readout_programming_modes use when building the circuits. Changing the defaults (e.g. making"heralding"use"measure_fidelity") may result in sub-optimal behavior."terminal"is used for terminal measurement whenreadout_programming_modeis either"classic"orheralding."heralding"is used for the heralding measurement whenreadout_programming_modeis"heralding"."reset_at_end"is used whenreadout_programming_modeis"reset_at_end".
Note: this attribute applies only to the measure operations added automatically by Experiment. If the experiment adds measure operations explicitly in its circuit, you must write the logic for choosing the right operation to the circuit generation function itself.
- repetitions: int#
Averaging used in the experiment. This value will be used for
controllers.options.playlist_repeats, and possibly forcontrollers.options.averaging_bins, depending onreadout_mode.
- subscribed_components: list[str] | dict[str, list[str]] | None#
Components that are read out in the experiment. Can be a list of component names, or a dict of lists of component names where the keys are the readout group names (this option is only available with
readout_mode== "counter").
- exclude_operations_for: dict[str, list[str] | str] | None#
Dictionary containing operations that are excluded from the experiment for given components. Operations are given as keys and component or components as values e.g. exclude_operations_for = {“readout”: [QB1, QB2]}. The operations are removed as part of
get_settings().
- data_size_safety_switch: bool#
If
Truedoes not allow runs that would result in excessive amounts of data, possibly straining the DB. An error message will be thrown that approximates the data size and asks the user to set the optionFalseif they still want to proceed.
- force_ragged_data: bool#
If
Falsethe result datasets will be reshaped to an N-dimensional box based on the segment (hard sweeps) dimensions, whenever that is possible. The ragged data format, where the result data is indexed along the readout trigger index, is used only when necessary, i.e. if the number of readout triggers per segment is not constant. Turn this option toTrueif you want the experiment to always produce ragged data. This can be useful e.g. if the number of readouts per segment is not deterministic or known, and the experiment may under some circumstances return ND-data and in some ragged data (forcing the data to be always ragged makes the result handling consistent).
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_dict()#
Extract state of the current experiment options as a dictionary.
Any arbitrary type present is also converted to dict, and a
__type__attribute is added to the root of that dict, so thatfrom_dict()is able to convert them back. The arbitrary types need to be specified in_class_name_to_class()and have the methodto_dictimplemented.- Returns:
A dict[str, Any] representing the state of the current experiment options.
- Raises:
ValueError – if an arbitrary type does not have the method “to_dict” implemented.
- Return type:
- classmethod from_dict(values)#
Construct an ExperimentOptions instance from specified state provided as a dictionary.
Construction can be based on the type of the class, or just this base class if the type is not relevant. If
valuescontains'__type__'in a nested dictionary (as is typically inserted byto_dict()), it will be silently removed. The intended usage is that the'__type__'information is used to determine which arbitrary type was converted to a dict and now needs to be converted back to the type.- Parameters:
values (dict[str, Any]) – Dictionary to create the instance from.
- Returns:
An instance of
ExperimentOptions.- Raises:
ValueError – either if an arbitrary type has been used and it does not have a mapping in
_class_name_to_class(), or if the arbitrary type does not have the method “from_dict” implemented.- Return type:
Inheritance
