Skip to main content

Rombus: Helps you qucikly and easily compute slow and complex models

Rombus is a tool for building reduced order models (ROMs): matrix representations of arbitrary models which can be rapidly and easily computed for arbitrary parameter sets.

Building a ROM with Rombus is easy. All you need to do is install it like so:

$ pip install rombus

define your model like this (in this trivial case, a file named my_model.py specifying a simple second-order polynomial):

from numpy import ndarray, polyval, linspace
from rombus.model import RombusModel
from typing import NamedTuple


class Model(RombusModel):
    """Class for creating a ROM for the function y(x)=a2*x^2+a1*x+a0"""

    coordinate.set("x", 0.0, 10.0, 11, label="$x$")

    ordinate.set("y", label="$y(x)$")

    params.add("a0", -10, 10)
    params.add("a1", -10, 10)
    params.add("a2", -10, 10)

    def compute(self, p: NamedTuple, x: ndarray) -> ndarray:
        """Compute the model for a given parameter set."""
        return polyval([p.a2, p.a1, p.a0], x)

and specify a set of points (in this case, the file my_model_samples.py) to build your ROM from:

-10, -10,-10
-10,  10,-10
-10, -10, 10
-10,  10, 10
 10, -10,-10
 10,  10,-10
 10, -10, 10
 10,  10, 10

You build your ROM like this:

$ rombus build my_model:Model my_model_samples.csv

This produces an HDF5 file named my_model.hdf5. You can then use your new ROM in your Python projects like this:

from rombus.rom import ReducedOrderModel

ROM = ReducedOrderModel.from_file('my_model.hdf5')
sample = ROM.model.sample({"a0":0,"a1":0,"a2":1})
model_ROM = ROM.evaluate(sample)
for x, y in zip(ROM.model.domain,model_ROM):
    print(f"{x:5.2f} {y:6.2f}")

which generates the output:

 0.00   0.00
 1.00   1.00
 2.00   4.00
 3.00   9.00
 4.00  16.00
 5.00  25.00
 6.00  36.00
 7.00  49.00
 8.00  64.00
 9.00  81.00
10.00 100.00

Release files for rombus 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rombus 1.2.3
File Size Uploaded
rombus-1.2.3.tar.gz 38.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rombus 1.2.3
File Interpreter ABI Platform
rombus-1.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 83.6 kB

Release files / rombus-1.2.3.tar.gz

Download URL rombus-1.2.3.tar.gz
Size 38.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d020803a0d694c61ca9dc36f98e82c066bd1d5413e67e9dcbc88738365482fdd
BLAKE2b-256 checksum
How to use checksums
91b0a518de581936cfe826277144a38f1b1a27e504291745b30181492e329b82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.3 Linux/6.8.0-1021-azure

Release files / rombus-1.2.3-py3-none-any.whl

Download URL rombus-1.2.3-py3-none-any.whl
Size 45.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32854c1386b4c844bf2298ac46028f4175cab49b27df90986f1c77f557905be0
BLAKE2b-256 checksum
How to use checksums
0fb07f81ddfc8295cedd92f049095f3670be60f8b8662fd9aefd7eee5c9b7dfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.3 Linux/6.8.0-1021-azure

Release history Release notifications | RSS feed

This release

1.2.3 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.5

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.13

2 release 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