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

Cleanup composite analysis #1397

Conversation

nkanazawa1989
Copy link
Collaborator

Summary

Thanks to #1342 we can cleanup internals of CompositeCurveAnalysis. Not API break and no feature upgrade with this PR.

Details and comments

Previously the curve data and fit summary data are internally created in CurveAnalysis but immediately discarded. The implementation in CurveAnalysis._run_analysis is manually copied to CompositeCurveAnalysis._run_analysis to access these artifact data to create composite artifact data from them. This makes code fragile since developers needed to manually update both base classes. With this PR, implementation of component analysis is encapsulated.

@nkanazawa1989 nkanazawa1989 marked this pull request as ready for review February 8, 2024 05:50
@wshanks wshanks added the backport stable potential The issue or PR might be minimal and/or import enough to backport to stable label Feb 8, 2024
@coruscating coruscating added this to the Release 0.7 milestone Feb 8, 2024
Copy link
Collaborator

@coruscating coruscating left a comment

Choose a reason for hiding this comment

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

Thanks @nkanazawa1989, the new code is much cleaner. I only have a comment regarding a bug not from this PR.

)
)

if self.options.return_data_points:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I found a bug while testing this, return_data_points=True throws an error right now because it's trying to use the old groupby syntax with ScatterTable.

I think the fix is
https://github.com/Qiskit-Extensions/qiskit-experiments/blob/0bbd426dc257be6d35daf04d94bbb31e0d059648/qiskit_experiments/curve_analysis/base_curve_analysis.py#L356

should be curve_data.dataframe.groupby("series_name"))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for catching the bug!

Copy link
Collaborator

@coruscating coruscating 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.

@coruscating coruscating added this pull request to the merge queue Apr 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 22, 2024
@coruscating coruscating added this pull request to the merge queue Apr 22, 2024
Merged via the queue into qiskit-community:main with commit cb37d42 Apr 22, 2024
11 checks passed
mergify bot pushed a commit that referenced this pull request Apr 22, 2024
### Summary

Thanks to #1342 we can cleanup internals of `CompositeCurveAnalysis`.
Not API break and no feature upgrade with this PR.

### Details and comments

Previously the curve data and fit summary data are internally created in
`CurveAnalysis` but immediately discarded. The implementation in
`CurveAnalysis._run_analysis` is manually copied to
`CompositeCurveAnalysis._run_analysis` to access these artifact data to
create composite artifact data from them. This makes code fragile since
developers needed to manually update both base classes. With this PR,
implementation of component analysis is encapsulated.

(cherry picked from commit cb37d42)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable potential The issue or PR might be minimal and/or import enough to backport to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants