Experiment

Experiment#

Module: exa.core.experiment.experiment

class Experiment(label=None, circuit_generation_function=None)#

Bases: object

Base class for multi-qubit experiments.

This class is designed to run arbitrary control sequences on multiple qubits. Sequences can be provided either as time-ordered Timeboxes, or in the circuit-level, represented as quantum operations (i.e. gates), or even above the gate-level if the necessary compilation stages to go from that abstraction to the circuit-level is included.

__init__() should not be overridden in the subclasses. Instead, one should override the non-final methods below and/or default_options in order to achieve the desired behaviour.

Parameters:
  • label (str | None) – Human-readable label for this experiment.

  • circuit_generation_function (CircuitGenerationFunction | None) – The circuit generation function. Define when using Experiment without inheritance. The function should take at least 2 arguments: components and builder and return a list of TimeBoxes. Any other arguments are treated as extra circuit parameters. See get_default_circuit_generation_function() for more details on the signature. By default, returns an empty TimeBox, so no pulses are played.

Attributes

allowed_component_grouping_modes

Only for backwards compatibility, does not actually do anything anymore.

allowed_qpu_types

Defines if the experiment supports only star or normal QPUs.

chad

The CHAD data this experiment will use when running.

chip_layout

chip_topology

circuit_stages

Circuit-level (above TimeBox) sweepable compilation stages.

coupler_mapping

default_label

The default label for the experiment.

default_options

Default experiment options.

executor

The instance implementing the ExecutorInterface that this experiment will use when running.

final_stages

The final stages for creating the SC RunDefinition.

gate_definitions

gates

input_type

Input type of the Experiment class.

last_run

Get the results from the latest run.

name

Unique identifier for the experiment class.

observation_handler

parallel_group

Unit of parallelization for the experiment.

pp_stages

The return data post-processing stages.

pulse_stages

TimeBox and below sweepable compilation stages.

storage

The instance implementing the StorageInterface that this experiment will use when running.

Methods

analyze

Analyzes an experiment run and returns the result.

chip_properties

Get a selected properties of chip components.

create

Create a complete RunDefinition for a new run.

default_analyze_function

The sweep generation function is a Callable that returns an AnalyzeResult object.

default_circuit_generation_function

The circuit generation function is a Callable that returns either a TimeBox or a list[TimeBox] object.

default_sweep_generation_function

The sweep generation function is a Callable that returns the type Sweeps.

default_sweep_parameters

Returns default sweep parameters.

from_dut_label

Construct an Experiment instance for loading and re-analyzing old run data.

get_by_job_id

Get an instance of the Experiment that produced job_id, holding its run result.

get_by_run_id

Get an instance of the Experiment that produced run_id, holding its run result.

get_default_analyze_function

Returns default analyze function.

get_default_circuit_generation_function

Circuit generation function for this experiment.

get_default_circuit_settings

Override to define default circuit parameters.

get_default_sweep_generation_function

Return the sweep generation function.

get_default_sweeps

Default sweep definition for the experiment.

get_default_sweeps_as_dict

Returns the default sweeps from get_default_sweeps() as a dict that can be fed to run().

get_settings

Retrieves and modifies settings for Experiment.

has_required_gates

Check whether the station provides all gates required by the circuit generation function.

inspect_segment

Visualise the segments of a playlist.

make_final_mutations

Make any experiment-specific changes to the final run definition.

print_default_sweeps

Prints the default sweeps from get_default_sweeps() in a human-readable format.

process_run_components

Process components and ExperimentOptions.subscribed_components inputs given by the user into parallelly runnable component groups.

register_gate_implementation

Register new gate implementation for this experiment instance.

remove_operations

Removes the given operations from the settings tree under the given component or group.

run

Run the experiment to get results.

set_calibration_data_for_gate_implementation

Set calibration data for a gate implementation in this experiment instance.

set_gate_implementation_as_default

Set this gate implementation as default for this experiment instance.

setup_additional_init_properties

Override to e.g. change the observation loading rules or register new gate implementations for this experiment instance.

submit_run

Submit an experiment for execution on Station Control, wait for the results and post-process them.

update_compilation_context

Additional updates for the compilation context.

update_settings

Additional updates for the settings.

name = 'experiment'#

Unique identifier for the experiment class. Used to differentiate between different datasets in the database.

circuit_stages: list[CompilationStage] = [CompilationStage(name='circuit_stage')]#

Circuit-level (above TimeBox) sweepable compilation stages.

pulse_stages: list[CompilationStage] = [CompilationStage(name='circuit_resolution'), CompilationStage(name='timebox_stage'), CompilationStage(name='timebox_resolution'), CompilationStage(name='dynamical_decoupling'), CompilationStage(name='schedule_stage')]#

TimeBox and below sweepable compilation stages.

final_stages: list[CompilationStage] = [CompilationStage(name='schedule_resolution'), CompilationStage(name='job_creation')]#

The final stages for creating the SC RunDefinition.

pp_stages: list[CompilationStage] = [CompilationStage(name='construct_run_result'), CompilationStage(name='construct_data_variables')]#

The return data post-processing stages.

static default_circuit_generation_function(components, builder)#

The circuit generation function is a Callable that returns either a TimeBox or a list[TimeBox] object. For more information see get_default_circuit_generation_function()

Parameters:
Return type:

list[TimeBox]

static default_sweep_generation_function(components, chip_topology, settings)#

The sweep generation function is a Callable that returns the type Sweeps. For more information see get_default_sweep_generation_function()

Parameters:
Return type:

list[Sweep | tuple[Sweep, …]]

static default_analyze_function(components, run_result, **kwargs)#

The sweep generation function is a Callable that returns an AnalyzeResult object. For more information see get_default_analyze_function()

Parameters:
Return type:

AnalyzeResult

default_options: ExperimentOptions | None = None#

Default experiment options. Inheriting classes may override this attribute to suit their use case.

default_label = 'Multi Qubit Experiment'#

The default label for the experiment. Inheriting classes may override this attribute.

allowed_qpu_types: Iterable[QPUType] = [QPUType.CRYSTAL, QPUType.STAR]#

Defines if the experiment supports only star or normal QPUs. By default all QPU types are supported. Inheriting classes can override this attribute.

allowed_component_grouping_modes: list[str] = ['list', 'group', 'colour_group']#

Only for backwards compatibility, does not actually do anything anymore.

parallel_group: ParallelGroup | str = 'none'#

Unit of parallelization for the experiment. Determines the logic for processing and validation of the experiment’s run components (see process_run_components()). Certain commonly encountered parallel groups are defined in ParallelGroup, but a custom string may also be used and the process_run_components() may be overridden to process these appropriately.

input_type: InputType = 'TimeBox'#

Input type of the Experiment class. See InputType.

final classmethod from_dut_label(*, dut_label, label)#

Construct an Experiment instance for loading and re-analyzing old run data.

Gets the station properties from ExaRuntime.storage. Cannot be used for executing new runs.

Parameters:
  • dut_label (str) – Constructed Experiment instance will refer to this QPU/station instead of the the one you’re connected to.

  • label (str) – Human-readable label for this experiment.

Returns:

Experiment instance for loading and re-analyzing old data.

Return type:

Self

property executor: ExecutorInterface#

The instance implementing the ExecutorInterface that this experiment will use when running.

Returns:

The active executor instance.

property storage: StorageInterface#

The instance implementing the StorageInterface that this experiment will use when running.

Returns:

The active storage instance.

property chad: CHAD#

The CHAD data this experiment will use when running.

static has_required_gates()#

Check whether the station provides all gates required by the circuit generation function.

Subclasses should override this method to verify availability of any non-default gates they depend on.

Note

Currently overridden only by experiment classes that require the MOVE operation.

Return type:

bool

get_default_circuit_generation_function()#

Circuit generation function for this experiment.

By default, the function stored (as a static method) in the attribute default_circuit_generation_function is returned, but in case more complex logic (including any number of self calls) is needed for determining the function, the default method can be fully overridden in inheriting classes.

The circuit generation function (CGF) is a Callable that produces the control schedule the experiment wants to execute. There are two kinds of CGFs, which are identified by inspecting their signature:

  1. Subcircuit CGF: Has group: tuple[str, ...] and builder: ScheduleBuilder as its first two parameters. Returns a TimeBox that contains the control schedule for the parallelisable unit of QPU component names given in group. parallel_group determines how the different groups of simultaneously parallelizable units (also called color groups since determining them is a graph coloring problem) are derived from the components given to create(). All the subcircuit TimeBoxes corresponding to the same parallel group are automatically wrapped into the full circuit Timebox, which runs them in parallel.

  2. Full circuit CGF: Has components: ComponentGrouping and builder: ScheduleBuilder as its first two parameters. Returns a list[TimeBox] that represents the full circuit control schedule.

In addition to the above required parameters, a CGF may have any number of additional args which may have default values. The default values will be added as Settings in the settings tree unless they are defined as default circuit settings (see get_default_circuit_settings()).

Note that couplers are not given as default arguments to the CGF. They are accessible via the builder argument (mostly implicitly, as the user does not have to usually adress the couplers; the builder will do that under the hood). If the user explicitly includes the couplers in the run components, they will be accessible in the components argument.

The CGF gets the values for its extra parameters from the following sources in this order of precedence:

  1. Sweeps that are defined for a parameter with the same name as the argument. These can come from either get_default_sweeps() or given by the user in the run() argument sweeps.

  2. Circuit settings values given by the user after if they have defined a parameter of the same name in get_default_circuit_settings() (or by inserting a parameter manually to circuit_settings). These values can be inserted in several places: manually in the notebook/runtime, in get_settings() by overriding update_settings() or in the actual setting definitions in get_default_circuit_settings() (as the default value of the Setting).

  3. The default values provided for the parameters in the definition of the CGF that do not have a circuit setting in circuit_settings (these will still be added to the settings tree but without any labels or units).

Returns:

Circuit generation function.

Return type:

SubTGF | FullTGF

get_default_circuit_settings()#

Override to define default circuit parameters.

Enables specifying default values and units for circuit generation function parameters. This method should return a list of Settings that will be added in the settings tree (including their units). Then if their name coincides with an argument of the circuit_generation_function, their value will be used to generate a circuit (you can add circuit settings which do not coincide with an argument of the circuit generation function).

Returns:

The default circuit settings. These will be added in the Settings tree alongside with their units.

Return type:

list[Setting]

setup_additional_init_properties()#

Override to e.g. change the observation loading rules or register new gate implementations for this experiment instance.

Here you may add new components to self.observation_handler, or new observation to be loaded for a given component and change the default observations rules associated with any component and observation. Note that any active global observation rules will override whatever defaults you add here (including the defaults added to new observations you yourself added in this method).

You can also register here a specific gate implementation needed only in this experiment.

Return type:

None

get_default_sweeps(components, settings)#

Default sweep definition for the experiment.

Calls get_default_sweep_generation_function(), and then calls the returned function to generate the sweeps, applying automatic parallelization logic for group-wise sweep generation functions.

Sweeps defined as the input argument of the run() method take precedence. The default sweeps are assumed to be done in the innermost loop.

The default sweeps can be defined for any parameter in settings tree (including pulse parameters and circuit parameters), or for a parameter whose name coincides with a circuit_generation_function argument.

Hint

For a parallel Rabi experiment, this method could return Sweep(parameter=<parameter for the I amplitude of a PRX gate>, data=[...]) for all the qubits.

Note

Overriding this method is allowed for backwards compatibility, but should be done anymore. Define default_sweep_generation_function instead.

Parameters:
  • components (ComponentGrouping) – Qubits and couplers for which the sweeps are defined.

  • settings (SettingNode) – Full settings object for the experiment.

Returns:

Default sweeps.

Return type:

list[Sweep | tuple[Sweep, …]]

get_default_sweep_generation_function()#

Return the sweep generation function.

Returns the static method default_sweep_generation_function, with all its non-standard parameters bound to the values of similarly named attributes in :attr`options`, if they exist.

default_sweep_generation_function can be either a full function or a group-wise function, acting on the defined parallelisable unit of the experiment (see parallel_group), in which case it is automatically wrapped into the full sweep function. In each case it has three standard positional parameters:

  • Group-wise functions have the standard parameters [group: tuple[str, ...], chip_topology: ChipTopology, settings: SettingNode], with group containing the QPU component names of the parallelisable group.

  • Full sweep functions have the standard parameters [components: ComponentGrouping, chip_topology: ChipTopology, settings: SettingNode], where components contains the full component grouping.

Note

If more complex logic (including any number of self calls) is needed for determining the function, this method can be fully overridden in inheriting classes, but this should be avoided.

Return type:

Callable[[…], list[Sweep | tuple[Sweep, …]]]

update_settings(qubits, couplers, settings)#

Additional updates for the settings.

Inheriting classes should override this function instead of overriding the whole get_settings. Here, you can for example:

  • Add/remove operations or settings or setting nodes.

  • Override values in the settings tree (including any values for the circuit parameters).

  • Add more validation for options.

What you should not try to do here:

Parameters:
  • qubits (list[str]) – qubits for the settings.

  • couplers (list[str]) – couplers for the settings.

  • settings (SettingNode) – the settings tree.

Return type:

None

process_run_components(components, settings=None)#

Process components and ExperimentOptions.subscribed_components inputs given by the user into parallelly runnable component groups.

The behaviour of this method is determined by parallel_group such that commonly encountered parallel groups are processed automatically. In addition, this method can be overridden in the inheriting classes for a specific behaviour needed in that class and not achieved by one of the default ParallelGroup cases.

Note that this method should never return None or empty dict which are valid values for both run argument components and options.subscribed_components. These cases must be dealt in one way or another so that a non-empty ComponentGrouping and a non-empty subscribed_components are returned.

Parameters:
  • components (ComponentGrouping) – The components given as the run argument by the user.

  • settings (SettingNode | None) – Settings to set before sweeping. Defaults to None if settings are not needed to process run components.

Returns:

Parallelization for components, subscribed_components.

Return type:

tuple[ComponentGrouping, list[str] | dict[str, list[str]]]

update_compilation_context(context, components, settings)#

Additional updates for the compilation context.

Inheriting classes should override this function instead of subclassing Compiler just to override what is in the context.

What should be done here:

  • Add additional context objects needed for compilation, eg. a Backend.

What you should not try to do here:

  • Override any existing default context object, eg. components, builder.

The context dictionary at input contains any additional keyword arguments added by the user when calling create(), and by default it is empty. The modified dictionary is then used to update the Compiler’s context.

Parameters:
  • context (dict[str, Any]) – Additional context provided by the user.

  • components (ComponentGrouping) – Component groups given to the compiler.

  • settings (SettingNode) – Full settings tree to use as reference.

Return type:

None

make_final_mutations(run)#

Make any experiment-specific changes to the final run definition.

The RunDefinition contains the complete information of the run, including both the request to be sent to Station Control, and experiment-specific details.

This method can be overridden in inheriting experiments to make any kind of last-minute mutations to the definition before it is executed. The base implementation does nothing. The method will be called as the very last step of create().

For example, this can be used to change metadata, such as the target data variables, which is needed by analysis.

This method should be used only as the last resort if the desired logic cannot be expressed using the other methods provided by Experiment.

Parameters:

run (RunDefinition) – the RunDefinition instance to mutate.

Return type:

None

get_default_analyze_function()#

Returns default analyze function.

The analyze function can be either a full analyze function, in which case it should have the arguments [components, run_result, **kwargs], and it should perform the whole analysis for the experiment.

You can also provide a group analyze function, which can have any combination of the following arguments, which will be passed in automatically:

  • group: Mandatory. (ComponentGrouping) The parallel group for the iteration.

  • analyze_result: (AnalyzeResult) Contains the dataset and all metadata.

    Can be mutated iteratively to generate analysis.

  • run_result: (RunResult) Contains the dataset and all metadata.

  • chip_topology: (ChipTopology) The chip topology data structure.

  • settings: (SettingNode) The settings tree used in the run. Also contained in result.

  • data_color: (xarray.Dataset) The data for the color group of this component group.

  • circuit_index: (int) Index of the color group.

A group analyze function can return either

  • a new AnalyzeResult object, the contents of which will be merged with results from other iterations, or

  • None. This is sufficient if result is passed as an argument and mutated by the function.

The default behaviour of this method just returns the function stored in default_analyze_function, but it can be overridden if more complex behaviour is needed.

Return type:

Callable[[…], AnalyzeResult | None]

analyze(components=None, run_index=-1, analyze_function=None, **kwargs)#

Analyzes an experiment run and returns the result.

Based on the used analyze function (either the one returned by get_default_analyze_function() or the argument analyze_function), it will either just apply the function to the run result specified by run_index (full analyze function) or loop through the parallelly runnable partitions of the QPU (colours) and further the parallel groups within, building the full analyze result iteratively (group analyze function). The former and latter cases are automatically detected by inspection the signature of the provided analyze function.

Note

Overriding this method is allowed for backwards compatibility, but will be restricted in the future.

Parameters:
Returns:

The analyze result.

Return type:

AnalyzeResult

final get_settings(qubits=None, couplers=None, computational_resonators=None)#

Retrieves and modifies settings for Experiment.

Parameters:
  • qubits (list[str] | None) – The qubits to get the settings for. If None, all qubits found in the CHAD will be used instead.

  • couplers (list[str] | None) – The couplers to get the settings for. If None, all couplers connecting the qubits defined above will be used.

  • computational_resonators (list[str] | None) – Names of the computational resonators. If None, all resonators found in the CHAD will be used.

Returns:

The settings tree.

Return type:

SettingNode

final create(components=None, default_sweep_ranges=None, sweeps=None, settings=None, context=None)#

Create a complete RunDefinition for a new run.

This method formulates the complete definition of the run from user inputs. It is used when an experiment is run, and defines the arguments accepted by run(). create can be called manually to inspect the content of the RunDefinition.

Parameters:
  • components (list[str] | list[tuple[str, ...]] | list[list[tuple[str, ...]]] | None) – The names of the “computational” components for the experiment. Typically, this means the qubits that are involved in the playlist generation, but in specific experiments this could be anything else as well (e.g. the couplers or some combination of the couplers and qubits). The components can be given as a flat list, a grouped list (list of tuples) or as an already partitioned list (i.e. “colour groups”) of lists of tuples.

  • default_sweep_ranges (list[None | SweepOptions | ndarray | tuple[SweepOptions | ndarray]] | dict[str | Parameter, SweepOptions | ndarray] | None) – New ranges for the default sweeps. These values replace the sweep.options defined in the sweeps in get_default_sweeps().

  • sweeps (list[Sweep | tuple[Sweep, ...]] | None) – Additional user-defined sweeps.

  • settings (SettingNode | None) – All settings to set before sweeping. By default, uses the return value of get_settings() when called without arguments.

  • context (dict[str, Any] | None) – Optional custom Compiler context.

Returns:

A definition for a new run and the Compiler context.

Return type:

ExperimentDefinition

final run(components=None, default_sweep_ranges=None, sweeps=None, settings=None, context=None)#

Run the experiment to get results.

The run result is appended to run_results.

Parameters:
  • components (list[str] | list[tuple[str, ...]] | list[list[tuple[str, ...]]] | None) – The names of the “computational” components for the experiment. Typically, this means the qubits that are involved in the playlist generation, but in specific experiments this could be anything else as well (e.g. the couplers or some combination of the couplers and qubits). The components can be given as a flat list, a grouped list (list of tuples) or as an already partitioned list (i.e. “colour groups”) of lists of tuples.

  • default_sweep_ranges (list[None | SweepOptions | ndarray | tuple[SweepOptions | ndarray]] | dict[str | Parameter, SweepOptions | ndarray] | None) – New ranges for the default sweeps. These values replace the sweep.options defined in the sweeps in get_default_sweeps().

  • sweeps (list[Sweep | tuple[Sweep, ...]] | None) – Additional user-defined sweeps.

  • settings (SettingNode | None) – All settings to set before sweeping. By default, uses the return value of get_settings() when called without arguments.

  • context (dict[str, Any] | None) – Optional custom Compiler context.

Returns:

self.

Return type:

Self

final submit_run(exp_definition)#

Submit an experiment for execution on Station Control, wait for the results and post-process them.

ExperimentDefinition.run_definition.additional_run_properties is recorded in the database.

Note

Experiment does not currently support stateful effects recorded in the Compiler context to be used when post-processing the return data. The reason is that Experiment runs need to be loadable from the DB such that the post-processing is applicable. The Compiler context is not generally serializable, so relying on data stored in it during the compilation (before execution) would break the loadability. Therefore, an empty context is used for the post-processing (the post-processing stages can still be stateful and utilize the context, but they cannot rely on information stored during the pre-execution compilation).

Parameters:

exp_definition (ExperimentDefinition) – Experiment definition (the run definition and the compiler context).

Return type:

None

final register_gate_implementation(gate_name, impl_name, impl_class, set_as_default=False, quantum_op=None)#

Register new gate implementation for this experiment instance.

Parameters:
  • gate_name (str) – The gate name for which to register a new implementation.

  • impl_name (str) – The “human-readable” name with which the new gate implementation will be found e.g. in settings.

  • impl_class (type[GateImplementation]) – The class of the new gate implementation to be added.

  • set_as_default (bool) – Whether to set the new implementation as the default implementation for the gate.

  • quantum_op (QuantumOp | None) – The quantum operation impl_class implements, which is separately registered if given. If None, gate_name must already have been registered.

Return type:

None

final set_calibration_data_for_gate_implementation(gate_name, impl_name, calib_data)#

Set calibration data for a gate implementation in this experiment instance.

The result is as if this data was provided in the experiment config.

Parameters:
  • gate_name (str) – The gate name for which to register a new implementation.

  • impl_name (str) – The “human-readable” name with which the new gate implementation will be found e.g. in settings.

  • calib_data (dict[tuple[str, ...], dict[str, Any]]) – Dict containing the calibration data. It should have the following structure: {<locus tuple1>: {<param1_name>: <param1_value>, <param2_name>: <param2_value>, ...}}

Return type:

None

final set_gate_implementation_as_default(gate_name, impl_name)#

Set this gate implementation as default for this experiment instance.

Parameters:
  • gate_name (str) – The gate name for which to register a new implementation.

  • impl_name (str) – The “human-readable” name with which the new gate implementation will be found e.g. in settings.

Return type:

None

final inspect_segment(components=None, default_sweep_ranges=None, sweeps=None, settings=None, *, run_definition=None, segments=(0,), render_output=True)#

Visualise the segments of a playlist.

If run_definition is given, visualizes its playlist. Otherwise generates a run definition instance using the first four parameters.

Parameters:
Returns:

HTML string or the string wrapped in to an HTML object.

Return type:

HTML | str

property last_run: RunResult#

Get the results from the latest run.

Raises:

ValueError – No runs have been executed

Returns:

Run result which contains the post-processed dataset for the most recent run.

final chip_properties(component_type, property_type='design')#

Get a selected properties of chip components.

The properties are extracted from station control’s chip design record. If the record does not contain some information that matches the filters, no error is raised, the dictionary will simply be empty on that part.

Parameters:
  • component_type (Literal['qubit', 'tunable_coupler', 'computational_resonator', 'probe_line']) – Return properties only for these kinds of components.

  • property_type (Literal['design', 'fabrication']) – Return only these kinds of properties.

Returns:

A mapping from canonical component names to (undocumented) dictionaries of properties.

Return type:

dict[str, dict[str, Any]]

final default_sweep_parameters(components, settings=None)#

Returns default sweep parameters.

Parameters:
  • components (ComponentGrouping) – Qubits and couplers for which the sweeps are defined.

  • settings (SettingNode | None) – All settings to set before sweeping.

Returns:

List of sweep parameters

Return type:

list[Parameter]

final print_default_sweeps(components=None, settings=None)#

Prints the default sweeps from get_default_sweeps() in a human-readable format.

Parameters:
Return type:

None

final get_default_sweeps_as_dict(components=None, settings=None)#

Returns the default sweeps from get_default_sweeps() as a dict that can be fed to run().

The sweeps are returned in a flat dict with the parameter names as keys and the sweep data as values.

Parameters:
Returns:

The default sweeps as a dict.

Return type:

dict[str, Annotated[list[Any] | ndarray, PlainValidator(func=~exa.common.control.sweep.sweep_values.validate_sweep_values, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.control.sweep.sweep_values.serialize_sweep_values, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)]]

final static get_by_run_id(run_id)#

Get an instance of the Experiment that produced run_id, holding its run result.

This method is for accessing legacy data. To access runs sumbitted via IQM Server, use get_by_job_id().

If the name of the experiment in the database does not match any currently imported Experiment class, will try to load and post-process the data using the base class Experiment. In this case, the experiment-specific analysis is not available. If the post-processing also fails, a stub Experiment containing only the raw data is returned.

Note

The old result is loaded from an EXA database, so you must initialize EXA with a connection to the database that holds your run. In most on-premises installations there is just one shared database that is automatically accessed through STATION_CONTROL_SERVICE_URL or IQM_SERVER_URL.

Warning

The returned Experiment instance should only be used to view and analyze old run data, not execute new runs, since it refers to the station that produced the old run, and not necessarily the station you’re connected to. If you want to execute new runs, create another instance of the correct Experiment subclass and use it instead.

Parameters:

run_id (UUID) – ID of a run that exists in the database.

Returns:

An instance of the Experiment subclass that produced run_id. The dataset is accessible through the last_run attribute.

Return type:

Experiment

final static get_by_job_id(job_id)#

Get an instance of the Experiment that produced job_id, holding its run result.

If the name of the experiment in the database does not match any currently imported Experiment class, will try to load and post-process the data using the base class Experiment. In this case, the experiment-specific analysis is not available. If the post processing also fails, a stub Experiment containing only the raw data is returned.

Note

The old result is loaded from an EXA database, so you must initialize EXA with a connection to the database that holds your run. In most on-premises installations there is just one shared database that is automatically accessed through IQM_SERVER_URL.

Warning

The returned Experiment instance should only be used to view and analyze old run data, not execute new runs, since it refers to the station that executed the old run, and not necessarily the station you’re connected to. If you want to execute new runs, create another instance of the correct Experiment subclass and use it instead.

Parameters:

job_id (UUID) – ID of a run job that exists in the database.

Returns:

An instance of the Experiment that produced job_id. The dataset is accessible through the last_run attribute.

Return type:

Experiment

final static remove_operations(settings, component_or_group, operations)#

Removes the given operations from the settings tree under the given component or group.

Note

The removed operations are not validated in any way. It is possible that the experiment produces unwanted results or does not even work properly when run with the resulting settings.

Parameters:
  • settings (SettingNode) – Setting tree that one wants to modify.

  • component_or_group (str | Sequence[str]) – Single component, or component group, or a list of components or component groups from which to remove the operations.

  • operations (list[str]) – Operations to remove.

Returns:

A new settings tree with operations removed from component_or_group.

Return type:

SettingNode

Inheritance

Inheritance diagram of exa.core.experiment.experiment.Experiment