Skip to content

op_system

op_system validates YAML/JSON-friendly specifications for spatial and trait-structured PDEs, nonlocal integral/mixing dynamics, compartmental flows, ODEs and stochastic reaction networks. It compiles shaped-state evaluators and publishes operator, reaction and observable contracts. Numerical consumers supply discretization and time/event integration. The core can be used directly or through a separate flepimop2 provider.

The test suite covers NumPy, concrete and traced JAX arrays, and raw PyTorch tensors. Other Array API implementations may work through array-api-compat, but should be qualified before production use.

Installation

pip install op-system

Main interfaces

  • compile_spec(...) validates, normalizes, and compiles a loaded mapping.
  • normalize_rhs(...) normalizes without compilation.
  • validate_spec(...) returns a structural validation report.
  • compile_rhs(...) creates a reusable CompiledRhs object.
  • CompiledRhs.eval_fn(...) evaluates a flat state vector.
  • CompiledRhs.pytree_eval_fn(...) evaluates shaped state mappings.
  • CompiledRhs.block_pytree_eval_fn(...) supports hierarchical block-axis vectorization using the specification's factorize_axes declaration.

Start with the model specification guide and its executable age-structured SEIR example. See the repository README for a worked example and the navigation for the specification and API references.

Array namespace boundary

The array namespace is selected from input arrays at call time. A numerical engine selects integration methods, while a provider adapts framework interfaces. See array namespace terminology. Keep model expressions within the documented allowlist, and validate an additional backend against the package's conformance tests before treating it as supported in a production workflow.

Contributing and citation

The contributor guide covers setup, focused PRs, required checks, and support. Citation and archiving explains attribution, release identifiers, and the software-paper archive plan.

See capabilities and executable examples for current interfaces, optional dependencies, limitations and the checks that run in CI.