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.
Files changed (41) hide show
  1. directsd/__init__.py +141 -0
  2. directsd/analysis/__init__.py +4 -0
  3. directsd/analysis/charpol.py +89 -0
  4. directsd/analysis/errors.py +185 -0
  5. directsd/analysis/norms.py +630 -0
  6. directsd/design/__init__.py +9 -0
  7. directsd/design/convex.py +620 -0
  8. directsd/design/lifting.py +403 -0
  9. directsd/design/polynomial.py +5925 -0
  10. directsd/examples/__init__.py +0 -0
  11. directsd/examples/_common.py +36 -0
  12. directsd/examples/demos.py +1161 -0
  13. directsd/examples/examples.py +296 -0
  14. directsd/examples/help_examples.py +1043 -0
  15. directsd/glopt/__init__.py +4 -0
  16. directsd/glopt/advanced.py +1658 -0
  17. directsd/glopt/optimize.py +420 -0
  18. directsd/linalg/__init__.py +3 -0
  19. directsd/linalg/linsys.py +66 -0
  20. directsd/linalg/matrices.py +156 -0
  21. directsd/linalg/minreal.py +425 -0
  22. directsd/linalg/riccati.py +197 -0
  23. directsd/polynomial/__init__.py +11 -0
  24. directsd/polynomial/diophantine.py +426 -0
  25. directsd/polynomial/operations.py +247 -0
  26. directsd/polynomial/poln.py +742 -0
  27. directsd/polynomial/spectral.py +368 -0
  28. directsd/polynomial/transforms.py +124 -0
  29. directsd/polynomial/utils.py +449 -0
  30. directsd/sspace/__init__.py +4 -0
  31. directsd/sspace/design.py +1083 -0
  32. directsd/sspace/plant.py +198 -0
  33. directsd/tf/__init__.py +9 -0
  34. directsd/tf/interconnect.py +105 -0
  35. directsd/zpk/__init__.py +1 -0
  36. directsd/zpk/zpk.py +400 -0
  37. directsd_python-0.1.0.dist-info/METADATA +450 -0
  38. directsd_python-0.1.0.dist-info/RECORD +41 -0
  39. directsd_python-0.1.0.dist-info/WHEEL +5 -0
  40. directsd_python-0.1.0.dist-info/licenses/LICENSE +36 -0
  41. 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([])