API Reference

state_space_design.minOrdTool.cli

CLI entry point for state_space_design.minOrdTool.

state_space_design.minOrdTool.cli.build_parser()[source]

Build the command line parser.

Return type:

ArgumentParser

state_space_design.minOrdTool.cli.main(argv=None)[source]

Run the minOrdTool command line interface.

Parameters:

argv (list[str] | None)

Return type:

int

state_space_design.minOrdTool.apis

class state_space_design.minOrdTool.apis.MinOrdRunRequest(A: 'str', C: 'str', poles: 'list[str]', B: 'str | None' = None, K: 'str | None' = None, K_poles: 'list[str] | None' = None, allow_pinv: 'bool' = False, pretty: 'bool' = False, precision: 'int' = 4, export_json: 'str | None' = None, verbose: 'bool' = False)[source]

Bases: object

Parameters:
  • A (str)

  • C (str)

  • poles (list[str])

  • B (str | None)

  • K (str | None)

  • K_poles (list[str] | None)

  • allow_pinv (bool)

  • pretty (bool)

  • precision (int)

  • export_json (str | None)

  • verbose (bool)

A: str
B: str | None = None
C: str
K: str | None = None
K_poles: list[str] | None = None
allow_pinv: bool = False
export_json: str | None = None
poles: list[str]
precision: int = 4
pretty: bool = False
verbose: bool = False
class state_space_design.minOrdTool.apis.MinOrdRunResult(json_path: 'str | None' = None, payload: 'dict' = <factory>)[source]

Bases: object

Parameters:
  • json_path (str | None)

  • payload (dict)

json_path: str | None = None
payload: dict

state_space_design.minOrdTool.app

app.py — Orchestration layer for state_space_design.minOrdTool

  • Parses request, invokes service, writes JSON output

  • Ensures JSON is safe for NumPy/complex types

state_space_design.minOrdTool.app.run_app(req)[source]

Execute a run given a MinOrdRunRequest and return MinOrdRunResult.

Parameters:

req (MinOrdRunRequest)

Return type:

MinOrdRunResult

state_space_design.minOrdTool.core

class state_space_design.minOrdTool.core.MinOrderObserverDesigner(sys)[source]

Bases: object

Parameters:

sys (SystemSpec)

compute_T()[source]
Return type:

tuple[ndarray, ndarray]

compute_bar(T, Tinv)[source]
design(poles, allow_pinv=False)[source]
Parameters:
  • poles (ndarray)

  • allow_pinv (bool)

ke_acker(Abb, Aab, poles, allow_pinv=False)[source]
Parameters:
  • Abb (ndarray)

  • Aab (ndarray)

  • poles (ndarray)

  • allow_pinv (bool)

Return type:

ndarray

class state_space_design.minOrdTool.core.SystemSpec(A: 'np.ndarray', C: 'np.ndarray', B: 'np.ndarray | None' = None)[source]

Bases: object

Parameters:
  • A (ndarray)

  • C (ndarray)

  • B (ndarray | None)

A: ndarray
B: ndarray | None = None
C: ndarray
property n: int
with_B(B)[source]
Parameters:

B (ndarray | None)

Return type:

SystemSpec

state_space_design.minOrdTool.core.build_S(Aab, Abb)[source]
Parameters:
  • Aab (ndarray)

  • Abb (ndarray)

Return type:

ndarray

state_space_design.minOrdTool.core.partition_bar(Abar, Bbar)[source]
Parameters:
  • Abar (ndarray)

  • Bbar (ndarray | None)

state_space_design.minOrdTool.core.phi_of_A(A, coeff)[source]
Parameters:
  • A (ndarray)

  • coeff (ndarray)

Return type:

ndarray

state_space_design.minOrdTool.core.poly_from_roots(roots)[source]
Parameters:

roots (ndarray)

Return type:

ndarray

state_space_design.minOrdTool.core.transform_from_C(C)[source]
Parameters:

C (ndarray)

Return type:

tuple[ndarray, ndarray]

state_space_design.minOrdTool.design

design.py — App/service layer for minimum-order observer design (Ogata §10-5)

  • Wraps the core math in a service class suitable for CLI and tests

  • Provides pretty console output (optional)

  • Produces JSON-safe payloads (NumPy & complex handled)

class state_space_design.minOrdTool.design.MinOrdAppService(precision=4, verbose=False)[source]

Bases: object

High-level façade used by the CLI and tests.

Parameters:
  • precision (int) – Digits for pretty-printed numeric output.

  • verbose (bool) – If True, set root logger to DEBUG; otherwise INFO.

design_observer(A, C, poles, B=None, allow_pinv=False, pretty=False, K=None, K_poles=None)[source]

Design a minimum-order observer for p=1 (scalar output).

Returns:

JSON-safe payload with keys: T, Tinv, Abar, Bbar, Aaa, Aab, Aba, Abb, Ke, Ahat, Bhat, Fhat, Ctil, Dtil, eig_Ahat, charpoly_Ahat, charpoly_desired, charpoly_match, (optionally) K

Return type:

dict

Parameters:
  • allow_pinv (bool)

  • pretty (bool)

state_space_design.minOrdTool.io

state_space_design.minOrdTool.io.parse_mat(s)[source]
Parameters:

s (str | None)

Return type:

ndarray | None

state_space_design.minOrdTool.io.parse_poles_any(s)[source]
Parameters:

s (str)

Return type:

ndarray

state_space_design.minOrdTool.io.parse_poles_tokens(tokens)[source]
Parameters:

tokens (list[str])

Return type:

ndarray

state_space_design.minOrdTool.utils

Utility helpers for state_space_design.minOrdTool.

state_space_design.minOrdTool.utils.array2str(M, precision=4)[source]

Return a compact string for a matrix or array.

Parameters:
  • M (Any)

  • precision (int)

Return type:

str

state_space_design.minOrdTool.utils.complex_list_to_pairs(zs)[source]

Convert complex values into real-imaginary pairs.

Parameters:

zs (Any)

Return type:

list[list[float]]

state_space_design.minOrdTool.utils.mat_inline(M, precision=4)[source]

Return a one-line matrix representation for console output.

Parameters:
  • M (Any)

  • precision (int)

Return type:

str

state_space_design.minOrdTool.utils.pretty_poly(coeffs, var='s')[source]

Return a readable polynomial string from descending coefficients.

Parameters:
  • coeffs (Any)

  • var (str)

Return type:

str

state_space_design.minOrdTool.utils.sympy_pretty_observer(Ahat, Bhat, Fhat, Ctil, Dtil, m_inputs)[source]

Print the observer equations using SymPy pretty printing.

Parameters:
  • Ahat (ndarray)

  • Bhat (ndarray)

  • Fhat (ndarray | None)

  • Ctil (ndarray)

  • Dtil (ndarray)

  • m_inputs (int | None)

Return type:

None

state_space_design.minOrdTool.utils.to_jsonable(obj)[source]

Recursively convert NumPy and complex values into JSON-safe types.

Parameters:

obj (Any)

Return type:

Any