DirectSD-Python 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- directsd/__init__.py +141 -0
- directsd/analysis/__init__.py +4 -0
- directsd/analysis/charpol.py +89 -0
- directsd/analysis/errors.py +185 -0
- directsd/analysis/norms.py +630 -0
- directsd/design/__init__.py +9 -0
- directsd/design/convex.py +620 -0
- directsd/design/lifting.py +403 -0
- directsd/design/polynomial.py +5925 -0
- directsd/examples/__init__.py +0 -0
- directsd/examples/_common.py +36 -0
- directsd/examples/demos.py +1161 -0
- directsd/examples/examples.py +296 -0
- directsd/examples/help_examples.py +1043 -0
- directsd/glopt/__init__.py +4 -0
- directsd/glopt/advanced.py +1658 -0
- directsd/glopt/optimize.py +420 -0
- directsd/linalg/__init__.py +3 -0
- directsd/linalg/linsys.py +66 -0
- directsd/linalg/matrices.py +156 -0
- directsd/linalg/minreal.py +425 -0
- directsd/linalg/riccati.py +197 -0
- directsd/polynomial/__init__.py +11 -0
- directsd/polynomial/diophantine.py +426 -0
- directsd/polynomial/operations.py +247 -0
- directsd/polynomial/poln.py +742 -0
- directsd/polynomial/spectral.py +368 -0
- directsd/polynomial/transforms.py +124 -0
- directsd/polynomial/utils.py +449 -0
- directsd/sspace/__init__.py +4 -0
- directsd/sspace/design.py +1083 -0
- directsd/sspace/plant.py +198 -0
- directsd/tf/__init__.py +9 -0
- directsd/tf/interconnect.py +105 -0
- directsd/zpk/__init__.py +1 -0
- directsd/zpk/zpk.py +400 -0
- directsd_python-0.1.0.dist-info/METADATA +450 -0
- directsd_python-0.1.0.dist-info/RECORD +41 -0
- directsd_python-0.1.0.dist-info/WHEEL +5 -0
- directsd_python-0.1.0.dist-info/licenses/LICENSE +36 -0
- directsd_python-0.1.0.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Shared helpers for the example/demo scripts (``demos.py``, ``help_examples.py``,
|
|
3
|
+
``examples.py``).
|
|
4
|
+
|
|
5
|
+
Centralizes ``_cl_poles``, which was found duplicated verbatim across
|
|
6
|
+
``demos.py`` and ``help_examples.py`` -- two independent copies of the same
|
|
7
|
+
logic that could silently diverge if one got fixed and not the other.
|
|
8
|
+
|
|
9
|
+
Also re-exports ``_z2zeta`` from ``design.polynomial`` for the "pre-convert a
|
|
10
|
+
whole plant matrix before calling ``dhinf``" pattern (MATLAB's own
|
|
11
|
+
``sys = z2zeta(sys)`` before ``demo_dhinf.m``'s calls, since ``dhinf`` applies
|
|
12
|
+
``z2zeta`` again internally -- skipping this pre-conversion hands the pipeline
|
|
13
|
+
the zeta-domain functions instead of the z-domain ones, flipping every
|
|
14
|
+
stability-based factor split). ``_z2zeta`` is one function for any input
|
|
15
|
+
shape (a single ``(num, den)`` pair, a ``Zpk``, or a matrix of pairs) -- see
|
|
16
|
+
its own docstring in ``design/polynomial.py``.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
import numpy as np
|
|
21
|
+
|
|
22
|
+
from directsd.analysis.charpol import charpol
|
|
23
|
+
from directsd.design.polynomial import _z2zeta
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def cl_poles(plant, K, T):
|
|
27
|
+
"""Closed-loop z-domain poles via the characteristic polynomial.
|
|
28
|
+
|
|
29
|
+
Returns an empty array (rather than raising) if ``charpol`` fails --
|
|
30
|
+
some example plants are pathological enough that this is expected.
|
|
31
|
+
"""
|
|
32
|
+
try:
|
|
33
|
+
delta = charpol(plant, K, T)
|
|
34
|
+
return np.roots(delta)
|
|
35
|
+
except Exception:
|
|
36
|
+
return np.array([])
|