Pathsim

Latest version: v0.6.2

Safety actively analyzes 722491 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 4

0.6.2

Again some minor updates and fixes

Refactors
- renamed `utils.debugging` to `utils.analysis` since its not only used for debugging anymore
- `Timer` context manager is more concise
- Special operator input for `Adder` more robust for weird cases

Serialization
- more robust serialization, saves module of blocks and PathSim objects
- more robust deserialization, uses `importlib` to import block from saved module if available, otherwise falls back to hierarchy traversal to ensure backwards compatibility for models saved in previous versions

Fixes
- fixed linearization of dynamic blocks with only a single state by checking if engine exists
- fixed jacobian of dynamic operator of `Differentiator`

0.6.1

This is a minor release

Features
- updated the `Adder` block to now accept operations to be applied at the inputs as a string, i.e. '+-' for convenience, default remains regular sum

Fixes
- fixed linearization of `Multiplier` block, was missing numpy import

Docs
- much improved docstrings of all blocks and events with examples and math

0.6.0

Overview

This is a big one.

At the core of this release stands **linearization** which required some major refactors of the ode solver interface (through `Solver` and its subclasses) and internal structure of the blocks. The newly introduced callable `Operator` and `DynamicOperator` classes wrap functions and enable automatic linearization in an operating point. This reduces block- and system-level linearization to the linearization of the internal operators of the blocks which is now handled by the operators themself.

What this enables is the linearization (and delinearization) of individual blocks, subsystems or the full system at runtime. This can even be triggered through events.

Operators
- Introduced new `pathsim.optim.operator` module that defines the `Operator` and `DynamicOperator` classes
- Can wrap callables / functions and have built in methods for linearization in an operating point, using a first order taylor approximation
- Automatic jacobian evaluation (`op.jac(x)` or `op.jac_x(x, u, t)`, `op.jac_u(x, u, t)`) through either user specified jacobians, automatic differentiation or numerical differentiation (in this order)
- When linearized, subsequent calls with `op()` use the internal taylor approximation (linear surrogate model)

Refactoring
- `Solver` now doesnt take func and jac as callables anymore, `step` and `solve` methods now take the value of the evaluated function and the value of the evaluated Jacobian, shifting the responsibility of the function and jacobian evaluation away from the ODE solvers and towards the blocks
- Adjusted core simulation loop to reflect this shift in responsibility
- `Block` now has attributes `op_dyn` and `op_alg` which are either `None` or instances of the `Operator` or `DynamicOperator` classes, they define the behaviour of algebraic and dynamic blocks and ultimately enable runtime linearization

Linearization
- Added `linearize` and `delinearize` methods to `Simulation`, `Subsystem` and `Block` to automaticalls linearize and delinearize these components

Serialization
- Streamlined serialization, zerializable objects have the option to add metadata

AD
- Improved `Value` class performance by 10% for arithmetic operations by using `defaultdict(float)` for sparse gradient tracking

0.5.9

- `Switch` block now has a `select` method to select the input port
- `Condition` event now uses bisection method for event time location instead of resolving directly
- constant nameing in `_constants.py` now more streamlined
- Improved serialization of PathSim objects with optional metadata, robust function and complex object serialization using [dill](https://dill.readthedocs.io/en/latest/)
- Global plotting method for the simulation `Simulation.plot()` that calls the all plot methods of blocks that implement it (quality of life, just open all the plots at once)

0.5.8

- moved all constants and default tolerances to `pathsim/_constants.py`
- moved numerical differentiation methods to `pathsim/optim/numerical.py`
- numerical differentiation now uses relative perturbations for stepsize
- minor fixes in backtracking for event system in conjunction with adaptive ODE solvers in `pathsim/simulation.py`

**note:** numerical differntiation is not used currently but might be useful to compute jacobians in the future when AD is not feasible

0.5.7

- New `Switch` block that selects input depending on internal state
- Fixed backtracking for event location with adaptive solvers, specifically reevaluating after refert, to ensure the correct values are buffered for the events

Page 1 of 4

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.