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

Fix curve analysis multi-canvas plotting #804

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions qiskit_experiments/curve_analysis/curve_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,11 @@ def _run_analysis(
formatted_data = self._format_data(processed_data)
if self.options.plot:
for s in self.__series__:
sub_data = formatted_data.get_subset_of(s.name)
self.drawer.draw_formatted_data(
x_data=formatted_data.x,
y_data=formatted_data.y,
y_err_data=formatted_data.y_err,
x_data=sub_data.x,
y_data=sub_data.y,
y_err_data=sub_data.y_err,
name=s.name,
ax_index=s.canvas,
color=s.plot_color,
Expand Down Expand Up @@ -244,13 +245,14 @@ def _run_analysis(
alpha=alpha,
color=s.plot_color,
)
# Write fitting report
report_description = ""
for res in analysis_results:
if isinstance(res.value, (float, UFloat)):
report_description += f"{analysis_result_to_repr(res)}\n"
report_description += r"Fit $\chi^2$ = " + f"{fit_data.reduced_chisq: .4g}"
self.drawer.draw_fit_report(description=report_description)

# Write fitting report
report_description = ""
for res in analysis_results:
if isinstance(res.value, (float, UFloat)):
report_description += f"{analysis_result_to_repr(res)}\n"
report_description += r"Fit $\chi^2$ = " + f"{fit_data.reduced_chisq: .4g}"
self.drawer.draw_fit_report(description=report_description)

# Add raw data points
analysis_results.extend(self._create_curve_data(formatted_data, self.__series__))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Fix broken curve analysis output figure when multi canvas mode is enabled.
Currently this feature is only used by :class:`.CrossResonanceHamiltonianAnalysis`.
It has been plotting all series data in the same canvas due to the bug.