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: BaseModel

Options 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

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

readout_mode

Defines what type of final readout the experiment uses, see ReadoutMode for the possible values.

readout_programming_mode

How the experiment handles final readout, heralding and reset, see ReadoutProgrammingMode for the possible values.

active_reset_cycles

Number of active reset operations inserted at the beginning of each segment for each active qubit, in their own TimeBox.

used_measure_operations

Names of the measurement QuantumOp the various readout_programming_mode s use when building the circuits.

repetitions

Averaging used in the experiment.

subscribed_components

Components that are read out in the experiment.

exclude_operations_for

Dictionary containing operations that are excluded from the experiment for given components.

data_size_safety_switch

If True does not allow runs that would result in excessive amounts of data, possibly straining the DB.

force_ragged_data

If False the result datasets will be reshaped to an N-dimensional box based on the segment (hard sweeps) dimensions, whenever that is possible.

Methods

from_dict

Construct an ExperimentOptions instance from specified state provided as a dictionary.

to_dict

Extract state of the current experiment options as a dictionary.

Parameters:
readout_mode: str#

Defines what type of final readout the experiment uses, see ReadoutMode for the possible values.

readout_programming_mode: str#

How the experiment handles final readout, heralding and reset, see ReadoutProgrammingMode for the possible values.

active_reset_cycles: int | None#

Number of active reset operations inserted at the beginning of each segment for each active qubit, in their own TimeBox. Uses the default implementation of reset. None means active reset is not used but instead reset is done by waiting (relaxation), using the default implementation of the reset_wait operation. 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_mode s use when building the circuits. Changing the defaults (e.g. making "heralding" use "measure_fidelity") may result in sub-optimal behavior.

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 for controllers.options.averaging_bins, depending on readout_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 True does 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 option False if they still want to proceed.

force_ragged_data: bool#

If False the 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 to True if 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 that from_dict() is able to convert them back. The arbitrary types need to be specified in _class_name_to_class() and have the method to_dict implemented.

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:

dict[str, Any]

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 values contains '__type__' in a nested dictionary (as is typically inserted by to_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:

ExperimentOptions

Inheritance

Inheritance diagram of exa.core.experiment_options.ExperimentOptions