Note

This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.

AnalysisResult

class AnalysisResult(name=None, value=None, device_components=None, experiment_id=None, result_id=None, chisq=None, quality='unknown', extra=None, verified=False, tags=None, service=None, source=None)[source]

Class representing an analysis result for an experiment.

Analysis results can also be stored using the experiments service.

The field db_data is a dataclass (ExperimentDataclass) containing all the data that can be stored with the service and loaded from it, and as such is subject to strict conventions.

Other data fields can be added and used freely, but they won’t be saved to the database.

Note that the result_data field of the dataclass is by itself a dictionary capable of holding arbitrary values (in a dictionary indexed by a string).

The data fields in the db_data dataclass are:

  • experiment_id: str

  • result_id: str

  • result_type: str

  • device_components: List[str]

  • quality: str

  • verified: bool

  • tags: List[str]

  • backend_name: str

  • chisq: float

  • result_data: Dict[str]

Analysis data that does not fit into the other fields should be added to the result_data dict, e.g. curve parameters in experiments doing a curve fit.

AnalysisResult constructor.

Parameters:
  • name (Optional[str]) – analysis result name.

  • value (Optional[Any]) – main analysis result value.

  • device_components (Optional[List[Union[DeviceComponent, str]]]) – Target device components this analysis is for.

  • experiment_id (Optional[str]) – ID of the experiment.

  • result_id (Optional[str]) – Result ID. If None, one is generated.

  • chisq (Optional[float]) – Reduced chi squared of the fit.

  • quality (Optional[str]) – Quality of the analysis. Refer to the experiment service provider for valid values.

  • extra (Optional[Dict[str, Any]]) – Dictionary of extra analysis result data

  • verified (bool) – Whether the result quality has been verified.

  • tags (Optional[List[str]]) – Tags for this analysis result.

  • service (Optional[IBMExperimentService]) – Experiment service to be used to store result in database.

  • source (Optional[Dict[str, str]]) – Class and Qiskit version information when loading from an experiment service.

Returns:

The AnalysisResult object.

Attributes

AnalysisResult.RESULT_QUALITY_TO_TEXT

AnalysisResult.auto_save

Return current auto-save option.

AnalysisResult.chisq

Return the reduced χ² of this analysis.

AnalysisResult.device_components

Return target device components for this analysis result.

AnalysisResult.experiment_id

Return the ID of the experiment associated with this analysis result.

AnalysisResult.extra

Return extra analysis result data.

AnalysisResult.name

Return analysis result name.

AnalysisResult.quality

Return the quality of this analysis.

AnalysisResult.result_id

Return analysis result ID.

AnalysisResult.service

Return the database service.

AnalysisResult.source

Return the class name and version.

AnalysisResult.tags

Return tags associated with this result.

AnalysisResult.value

Return analysis result value.

AnalysisResult.verified

Return the verified flag.

AnalysisResult.version

Methods

AnalysisResult.copy()

Return a copy of the result with a new result ID

AnalysisResult.default_source()

The default source dictionary to generate

AnalysisResult.format_result_data(value, ...)

Formats the result data from the given arguments

AnalysisResult.load(result_id, service)

Load a saved analysis result from a database service.

AnalysisResult.save([suppress_errors])

Save this analysis result in the database.

AnalysisResult.set_data(data)

Sets the analysis data stored in the class