Skip to content

Releases: sbryngelson/PyIMR

v0.1.1

Choose a tag to compare

@sbryngelson sbryngelson released this 04 Aug 16:22
2d8cade

First release published to PyPI.

python -m pip install pyimr

Changes since v0.1.0

  • pyimr.__version__ reports the installed version, sourced from distribution metadata
    rather than a second hardcoded string that could drift from pyproject.toml.
  • The wall-temperature root find takes its tangent from the implicit function theorem via
    lax.custom_root, so the derivative no longer depends on the iteration budget to be
    correct. Previously, with Newton polish disabled, the solver returned a root accurate to
    4e-6 alongside a derivative of exactly zero -- bisection selects with where, which
    carries no gradient. The entire correctness margin came from three polish steps, and
    nothing recorded that dependency. Costs about 7% on the mass-transfer path; trajectories
    agree to 2e-15.
  • Publishing runs from a GitHub release through PyPI trusted publishing, with a dry run to
    TestPyPI and a guard that refuses to upload when the built version disagrees with the tag.

The API is still moving -- this week relocated PreparedProblem and prepare, and changed
the state layout and RHS argument order. Pin exactly if you depend on it.

PyIMR 0.1.0

Choose a tag to compare

@sbryngelson sbryngelson released this 04 Aug 14:16
0ff5d83

First tagged release. Nothing was released before it, so this describes what the package is
rather than how it differs from something you might be running.

Solving

pyimr.simulate takes a validated, dimensional SimulationConfig and returns immutable
physical histories. The material is an explicit typed value, not an integer selector and a
shared bag of parameters.

  • Six radial equations: Rayleigh-Plesset, Keller-Miksis pressure and enthalpy, Gilmore, each
    against Tait or Mie-Gruneisen.
  • Bubble and medium thermal transport, vapour transport, and forcing that is constant,
    Gaussian, histotripsy, a Heaviside step, or a sampled pressure history.
  • Materials: closed-form Kelvin-Voigt, quadratic Kelvin-Voigt, Zener, quadratic Zener,
    Oldroyd-B and linear Maxwell; composable hyperelastic and generalised-Newtonian laws;
    distributed Giesekus and linear PTT memory.
  • max_steps bounds one solve. A parameter set whose bubble collapses to a fraction of a
    percent of its maximum and then creeps will spend any budget it is given, while the healthy
    points around it finish in under 7e3 steps.

Choosing settings by measuring, not by folklore

  • pyimr.resolution.choose_resolution picks thermal, Nt and tolerance from a requested
    accuracy, measured on the caller's own problem. Requirements depend on record length,
    material stiffness and the observable being fitted, so a setting adequate for one collapse
    can be 4x wrong over five.
  • pyimr.diagnose classifies a failing configuration as budget, domain,
    ill-conditioned or unresolved. maximum number of solver steps was reached is the same
    message for all of them, and they want opposite responses.
  • pyimr.noise.predicted_spread uses trial-to-trial scatter as a prediction target rather
    than only as a noise scale. A model predicting far more scatter than a repeated experiment
    shows is excluded by the data whatever its chi-squared.

Inference and model selection

Forward sensitivities through the production right-hand side, a prepared likelihood with
analytic Jacobians, multistart fitting, a PyMC bridge, expected-information-gain design, and
ensemble and variational state estimation. pyimr.selection compares seventeen nested
constitutive candidates by marginal likelihood, with the noise scale marginalised under a
half-Cauchy prior and a redundancy prior that down-weights parameters where a model merely
reproduces a simpler one it contains.

Running many solves

  • pyimr.parallel.worker_pool confines each worker to one core. XLA sizes its thread pool
    from the affinity mask, so sixteen unconfined workers on a 128-core host took roughly 6500
    threads between them: it never failed, it thrashed.
  • pyimr.store.ResultStore caches solves on the content of (times, config), failures
    included, so re-running an unchanged study is nearly free.
  • A parameter sweep compiles one program rather than one per point, for every material except
    Ogden, whose variable-length tuples cannot travel as a fixed-width vector.

Validation

The suite pins IMRv2 trajectories across radial equations, forcing, vapour, heat and mass
transfer and the specialised constitutive models, and separately checks closed forms,
reduction limits, and every analytic tangent against independent centered differences.

PyIMR diverges from IMRv2 where upstream is wrong: eight defects found at dea31cd, each
reproduced in MATLAB and each correction validated against something other than upstream. One
divergence is numerical rather than a defect fix, the Zener and QuadraticZener
acceleration coefficient. See docs/upstream.md.

Install

pip install "git+https://github.com/sbryngelson/PyIMR@v0.1.0"

Not on PyPI yet.