Skip to content

Commit bbe301a

Browse files
committed
make deprecration warnings consistent (as FutureWarning)
1 parent 8f6bba4 commit bbe301a

26 files changed

Lines changed: 124 additions & 65 deletions

control/bdalg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ def connect(sys, Q, inputv, outputv):
412412
"""Index-based interconnection of an LTI system.
413413
414414
.. deprecated:: 0.10.0
415-
`connect` will be removed in a future version of python-control in
416-
favor of `interconnect`, which works with named signals.
415+
`connect` will be removed in a future version of python-control.
416+
Use :func:`interconnect` instead, which works with named signals.
417417
418418
The system `sys` is a system typically constructed with `append`, with
419419
multiple inputs and outputs. The inputs and outputs are connected
@@ -465,7 +465,7 @@ def connect(sys, Q, inputv, outputv):
465465
466466
"""
467467
# TODO: maintain `connect` for use in MATLAB submodule (?)
468-
warn("`connect` is deprecated; use `interconnect`", DeprecationWarning)
468+
warn("connect() is deprecated; use interconnect()", FutureWarning)
469469

470470
inputv, outputv, Q = \
471471
np.atleast_1d(inputv), np.atleast_1d(outputv), np.atleast_1d(Q)

control/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def _process_legacy_keyword(kwargs, oldkey, newkey, newval):
362362
if kwargs.get(oldkey) is not None:
363363
warnings.warn(
364364
f"keyword '{oldkey}' is deprecated; use '{newkey}'",
365-
DeprecationWarning)
365+
FutureWarning)
366366
if newval is not None:
367367
raise ControlArgument(
368368
f"duplicate keywords '{oldkey}' and '{newkey}'")

control/ctrlplot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def suptitle(
212212
213213
"""
214214
warnings.warn(
215-
"suptitle is deprecated; use cplt.set_plot_title", FutureWarning)
215+
"suptitle() is deprecated; use cplt.set_plot_title()", FutureWarning)
216216
_update_plot_title(
217217
title, fig=fig, frame=frame, use_existing=False, **kwargs)
218218

@@ -247,7 +247,8 @@ def get_plot_axes(line_array):
247247
Only the first element of each array entry is used to determine the axes.
248248
249249
"""
250-
warnings.warn("get_plot_axes is deprecated; use cplt.axes", FutureWarning)
250+
warnings.warn(
251+
"get_plot_axes() is deprecated; use cplt.axes()", FutureWarning)
251252
_get_axes = np.vectorize(lambda lines: lines[0].axes)
252253
if isinstance(line_array, ControlPlot):
253254
return _get_axes(line_array.lines)

control/frdata.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,12 +597,13 @@ def freqresp(self, omega):
597597
Method has been given the more pythonic name
598598
:meth:`FrequencyResponseData.frequency_response`. Or use
599599
:func:`freqresp` in the MATLAB compatibility module.
600+
600601
"""
601602
warn("FrequencyResponseData.freqresp(omega) will be removed in a "
602603
"future release of python-control; use "
603604
"FrequencyResponseData.frequency_response(omega), or "
604605
"freqresp(sys, omega) in the MATLAB compatibility module "
605-
"instead", DeprecationWarning)
606+
"instead", FutureWarning)
606607
return self.frequency_response(omega)
607608

608609
def feedback(self, other=1, sign=-1):

control/freqplot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ def bode_plot(
427427

428428
if plot is not None:
429429
warnings.warn(
430-
"`bode_plot` return values of mag, phase, omega is deprecated; "
431-
"use frequency_response()", DeprecationWarning)
430+
"bode_plot() return value of mag, phase, omega is deprecated; "
431+
"use frequency_response()", FutureWarning)
432432

433433
if plot is False:
434434
# Process the data to match what we were sent
@@ -1791,8 +1791,8 @@ def _parse_linestyle(style_name, allow_false=False):
17911791
# Legacy return value processing
17921792
if plot is not None or return_contour is not None:
17931793
warnings.warn(
1794-
"`nyquist_plot` return values of count[, contour] is deprecated; "
1795-
"use nyquist_response()", DeprecationWarning)
1794+
"nyquist_plot() return value of count[, contour] is deprecated; "
1795+
"use nyquist_response()", FutureWarning)
17961796

17971797
# Extract out the values that we will eventually return
17981798
counts = [response.count for response in nyquist_responses]
@@ -2451,7 +2451,7 @@ def singular_values_plot(
24512451
if plot is not None:
24522452
warnings.warn(
24532453
"`singular_values_plot` return values of sigma, omega is "
2454-
"deprecated; use singular_values_response()", DeprecationWarning)
2454+
"deprecated; use singular_values_response()", FutureWarning)
24552455

24562456
# Warn the user if we got past something that is not real-valued
24572457
if any([not np.allclose(np.imag(response.fresp[:, 0, :]), 0)

control/lti.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def freqresp(sys, omega):
521521
Use `frequency_response` instead.
522522
523523
"""
524-
warn("freqresp is deprecated; use frequency_response", DeprecationWarning)
524+
warn("freqresp() is deprecated; use frequency_response()", FutureWarning)
525525
return frequency_response(sys, omega)
526526

527527

control/optimal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,14 +1111,14 @@ def solve_ocp(
11111111
raise ValueError("'minimize_method' specified more than once")
11121112
warnings.warn(
11131113
"'method' parameter is deprecated; assuming minimize_method",
1114-
DeprecationWarning)
1114+
FutureWarning)
11151115
kwargs['minimize_method'] = method
11161116
else:
11171117
if kwargs.get('trajectory_method'):
11181118
raise ValueError("'trajectory_method' specified more than once")
11191119
warnings.warn(
11201120
"'method' parameter is deprecated; assuming trajectory_method",
1121-
DeprecationWarning)
1121+
FutureWarning)
11221122
kwargs['trajectory_method'] = method
11231123

11241124
# Set up the optimal control problem

control/phaseplot.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,9 @@ def phase_plot(odefun, X=None, Y=None, scale=1, X0=None, T=None,
10131013

10141014
"""(legacy) Phase plot for 2D dynamical systems.
10151015
1016+
.. deprecated:: 0.10.1
1017+
This function is deprecated; use `phase_plane_plot` instead.
1018+
10161019
Produces a vector field or stream line plot for a planar system. This
10171020
function has been replaced by the :func:`~control.phase_plane_map` and
10181021
:func:`~control.phase_plane_plot` functions.
@@ -1072,7 +1075,7 @@ def phase_plot(odefun, X=None, Y=None, scale=1, X0=None, T=None,
10721075
"""
10731076
# Generate a deprecation warning
10741077
warnings.warn(
1075-
"phase_plot is deprecated; use phase_plot_plot instead",
1078+
"phase_plot() is deprecated; use phase_plane_plot() instead",
10761079
FutureWarning)
10771080

10781081
#
@@ -1272,7 +1275,7 @@ def box_grid(xlimp, ylimp):
12721275
"""box_grid generate list of points on edge of box
12731276
12741277
.. deprecated:: 0.10.0
1275-
Use `phaseplot.boxgrid` instead.
1278+
Use :func:`phaseplot.boxgrid` instead.
12761279
12771280
list = box_grid([xmin xmax xnum], [ymin ymax ynum]) generates a
12781281
list of points that correspond to a uniform grid at the end of the
@@ -1282,7 +1285,7 @@ def box_grid(xlimp, ylimp):
12821285

12831286
# Generate a deprecation warning
12841287
warnings.warn(
1285-
"box_grid is deprecated; use phaseplot.boxgrid instead",
1288+
"box_grid() is deprecated; use phaseplot.boxgrid() instead",
12861289
FutureWarning)
12871290

12881291
return boxgrid(

control/pzmap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ def pole_zero_plot(
316316
# Legacy return value processing
317317
if plot is not None:
318318
warnings.warn(
319-
"`pole_zero_plot` return values of poles, zeros is deprecated; "
320-
"use pole_zero_map()", DeprecationWarning)
319+
"pole_zero_plot() return value of poles, zeros is deprecated; "
320+
"use pole_zero_map()", FutureWarning)
321321

322322
# Extract out the values that we will eventually return
323323
poles = [response.poles for response in pzmap_responses]

control/rlocus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ def root_locus_plot(
208208
#
209209
if plot is not None:
210210
warnings.warn(
211-
"`root_locus` return values of roots, gains is deprecated; "
212-
"use root_locus_map()", DeprecationWarning)
211+
"root_locus() return value of roots, gains is deprecated; "
212+
"use root_locus_map()", FutureWarning)
213213

214214
if plot is False:
215215
return responses.loci, responses.gains

0 commit comments

Comments
 (0)