AnalyzeResult#

Module: exa.core.analyze_result.analyze_result

class AnalyzeResult(run_result, *, observations=None, plots=None, extra=None, error=None, error_traceback=None)#

Bases: object

Data object for the result of the analysis.

Parameters:
  • run_result (RunResult) – The run result containing the full dataset and run data.

  • observations (Sequence[LocalObservation] | None) – Observations produced by the analysis.

  • plots (dict[str, PlotDefinition] | None) – A dict of plot definitions, which can be used to visualize run_result.dataset.

  • extra (dict | None) – A dictionary to store extra analyze results which can’t be added to any other attribute.

  • error (str | None) – An optional string to store the summary of a possible error during analysis.

  • error_traceback (str | None) – An optional string to store the traceback of a possible error during analysis.

Attributes

dataset

Shortcut to access run_result.dataset.

settings

Shortcut to access run_result.run_definition.sweep_definition.settings.

Methods

add_arrays

Add any number of data arrays to run_result.dataset.

add_observation

Add an observation to observations.

add_observation_with_qon

Add an observation to observations.

add_parameter_observation

Add an observation to observations from a given parameter.

add_setting_observation

Add an observation to observations from a given setting.

plot

Generate and show a selected plot from plots.

plot_all

Generate and show multiple plots from plots.

render_report

Generate a report that displays the observations and plots from the analysis.

property dataset: Dataset#

Shortcut to access run_result.dataset.

property settings: SettingNode#

Shortcut to access run_result.run_definition.sweep_definition.settings.

plot(key='default', **kwargs)#

Generate and show a selected plot from plots.

Parameters:
  • key (str) – Selects which plot to show. If “default” and no “default” key exists, returns the first one.

  • kwargs – Keyword arguments passed to the generating function.

Returns:

The generated Figure.

Raises:
  • ValidationError – If no plots exist in plots.

  • KeyError – If key does not exist in plots.

Return type:

Figure

plot_all(keys=None, **kwargs)#

Generate and show multiple plots from plots.

Parameters:
  • keys (list[str] | None) – The list of plot keys to show. If left None, will show all plots in self`.

  • kwargs – Additional arguments to plot().

Returns:

The list of the generated Figures.

Raises:
  • ValidationError – if no plots exist in plots.

  • KeyError – if key does not exist in plots.

Return type:

list[Figure]

add_arrays(*args)#

Add any number of data arrays to run_result.dataset.

Hint: Use annotate() first to add parameter information.

Parameters:

args (DataArray) – DataArrays to add. Each one should have a name or “parameter” metadata.

Return type:

None

add_setting_observation(setting, value, *, uncertainty=None, tags=None, validation_rules=None)#

Add an observation to observations from a given setting.

Parameters:
  • setting (Setting) – Setting to be converted into an observation.

  • value (Annotated[bool | str | int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)]) – Value that is saved as an observation for dut_field.

  • uncertainty (Annotated[int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)] | None) – The uncertainty of the observation value. None means unknown.

  • tags (list[str] | None) – Tags used for observations.

  • validation_rules (list[Callable] | None) – The list of validation rules for the observation.

Return type:

None

add_parameter_observation(parameter, value, *, prefix='', uncertainty=None, tags=None, validation_rules=None)#

Add an observation to observations from a given parameter.

Parameters:
  • parameter (Parameter) – Parameter to be converted into an observation.

  • value (Annotated[bool | str | int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)]) – Value that is saved as an observation for dut_field.

  • prefix (str) – String, typically a component name, attached in front of the dut field, separated by a dot.

  • uncertainty (Annotated[int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)] | None) – The uncertainty of the observation value. None means unknown.

  • tags (list[str] | None) – Tags used for observations.

  • validation_rules (list[Callable] | None) – The list of validation rules for the observation.

Return type:

None

add_observation_with_qon(*, qon, value, unit, uncertainty=None, tags=None, validation_rules=None)#

Add an observation to observations.

Parameters:
  • qon (QON) – Qualified observation name of the property the observation is about.

  • unit (str) – The observation unit (base SI unit, e.g. Hz and never GHz). Can be an empty string for quantities without unit (e.g. fidelity values).

  • value (Annotated[bool | str | int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)]) – Value of the observation.

  • uncertainty (Annotated[int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)] | None) – The uncertainty of the observation value. None means unknown.

  • tags (list[str] | None) – Tags used for observations.

  • validation_rules (list[Callable] | None) – Validation rules for the observation.

Return type:

None

add_observation(dut_field, value, unit, *, uncertainty=None, tags=None, validation_rules=None)#

Add an observation to observations.

Parameters:
  • dut_field (str) – Name of the property the observation is about.

  • unit (str) – The observation unit (base SI unit, e.g. Hz and never GHz). Can be an empty string for quantities without unit (e.g. fidelity values).

  • value (Annotated[bool | str | int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)]) – Value that is saved as an observation for dut_field.

  • uncertainty (Annotated[int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)] | None) – The uncertainty of the observation value. None means unknown.

  • tags (list[str] | None) – Tags used for observations.

  • validation_rules (list[Callable] | None) – The list of validation rules for the observation.

Return type:

None

render_report(target='notebook')#

Generate a report that displays the observations and plots from the analysis.

Parameters:

target (Literal['notebook', 'str'] | ~pathlib.Path) – The target format as string or a file path. Accepted values: “notebook”, “str” or Path instance. For “notebook”, the output is a HTML document that is displayed in a Jupyter notebook. Target “str” returns HTML format in a string, and path instances saves document to a file.

Returns:

Rendered string or None if the report is rendered in notebook as a side effect.

Return type:

str

Inheritance

Inheritance diagram of exa.core.analyze_result.analyze_result.AnalyzeResult