Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

qlroms

PyPI Docs

Quantized-local reduced-order models (qlROMs). The state space is partitioned into charts by k-means, each chart gets its own local POD basis, and an exact shared atlas stitches the charts into one global coordinate system. On that geometry, this package advances the local dynamics with qlGalerkin: an intrusive projection of the governing equations, one quadratic reduced system $\dot{\bm{a}} = \bm{b}_k + \mathbf{A}_k\bm{a} + \mathsf{B}_k(\bm{a},\bm{a})$ per chart, plus the transition maps that carry coordinates across chart boundaries. The QLModel adapter wraps a qlROM as a dynamodels Model, so it plugs directly into romda estimators and ntsa analysis.

Install

conda create -n qlroms python=3.11   # >=3.10
conda activate qlroms
pip install qlroms
pip install -e ".[dev]"   # development

Quickstart

import numpy as np
from qlroms import free_run
from qlroms.intrusive_qlroms import ks1d
from qlroms.intrusive_qlroms.build_ks import build_fom, get_full_trajectory

# A case FOM and its (cached) trajectory: the 1-D KS chaotic regime, short window
fom, cfg = build_fom(ks1d, case="chaotic", overrides={"Ntrain": 20_000, "Ntest": 2_000})
traj = get_full_trajectory(Ntot=cfg["i0"] + cfg["Ntrain"] + cfg["Ntest"], model=fom, i0=cfg["i0"])
Xtrain, x0 = traj[:, :cfg["Ntrain"]], traj[:, cfg["Ntrain"]]

# Charts (k-means + local POD + atlas) and one projected (b, A, B) per chart
rom = ks1d.build_local_model(Xtrain, fom, K=10, r=30, save_dir=".")

# Closed-loop forecast through the shared step(apod) interface
X_rec, cluster_path = free_run(rom, x0, n_steps=500)

# Run it as a dynamodels Model (romda estimators, ntsa analysis)
from qlroms.model import QLModel
model = QLModel(rom, obs_idx=np.arange(0, fom.Nx, 8), psi0=x0)

Building a qlROM from a config

One YAML file per model: which test case and window, which family, how many charts and modes, and what to measure once it is fitted.

python -m qlroms.utils.builder configs/ks1d_chaotic.yml   # [--set rom.K=20] [--set case.params='{"Ntrain": 5000}']
case: {model: ks1d chaos}          # a qlroms.utils.config.CASES name, or ks1d/chaotic
rom:  {kind: qlgalerkin, seed: 0, clustering: {kmeans_method: minibatch}}
check: {n_steps: 1000, compare_global: true}

A case is defined in exactly one place -- its own module's TEST_CASES entry, which holds the physics, the windows it is generated with, the $(K, r)$ its ql-ROMs are built at and the timescales its characterization needs. qlroms.utils.config only maps a readable name onto one of those entries (get_case("ks1d chaos") reads it back live), and a config restates none of it: leave rom.K / rom.r or case.params out and the case's own values stand, set them and this run overrides them. Unknown keys fail loudly, dotted --set beats the file, and both the trajectory and the fitted ROM come from the case's cached pipeline. The run prints a JSON summary: representation error, closed-loop mean error and prediction horizon, against the global ($K=1$) ROM of the same family when compare_global is on.

Theory

Derivations (local POD with the mass-weighted inner product, OpInf regression with $\lambda_1$/$\lambda_2$ regularization, ESN training) live in docs/theory/; full documentation is published at https://andreanovoa.github.io/qlroms.

References

If you use this package, please cite the papers the method comes from:

  • Colanera, A., & Magri, L. (2025). Quantized local reduced-order modeling in time (ql-ROM). Computer Methods in Applied Mechanics and Engineering, 447, 118393.
  • Colanera, A., & Magri, L. (2026). Towards extreme event prediction of turbulent flows with quantized local reduced-order models. Journal of Physics: Conference Series, 3230(1), 012003. IOP Publishing.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qlroms-0.1.1a3.tar.gz (127.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qlroms-0.1.1a3-py3-none-any.whl (127.1 kB view details)

Uploaded Python 3

File details

Details for the file qlroms-0.1.1a3.tar.gz.

File metadata

  • Download URL: qlroms-0.1.1a3.tar.gz
  • Upload date:
  • Size: 127.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for qlroms-0.1.1a3.tar.gz
Algorithm Hash digest
SHA256 d36e9fe6e8acc3a1c96a0542f9dc796b54ded06027b76313d5ea7e6df34cd366
MD5 dd68243fbeefb75d1656ff85888af915
BLAKE2b-256 26bcb382bb8e14030149eca3e239425c99af7db65176481feade405e9b5ef738

See more details on using hashes here.

Provenance

The following attestation bundles were made for qlroms-0.1.1a3.tar.gz:

Publisher: release.yml on andreanovoa/qlroms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qlroms-0.1.1a3-py3-none-any.whl.

File metadata

  • Download URL: qlroms-0.1.1a3-py3-none-any.whl
  • Upload date:
  • Size: 127.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for qlroms-0.1.1a3-py3-none-any.whl
Algorithm Hash digest
SHA256 e726d86e03d56bfdab54852c0c8c9596f543c321fb164ac6d9c9ddf4ab6744a4
MD5 c928a84522704ad9f17f82c1cf6de696
BLAKE2b-256 a35f70f1c4d94dbf447a0a26b41a547ca27d1a53c887fa59143f8c78b3bc010c

See more details on using hashes here.

Provenance

The following attestation bundles were made for qlroms-0.1.1a3-py3-none-any.whl:

Publisher: release.yml on andreanovoa/qlroms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1a3 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page