Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BaseCalibrationExperiment for composite experiment #1033

Merged

Conversation

nkanazawa1989
Copy link
Collaborator

Summary

This PR updates the mechanism to invoke update_calibrations method so that it can be called from the composite experiment.

fix #969

Details and comments

Composite experiment only takes circuits from individual experiment instance and calls analysis.run of each experiment. If update_calibrations is called from experiment.run it will be never called from the composite experiments. This indicates we need to formally implement post analysis or chained analysis to update calibrations. However, this is overkill just to update calibrations. This PR implements minimum logic to invoke the updator as a part of analysis.run.

Since unittest coverage is almost zero for composite calibration experiments, I newly added several unittests.

@nkanazawa1989 nkanazawa1989 added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Feb 3, 2023
@nkanazawa1989 nkanazawa1989 marked this pull request as ready for review February 3, 2023 17:15
@@ -148,6 +148,37 @@ def calibrations(self) -> Calibrations:
"""Return the calibrations."""
return self._cals

@property
def analysis(self) -> Union[BaseAnalysis, None]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the reason to redefine here, if already defined in BaseExperiment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can also do @BaseExperiment.analysis.setter but we cannot override only setter in the subclass as far as I understand.

Copy link
Contributor

@eggerdj eggerdj left a comment

Choose a reason for hiding this comment

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

This looks good to me. Only minor comments. Also, thanks for adding the tests!


@analysis.setter
def analysis(self, analysis: Union[BaseAnalysis, None]) -> None:
"""Set the analysis instance for the experiment"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a bit of doc here to state that this is here so that update calibrations is called and so that this also works with composite experiments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

note section is added to the property method rather than here. I think setter method doesn't appear in the API doc and one needs to read the code anyways to find the comment. Note that such comment is already in the method. Now note will appear with the updated property method.

nkanazawa1989 and others added 2 commits February 13, 2023 18:53
Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>
Copy link
Contributor

@eggerdj eggerdj left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@nkanazawa1989 nkanazawa1989 merged commit 3cb1cda into qiskit-community:main Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parallel calibration experiments don't update the calibrations object
3 participants