Skip to content

Conversation

@yaelbh
Copy link
Collaborator

@yaelbh yaelbh commented Apr 27, 2021

Summary

Using AnalysisResultV1 and ExperimentDataV1 from Qiskit/qiskit#5499

Details and comments

Incomplete, not working yet

@yaelbh
Copy link
Collaborator Author

yaelbh commented Apr 27, 2021

Unlike our in-house ExperimentData, Qiskit/qiskit#5499 doesn't seem to support circuit level metadata. We can proceed in one of two ways:

  1. Use the experiment metadata (which is supported by Experiment data and service Qiskit/qiskit#5499).
  2. Make Experiment data and service Qiskit/qiskit#5499 support circuit metadata.

It appears that there was a plan to support circuit metadata in the ResultsDB (in addition to the experiment metadata), according to the ResultsDB design doc.

Which option is preferable?

@yaelbh
Copy link
Collaborator Author

yaelbh commented Apr 29, 2021

I changed my clone of PR 5499 to pass the circuit metadata, but did not bother to filter by experiment type or id. This is how the relevant function looks like:

 def _add_result_data(self, result: Result) -> None:
        """Add data from a Result object

        Args:
            result: Result object containing data to be added.
        """
        for i in range(len(result.results)):
            data = result.data(i)
            data['metadata'] = result.results[i].header.metadata
            data['job_id'] = result.job_id
            if 'counts' in data:
                # Format to Counts object rather than hex dict
                data['counts'] = result.get_counts(i)
            self._add_single_data(data)

The difference is in the addition of the line starting with data['metadata'] = ...

@yaelbh
Copy link
Collaborator Author

yaelbh commented Apr 29, 2021

I pushed some more code. It's still not working because need to figure out which index to put as an argument of Qubit. This will probably require to handle already now the story of parallel experiments.

analysis_result = AnalysisResultV1(
result_data,
'T1',
[Qubit()],
Copy link
Collaborator Author

@yaelbh yaelbh Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to enter an index here inside the parentheses

@yaelbh
Copy link
Collaborator Author

yaelbh commented May 2, 2021

Almost all T1 tests are passing now, with my own version of PR 5499, which I slightly modified to allow None backends. It remains to take care of parallel experiments.

@yaelbh yaelbh changed the title Integrate T1 experiment with result database [WIP] Integrate T1 experiment with result database May 5, 2021
# Create new experiment data
if experiment_data is None:
experiment_data = self.__experiment_data__(self)
experiment_data = self.__experiment_data__(backend, self._type)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pass options (e.g. share_level) to the experiment data constructor, coming from the run method kwargs.

@yaelbh
Copy link
Collaborator Author

yaelbh commented May 23, 2021

Closing in favor of #66

@yaelbh yaelbh closed this May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant