1
0
Files
python-control/control-pr994-numpy2.patch
Dirk Mueller 353f5f2bad - update to modern python on sle15
* Small docstring fixes for release by @murrayrm in #832
- Update to version 0.9.1
- Update to version 0.8.4
  * Improved default time vector for time response
  * New use_legacy_defaults function to allow compatibility
  * Allow creation of non-proper transfer functions
    (bnavigator, rlegnain)
  * Added ability to set arrow head length and width option
  * Added ability to 'prewarp' the conversion of continuous to
  * Added rlocus capability for discrete-time systems
  * Updated pzmap grid to be compatible with matplotlib updates
  * Implement loadable string representation (repr) for tf, ss,
  * Fixed margin computation for discrete time systems
  * Fixed InterconnectedSystem naming bugs, improved
  * Fixed LinearIOSystem output bug in output function
  * Fixed bug in forced_response that overrode squeeze
  * Use rad/sec for Bode plot in MATLAB bode (was erroneously
  * Removed deprecated scipy calls and updated to latest numpy
  * Updated unit tests + switch to pytest (bnavigator,
  * Return type for eigenvalues in lqe changed to 1D array
- Skip a test family on Leap because of segfaults in numpy
- moved Pillow requirement to matplotlib package
- add pr430-numpy119delete.patch to fix test failures with new numpy
- remove ppc workaround
  and matrix type during tests gh#python-control/python-control#423
- skip mixsyn test on PowerPC boo#1172555
  duplicated array test
- remove python-devel from BuildRequires
- add slycot to BuildRequires for tests

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-control?expand=0&rev=56
2024-08-14 15:14:05 +00:00

206 lines
7.3 KiB
Diff

From 03df7185bc8a44a345fb926effb38ed6aeb817cc Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Sat, 20 Apr 2024 16:25:33 +0200
Subject: [PATCH 1/4] Replace np.NaN removed in numpy 2
---
control/tests/timeresp_test.py | 14 +++++++-------
control/timeresp.py | 14 +++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/control/tests/timeresp_test.py b/control/tests/timeresp_test.py
index fb21180b..441f4a7b 100644
--- a/control/tests/timeresp_test.py
+++ b/control/tests/timeresp_test.py
@@ -173,15 +173,15 @@ def tsystem(self, request):
# System Type 1 - Step response not stationary: G(s)=1/s(s+1)
siso_tf_type1 = TSys(TransferFunction(1, [1, 1, 0]))
siso_tf_type1.step_info = {
- 'RiseTime': np.NaN,
- 'SettlingTime': np.NaN,
- 'SettlingMin': np.NaN,
- 'SettlingMax': np.NaN,
- 'Overshoot': np.NaN,
- 'Undershoot': np.NaN,
+ 'RiseTime': np.nan,
+ 'SettlingTime': np.nan,
+ 'SettlingMin': np.nan,
+ 'SettlingMax': np.nan,
+ 'Overshoot': np.nan,
+ 'Undershoot': np.nan,
'Peak': np.Inf,
'PeakTime': np.Inf,
- 'SteadyStateValue': np.NaN}
+ 'SteadyStateValue': np.nan}
# SISO under shoot response and positive final value
# G(s)=(-s+1)/(s²+s+1)
diff --git a/control/timeresp.py b/control/timeresp.py
index 58207e88..843ae3a8 100644
--- a/control/timeresp.py
+++ b/control/timeresp.py
@@ -1590,15 +1590,15 @@ def step_info(sysdata, T=None, T_num=None, yfinal=None, params=None,
InfValue = InfValues[i, j]
sgnInf = np.sign(InfValue.real)
- rise_time: float = np.NaN
- settling_time: float = np.NaN
- settling_min: float = np.NaN
- settling_max: float = np.NaN
+ rise_time: float = np.nan
+ settling_time: float = np.nan
+ settling_min: float = np.nan
+ settling_max: float = np.nan
peak_value: float = np.Inf
peak_time: float = np.Inf
- undershoot: float = np.NaN
- overshoot: float = np.NaN
- steady_state_value: complex = np.NaN
+ undershoot: float = np.nan
+ overshoot: float = np.nan
+ steady_state_value: complex = np.nan
if not np.isnan(InfValue) and not np.isinf(InfValue):
# RiseTime
From 38188fbd6d8b95ef0ed5d76e396db43f95bbf488 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Sat, 20 Apr 2024 16:35:21 +0200
Subject: [PATCH 2/4] Replace np.Inf removed in numpy 2
---
control/tests/timeresp_test.py | 4 ++--
control/timeresp.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/control/tests/timeresp_test.py b/control/tests/timeresp_test.py
index 441f4a7b..bdbbb3e8 100644
--- a/control/tests/timeresp_test.py
+++ b/control/tests/timeresp_test.py
@@ -179,8 +179,8 @@ def tsystem(self, request):
'SettlingMax': np.nan,
'Overshoot': np.nan,
'Undershoot': np.nan,
- 'Peak': np.Inf,
- 'PeakTime': np.Inf,
+ 'Peak': np.inf,
+ 'PeakTime': np.inf,
'SteadyStateValue': np.nan}
# SISO under shoot response and positive final value
diff --git a/control/timeresp.py b/control/timeresp.py
index 843ae3a8..428baf23 100644
--- a/control/timeresp.py
+++ b/control/timeresp.py
@@ -1594,8 +1594,8 @@ def step_info(sysdata, T=None, T_num=None, yfinal=None, params=None,
settling_time: float = np.nan
settling_min: float = np.nan
settling_max: float = np.nan
- peak_value: float = np.Inf
- peak_time: float = np.Inf
+ peak_value: float = np.inf
+ peak_time: float = np.inf
undershoot: float = np.nan
overshoot: float = np.nan
steady_state_value: complex = np.nan
From 0b5332bfa9580df81ba2ebc6f9d8f54975fa9cd6 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Sat, 20 Apr 2024 16:44:45 +0200
Subject: [PATCH 3/4] replace deprecated numpy.linalg.linalg.LinAlgError with
numpy.linalg.LinAlgError and isort
---
control/statesp.py | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/control/statesp.py b/control/statesp.py
index e14a8358..0c2856b1 100644
--- a/control/statesp.py
+++ b/control/statesp.py
@@ -48,26 +48,27 @@
"""
import math
+from copy import deepcopy
+from warnings import warn
+
import numpy as np
-from numpy import any, asarray, concatenate, cos, delete, \
- empty, exp, eye, isinf, ones, pad, sin, zeros, squeeze
-from numpy.random import rand, randn
-from numpy.linalg import solve, eigvals, matrix_rank
-from numpy.linalg.linalg import LinAlgError
import scipy as sp
import scipy.linalg
-from scipy.signal import cont2discrete
+from numpy import (any, asarray, concatenate, cos, delete, empty, exp, eye,
+ isinf, ones, pad, sin, squeeze, zeros)
+from numpy.linalg import LinAlgError, eigvals, matrix_rank, solve
+from numpy.random import rand, randn
from scipy.signal import StateSpace as signalStateSpace
-from warnings import warn
+from scipy.signal import cont2discrete
-from .exception import ControlSlycot, slycot_check, ControlMIMONotImplemented
+from . import config
+from .exception import ControlMIMONotImplemented, ControlSlycot, slycot_check
from .frdata import FrequencyResponseData
+from .iosys import (InputOutputSystem, _process_dt_keyword,
+ _process_iosys_keywords, _process_signal_list,
+ common_timebase, isdtime, issiso)
from .lti import LTI, _process_frequency_response
-from .iosys import InputOutputSystem, common_timebase, isdtime, issiso, \
- _process_iosys_keywords, _process_dt_keyword, _process_signal_list
-from .nlsys import NonlinearIOSystem, InterconnectedSystem
-from . import config
-from copy import deepcopy
+from .nlsys import InterconnectedSystem, NonlinearIOSystem
try:
from slycot import ab13dd
@@ -2221,9 +2222,10 @@ def _convert_to_statespace(sys, use_prefix_suffix=False, method=None):
by the calling function.
"""
- from .xferfcn import TransferFunction
import itertools
+ from .xferfcn import TransferFunction
+
if isinstance(sys, StateSpace):
return sys
From ebb8a5284c8c4e58ef8efdae656f1e4748b3ba68 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Sat, 20 Apr 2024 16:49:11 +0200
Subject: [PATCH 4/4] Replace deprecated numpy row_stack with vstack
---
control/rlocus.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/control/rlocus.py b/control/rlocus.py
index 631185cc..281fed08 100644
--- a/control/rlocus.py
+++ b/control/rlocus.py
@@ -21,7 +21,7 @@
import matplotlib.pyplot as plt
import numpy as np
import scipy.signal # signal processing toolbox
-from numpy import array, imag, poly1d, real, row_stack, zeros_like
+from numpy import array, imag, poly1d, real, vstack, zeros_like
from . import config
from .exception import ControlMIMONotImplemented
@@ -421,7 +421,7 @@ def _RLFindRoots(nump, denp, kvect):
curroots.sort()
roots.append(curroots)
- return row_stack(roots)
+ return vstack(roots)
def _RLSortRoots(roots):