- Notifications
You must be signed in to change notification settings - Fork441
Documentation updates and testing#1038
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Documentation updates and testing#1038
Uh oh!
There was an error while loading.Please reload this page.
Conversation
coveralls commentedAug 9, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
c9a07c1
to4ef9dd6
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I plan to finish review tomorrow.
control/ctrlplot.py Outdated
@@ -220,6 +221,10 @@ def suptitle( | |||
def get_plot_axes(line_array): | |||
"""Get a list of axes from an array of lines. | |||
.. deprecated:: 0.10.1 | |||
This function will be removed in a future version of python-control. | |||
Use `cplt.axes` to obtain axes for a control plot `cplt`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Use`cplt.axes`toobtainaxesforacontrolplot`cplt`. | |
Use`cplt.axes`toobtainaxesforaninstanceof :class:`ControlPlot`. |
Even thoughget_plot_axes()
is defined in the same module (ctrlplot
) asControlPlot
, it is available at the top of the package ascontrol.get_plot_axes()
, so a user may not realize thatcplt
abbreviates the new classControlPlot
. E.g., observe howget_plot_axes()
is shown athttps://python-control.readthedocs.io/en/0.10.0/generated/control.get_plot_axes.html.
Therefore, I recommend to be explicit here when referring to the classControlPlot
.
control/ctrlplot.py Outdated
@@ -268,6 +274,9 @@ def pole_zero_subplots( | |||
Scaling to apply to the subplots. | |||
fig : :class:`matplotlib.figure.Figure` | |||
Figure to use for creating subplots. | |||
rcParams : dict | |||
Override the default parameters used for generating plots. | |||
Default is set up config.default['freqplot.rcParams']. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Defaultissetupconfig.default['freqplot.rcParams']. | |
Defaultissetupconfig.default['ctrlplot.rcParams']. |
Frequency label (defaults to "rad/sec" or "Hertz") | ||
freq_label, magnitude_label, phase_label : str, optional | ||
Labels to use for the frequency, magnitude, and phase axes. | ||
Defaults are set by `config.defaults['freqplot.<keyword>']`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I like that descriptions of these parameter are combined, but in this case,magnitude_label
andphase_label
should be deleted below.
control/freqplot.py Outdated
show_legend : bool, optional | ||
Force legend to be shown if ``True`` or hidden if ``False``. If | ||
``None``, then show legend when there is more than one line on an | ||
axis or ``legend_loc`` or ``legend_map`` has been specified. | ||
title : str, optional | ||
Set the title of the plot. Defaults to plot type and system name(s). | ||
title_frame : str, optional | ||
Set the frame of reference used to center the plot title. If set to | ||
'axes' (default), the horizontal position of the title will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
'axes' (default),thehorizontalpositionofthetitlewill | |
'axes' (default),thehorizontalpositionofthetitlewillbe |
control/freqplot.py Outdated
title_frame : str, optional | ||
Set the frame of reference used to center the plot title. If set to | ||
'axes' (default), the horizontal position of the title will | ||
centered relative to the axes. If set to `figure`, it will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
centeredrelativetotheaxes.Ifsetto`figure`,itwillbe | |
centeredrelativetotheaxes.Ifsetto'figure',itwillbe |
To be consistent with 'axes' and other strings in these parameter descriptions, this should be 'figure' rather than `figure`.
control/freqplot.py Outdated
title_frame : str, optional | ||
Set the frame of reference used to center the plot title. If set to | ||
'axes' (default), the horizontal position of the title will | ||
centered relative to the axes. If set to `figure`, it will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
centeredrelativetotheaxes.Ifsetto`figure`,itwillbe | |
centeredrelativetotheaxes.Ifsetto'figure',itwillbe |
To be consistent with 'axes' and other strings in these parameter descriptions, this should be 'figure' rather thanfigure
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Excellent work on the docstrings checker. It seems useful enough to be offered to thenumpydoc repository or made into aruff rule.
I added several more small comments. After considering those, this is ready to merge.
control/statesp.py Outdated
inputs : int, list of str, or None | ||
Description of the system inputs. This can be given as an integer | ||
states : int, list of str, or None | ||
Description of the system states. Same format as `inputs`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Descriptionofthesystemstates.Sameformatas`inputs`. | |
Descriptionofthesystemstates.Sameformatas`outputs`. |
Forinputs
, we have "Same format asoutputs
." Best to just point from here tooutputs
(instead ofinputs
, which in turn points tooutputs
).
control/phaseplot.py Outdated
@@ -985,6 +1013,9 @@ def phase_plot(odefun, X=None, Y=None, scale=1, X0=None, T=None, | |||
"""(legacy) Phase plot for 2D dynamical systems. | |||
.. deprecated:: 0.10.1 | |||
This function is deprecated; use `phase_plane_plot` instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thisfunctionisdeprecated;use`phase_plane_plot`instead. | |
Thisfunctionisdeprecated;use:func:`phase_plane_plot`instead. |
Else, Sphinx/numpydoc will not create a link.
@@ -1243,14 +1274,18 @@ def phase_plot(odefun, X=None, Y=None, scale=1, X0=None, T=None, | |||
def box_grid(xlimp, ylimp): | |||
"""box_grid generate list of points on edge of box | |||
.. deprecated:: 0.10.0 | |||
Use :func:`phaseplot.boxgrid` instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Note that neitherboxgrid()
norbox_grid()
appear in the generated user's manual, so this:func:
link is not used anywhere that I observed.
control/tests/docstrings_test.py Outdated
if f"*{argname}" not in docstring and verbose: | ||
print(f" {name} has positional arguments; " | ||
"check manually") | ||
warnings.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
iff"*{argname}"notindocstringandverbose: | |
print(f"{name} has positional arguments; " | |
"check manually") | |
warnings.warn( | |
iff"*{argname}"notindocstring: | |
ifverbose: | |
print(f"{name} has positional arguments; " | |
"check manually") | |
warnings.warn( |
This warning message should be sent independently ofverbose
.
ecf6a38
intopython-control:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
This PR provides updated docstrings for a large number of functions that had undocumented arguments, along with a unit test that checks to make sure that positional arguments and keyword arguments are appropriately documented. The unit test (
docstring_test.py
) checks for the following:FutureWarning
.Implementing this unit test picked up ~30 undocumented variables that are now documented, as well as triggering a few changes in argument processing and some argument hiding (for internal arguments that the user should never call, which now should start with an underscore).
This PR contains no changes in functionality, just docstring updates and small code changes for consistency (eg,
DeprecationWarning
[which is ignored/hidden by default] →FutureWarning
[which generates a user-visible warning]).