Skip to content

Conversation

@chriseclectic
Copy link
Collaborator

Summary

Fix bug with CompositeExperiment.copy so that it will preserve any analysis object references between the original component experiment analysis classes and the composite analysis component analysis classes.

Details and comments

Currently when a copy happens this reference is broken so that the copies component experiment analysis classes are not the same object as the analysis copies component analysis classes, even if they were in the original experiment

Fix CompositeExperiment.copy to preserve any analysis object references between the original component experiment analysis classes and the composite analysis component analysis classes.
@chriseclectic chriseclectic added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Feb 8, 2022
Copy link
Collaborator

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

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

LGTM

# Check if the analysis in CompositeAnalysis was a reference to the
# original component experiment analyses and if so update the copies
# to preserve this relationship
if isinstance(self.analysis, CompositeAnalysis):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like Tphi experiment unintentionally breaks this relationship. This there any safer logic for developer to notify this? This is not the scope of this PR.
https://github.com/Qiskit/qiskit-experiments/blob/66002c536777f955b7349057c0f60924d98dc940/qiskit_experiments/library/characterization/tphi.py#L104-L108

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if it was intended or not for Tphi, but if analysis was supposed to be a reference line 108 should be changed to be TphiAnalysis(analyses=[exp_t1.analysis, exp_t2.analysis])

@chriseclectic chriseclectic merged commit 9553d0b into qiskit-community:main Feb 9, 2022
paco-ri pushed a commit to paco-ri/qiskit-experiments that referenced this pull request Jul 11, 2022
Fix CompositeExperiment.copy to preserve any analysis object references between the original component experiment analysis classes and the composite analysis component analysis classes.
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.

2 participants