Skip to content

Commit 6bdc6ef

Browse files
conradhaupteggerdjnkanazawa1989
committed
Update docstrings
Co-authored-by: Daniel J. Egger <[email protected]> Co-authored-by: Naoki Kanazawa <[email protected]>
1 parent b604350 commit 6bdc6ef

File tree

6 files changed

+15
-19
lines changed

6 files changed

+15
-19
lines changed

qiskit_experiments/curve_analysis/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ class AnalysisB(CurveAnalysis):
318318
compute custom quantities based on the raw fit parameters.
319319
See :ref:`curve_analysis_results` for details.
320320
Afterwards, the analysis draws several curves in the Matplotlib figure.
321-
User can set custom plotter to the option ``plotter``.
322-
The plotter defaults to the :class:`CurvePlotter`.
321+
Users can set a custom plotter in :class:`CurveAnalysis` classes, to customize
322+
figures, by setting the :attr:`~CurveAnalysis.plotter` attribute.
323323
Finally, it returns the list of created analysis results and Matplotlib figure.
324324
325325

qiskit_experiments/curve_analysis/composite_curve_analysis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,14 @@ def _run_analysis(
352352
params=fit_data.ufloat_params,
353353
)
354354
y_mean = unp.nominal_values(y_data_with_uncertainty)
355-
# Draw fit line
355+
# Add fit line data
356356
self.plotter.set_series_data(
357357
model._name + f"_{analysis.name}",
358358
x_interp=interp_x,
359359
y_mean=y_mean,
360360
)
361361
if fit_data.covar is not None:
362-
# Draw confidence intervals with different n_sigma
362+
# Add confidence interval data
363363
sigmas = unp.std_devs(y_data_with_uncertainty)
364364
if np.isfinite(sigmas).all():
365365
self.plotter.set_series_data(model._name, sigmas=sigmas)

qiskit_experiments/curve_analysis/curve_analysis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,14 +558,14 @@ def _run_analysis(
558558
params=fit_data.ufloat_params,
559559
)
560560
y_mean = unp.nominal_values(y_data_with_uncertainty)
561-
# Draw fit line
561+
# Add fit line data
562562
self.plotter.set_series_data(
563563
model._name,
564564
x_interp=interp_x,
565565
y_mean=y_mean,
566566
)
567567
if fit_data.covar is not None:
568-
# Draw confidence intervals with different n_sigma
568+
# Add confidence interval data
569569
sigmas = unp.std_devs(y_data_with_uncertainty)
570570
if np.isfinite(sigmas).all():
571571
self.plotter.set_series_data(

qiskit_experiments/visualization/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
5555
BaseDrawer
5656
MplDrawer
57-
LegacyCurveCompatDrawer
5857
5958
Plotting Style
6059
==============

qiskit_experiments/visualization/drawers/base_drawer.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ class BaseDrawer(ABC):
5252
5353
draw_line
5454
55-
This method plots a line from provided X and Y values. This method is typically called with
56-
interpolated x and y values from a curve-fit.
55+
This method plots a line from provided X and Y values.
5756
5857
draw_filled_y_area
5958
@@ -70,18 +69,16 @@ class BaseDrawer(ABC):
7069
draw_text_box
7170
7271
This method draws a text-box on the canvas, which is a rectangular region containing some text.
73-
This method is typically called with a list of analysis results and reduced chi-squared values
74-
from a curve-fit.
7572
7673
Options and Figure Options
7774
==========================
7875
7976
Drawers have both :attr:`options` and :attr:`figure_options` available to set parameters that define
80-
how to drawer and what is drawn. :class:`BasePlotter` is similar in that it also has ``options`` and
81-
``figure_options`. The former contains class-specific variables that define how an instance behaves.
82-
The latter contains figure-specific variables that typically contain values that are drawn on the
83-
canvas, such as text. For details on the difference between the two sets of options, see the
84-
documentation for :class:`BasePlotter`.
77+
how to draw and what is drawn, respectively. :class:`BasePlotter` is similar in that it also has
78+
``options`` and ``figure_options`. The former contains class-specific variables that define how an
79+
instance behaves. The latter contains figure-specific variables that typically contain values that
80+
are drawn on the canvas, such as text. For details on the difference between the two sets of options,
81+
see the documentation for :class:`BasePlotter`.
8582
8683
.. note::
8784
If a drawer instance is used with a plotter, then there is the potential for any figure-option
@@ -337,11 +334,11 @@ def draw_line(
337334
legend: bool = False,
338335
**options,
339336
):
340-
"""Draw fit line.
337+
"""Draw a line.
341338
342339
Args:
343340
x_data: X values.
344-
y_data: Fit Y values.
341+
y_data: Y values.
345342
name: Name of this series.
346343
label: Optional legend label to override ``name`` and ``series_params``.
347344
legend: Whether the drawn area must have a legend entry. Defaults to False.

qiskit_experiments/visualization/plotters/base_plotter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def __init__(self, drawer: BaseDrawer):
115115
"""
116116
# Data to be plotted, such as scatter points, interpolated fits, and confidence intervals
117117
self._series_data: Dict[str, Dict[str, Any]] = {}
118-
# Data for figure-wide drawing, unrelated to series data, such as text or fit reports.
118+
# Data that isn't directly associated with a single series, such as text or fit reports.
119119
self._figure_data: Dict[str, Any] = {}
120120

121121
# Options for the plotter

0 commit comments

Comments
 (0)