API Reference

polynomial_equations.polynomialTool.cli

Command-line interface for polynomial_equations.polynomialTool.

The CLI preserves the original polynomial-tool subcommands:

  • solve

  • polydesign

  • rst

  • modelmatch

It also adds a sphinx-skel helper for generating a conservative, GitHub Pages friendly Sphinx documentation skeleton.

polynomial_equations.polynomialTool.cli.build_parser()[source]

Build the command-line parser.

Return type:

ArgumentParser

polynomial_equations.polynomialTool.cli.main(argv=None)[source]

Run the polynomialTool command-line interface.

Parameters:

argv (list[str] | None)

Return type:

int

polynomial_equations.polynomialTool.apis

class polynomial_equations.polynomialTool.apis.RunRequest(mode, A, B, D=None, H=None, F=None, layout='ogata', d=0, degS=None, degR=None, pretty=False, show_E=False, export_json=None, export_csv=None, backend='none', save=None, T=1.0, kmax=40, ogata_parity=False, config=None, rst_config=2, Gmodel_num=None, Gmodel_den=None, H1=None)[source]

Bases: object

Container for all inputs to PolynomialApp.run(). Mirrors CLI flags.

Modes:
  • solve : compute alpha/beta (optionally pretty-print, show_E)

  • polydesign : design & preview closed-loop (config-driven)

  • rst : RST design (rst_config)

  • modelmatch : model matching with target Gmodel and prefilter H1

Notes

  • Paths passed in export_json/export_csv/save are resolved by the I/O layer (e.g., utils.resolve_out) so that ‘out/…’ anchors to the package’s out/.

Parameters:
  • mode (Literal['solve', 'polydesign', 'rst', 'modelmatch'])

  • A (List[float])

  • B (List[float])

  • D (List[float] | None)

  • H (List[float] | None)

  • F (List[float] | None)

  • layout (Literal['ogata', 'desc'])

  • d (int)

  • degS (int | None)

  • degR (int | None)

  • pretty (bool)

  • show_E (bool)

  • export_json (str | None)

  • export_csv (str | None)

  • backend (Literal['mpl', 'plotly', 'none'])

  • save (str | None)

  • T (float)

  • kmax (int)

  • ogata_parity (bool)

  • config (int | None)

  • rst_config (int)

  • Gmodel_num (List[float] | None)

  • Gmodel_den (List[float] | None)

  • H1 (List[float] | None)

A: List[float]
B: List[float]
D: List[float] | None = None
F: List[float] | None = None
Gmodel_den: List[float] | None = None
Gmodel_num: List[float] | None = None
H: List[float] | None = None
H1: List[float] | None = None
T: float = 1.0
backend: Literal['mpl', 'plotly', 'none'] = 'none'
config: int | None = None
d: int = 0
degR: int | None = None
degS: int | None = None
export_csv: str | None = None
export_json: str | None = None
kmax: int = 40
layout: Literal['ogata', 'desc'] = 'ogata'
mode: Literal['solve', 'polydesign', 'rst', 'modelmatch']
ogata_parity: bool = False
pretty: bool = False
rst_config: int = 2
save: str | None = None
show_E: bool = False

polynomial_equations.polynomialTool.app

class polynomial_equations.polynomialTool.app.PolynomialApp[source]

Bases: object

run(req)[source]

Dispatch entry-point for the polynomialTool app.

Modes:
  • ‘solve’ -> solve_alpha_beta (and optionally export/print E)

  • ‘polydesign’ -> polydesign (handles its own exports/plots)

  • ‘rst’ -> rst_design (handles its own exports/plots)

  • ‘modelmatch’ -> model_match (handles its own exports/plots)

Parameters:

req (RunRequest)

Return type:

Dict[str, Any]

polynomial_equations.polynomialTool.core

polynomial_equations.polynomialTool.core.convmtx_desc(p, L)[source]
Parameters:
  • p (List[float])

  • L (int)

polynomial_equations.polynomialTool.core.diophantine(A_desc, B_desc, D_desc, d=0, degS=None, degR=None, layout='ogata')[source]
polynomial_equations.polynomialTool.core.dlsim_safe(sys, u, t)[source]
Parameters:

sys (scipy.signal.dlti)

polynomial_equations.polynomialTool.core.factor_z_from_F_and_update_d(F_desc, d)[source]
Parameters:
  • F_desc (List[float])

  • d (int)

polynomial_equations.polynomialTool.core.ogata_sylvester_E(A_desc, B_desc)[source]
Parameters:
  • A_desc (List[float])

  • B_desc (List[float])

polynomial_equations.polynomialTool.core.poly_at1_desc(p)[source]
Parameters:

p (List[float])

Return type:

float

polynomial_equations.polynomialTool.core.poly_conv_desc(*polys)[source]
Parameters:

polys (List[float])

Return type:

List[float]

polynomial_equations.polynomialTool.core.sylvester_matrix_desc(A, B, Ls, Lr, d=0)[source]
polynomial_equations.polynomialTool.core.to_asc(c_desc)[source]
Parameters:

c_desc (List[float])

Return type:

List[float]

polynomial_equations.polynomialTool.core.to_desc(c_asc)[source]
Parameters:

c_asc (List[float])

Return type:

List[float]

polynomial_equations.polynomialTool.io

polynomial_equations.polynomialTool.io.parse_coeffs(s)[source]
Parameters:

s (str)

Return type:

List[float]

polynomial_equations.polynomialTool.io.parse_complex_list(s)[source]
Parameters:

s (str)

polynomial_equations.polynomialTool.io.save_csv(path, rows)[source]
Parameters:
  • path (str)

  • rows (Iterable[Tuple[str, list]])

polynomial_equations.polynomialTool.io.save_json(path, payload)[source]
Parameters:
  • path (str)

  • payload (Dict[str, Any])

polynomial_equations.polynomialTool.utils

Utility helpers for polynomial_equations.polynomialTool.

This module intentionally keeps its docstrings conservative for Sphinx and GitHub Pages builds. The helpers centralize package-local input and output path handling plus a tiny optional call logger used during debugging.

polynomial_equations.polynomialTool.utils.ensure_dir_for(path)[source]

Create the parent directory for path when one is present.

Passing None or a bare filename is a no-op. Absolute and relative filenames with a directory component are both supported.

Parameters:

path (str | None)

Return type:

None

polynomial_equations.polynomialTool.utils.in_path(*parts)[source]

Return a path under the package input directory.

The parent directory for the returned path is created before returning the path string. This keeps callers simple when they need to read or create files under the package-local in folder.

Parameters:

parts (str)

Return type:

str

polynomial_equations.polynomialTool.utils.log_call(fn)[source]

Return a decorator wrapper that prints a compact call trace.

By default, the wrapper prints only the wrapped function name. Set the POLY_LOG_CALLS environment variable to 1 to include positional and keyword argument values in the printed trace. The wrapped function return value is passed through unchanged.

Parameters:

fn (_F)

Return type:

_F

polynomial_equations.polynomialTool.utils.out_path(*parts)[source]

Return a path under the package output directory.

The parent directory for the returned path is created before returning the path string. This keeps exports anchored to the package-local out folder when the user supplies an output path that starts with out.

Parameters:

parts (str)

Return type:

str

polynomial_equations.polynomialTool.utils.resolve_in(path)[source]

Resolve a user-supplied input path.

Absolute paths are returned unchanged. Relative paths that start with the package input folder name are anchored under IN_DIR. Other relative paths are left unchanged so callers may intentionally use the current working directory.

Parameters:

path (str | None)

Return type:

str | None

polynomial_equations.polynomialTool.utils.resolve_out(path)[source]

Resolve a user-supplied output path.

Absolute paths are returned after their parent directory is created. Relative paths that start with the package output folder name are anchored under OUT_DIR. Other relative paths are left unchanged, but their parent directory is still created when applicable.

Parameters:

path (str | None)

Return type:

str | None

polynomial_equations.polynomialTool.design

polynomial_equations.polynomialTool.design.model_match(A, B, Gnum, Gden, H1, F, d=0, degS=None, degR=None, layout='ogata', backend='mpl', save=None, T=1.0, kmax=40, export_json=None, pretty=False)[source]
polynomial_equations.polynomialTool.design.polydesign(A, B, D=None, H=None, F=None, d=0, degS=None, degR=None, layout='ogata', pretty=False, show_E=False, backend='none', save=None, T=1.0, kmax=40, config=None, export_json=None, export_csv=None, ogata_parity=False)[source]
polynomial_equations.polynomialTool.design.rst_design(A, B, H, F, d=0, degS=None, degR=None, layout='ogata', config=2, backend='mpl', save=None, T=1.0, kmax=40, export_json=None, pretty=False, ogata_parity=False)[source]
polynomial_equations.polynomialTool.design.solve_alpha_beta(A, B, D, d=0, degS=None, degR=None, layout='ogata')[source]