-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
The versions of My environment:
- forest benchmarking version: 0.8.0
- pyQuil version: 3.5.4
- qvm version: 1.17.1 [cf3f91f]
- quilc version: 1.23.0 [e6c0939]
Describe the bug
When using the plot_figure_for_fit function, in line 230 fit_result.plot_residuals(ax=axs[1], data_kws=FIT_PLOT_KWS["data_kws"], fit_kws=FIT_PLOT_KWS["fit_kws"]), the input FIT_PLOT_KWS["fit_kws"] includes color parameter. And the plot_residuals function in the lmfit package, in line 2183, ax.axhline(0, **fit_kws, color='k') itself has a color parameter, which will cause the following error:
TypeError Traceback (most recent call last)
Cell In[11], line 3
1 from forest.benchmarking.plotting import plot_figure_for_fit
----> 3 fig, ax = plot_figure_for_fit(fit_1q, xlabel="Sequence Length [Cliffords]", ylabel="Survival Probability", title='RB Decay for q2')
4 rb_decay_q2 = fit_1q.params['decay'].value
5 # ax.axhline(0, color='k')
File d:\anaconda\envs\quantum-RB\lib\site-packages\forest\benchmarking\analysis\fitting.py:230, in plot_figure_for_fit(fit_result, xlabel, ylabel, xscale, yscale, title, figsize, axis_fontsize, report_fontsize )
228 # plot the fits and residuals
229 fit_result.plot_fit(ax=axs[0], **FIT_PLOT_KWS)
--> 230 fit_result.plot_residuals(ax=axs[1], data_kws=FIT_PLOT_KWS["data_kws"],
231 fit_kws=FIT_PLOT_KWS["fit_kws"])
233 # title and labels
234 axs[1].set_title('')
File d:\anaconda\envs\quantum-RB\lib\site-packages\lmfit\model.py:54, in _ensureMatplotlib.<locals>.wrapper(*args, **kws)
52 @wraps(function)
53 def wrapper(*args, **kws):
---> 54 return function(*args, **kws)
File d:\anaconda\envs\quantum-RB\lib\site-packages\lmfit\model.py:2183, in ModelResult.plot_residuals(self, ax, datafmt, yerr, data_kws, fit_kws, ax_kws, parse_complex, title)
2179 ax = plt.axes(**ax_kws)
2181 x_array = self.userkws[independent_var]
-> 2183 ax.axhline(0, **fit_kws, color='k')
2185 y_eval = self.model.eval(self.params, **{independent_var: x_array})
2186 if isinstance(self.model, (lmfit.models.ConstantModel,
2187 lmfit.models.ComplexConstantModel)):
TypeError: axhline() got multiple values for keyword argument 'color'Steps to reproduce the behavior
- run this Quantum Randomized Benchmarking. (forest-benchmarking/docs/examples
/randomized_benchmarking.ipynb) - when I run the code like:
from forest.benchmarking.plotting import plot_figure_for_fit
fig, ax = plot_figure_for_fit(fit_1q, xlabel="Sequence Length [Cliffords]", ylabel="Survival Probability", title='RB Decay for q2')
rb_decay_q2 = fit_1q.params['decay'].value
print(rb_decay_q2)I encountered the above error.
Possible solutions
I tried modifying FIT_PLOT_KWS, and it seems to be temporarily working.
FIT_PLOT_KWS = {
'data_kws': {'color': 'black', 'marker': 'o', 'markersize': 4.0},
'init_kws': {'color': TEAL, 'alpha': 0.4, 'linestyle': '--'},
'fit_kws': {'alpha': 1.0, 'linewidth': 2.0},
'numpoints': 1000
}
# 'color': TEAL,Metadata
Metadata
Assignees
Labels
No labels