Flexible Inverse Problem Solver (FIPS)
Project description
⚠️ Beta Release: FIPS is currently in beta (v0.1.0b1). The core API is stable and ready for testing, but may evolve based on user feedback. Please report any issues or edge cases you encounter.
Bridging Physics and Data
Inverse problems in geophysics and atmospheric science are incredibly complex, often involving massive state spaces, deeply heterogeneous observational networks, and explicit matrix-algebra requirements. While many general-purpose optimization tools exist, they often force researchers to strip away critical spatiotemporal metadata or translate pre-computed physical models into rigid, abstract array structures.
FIPS (Flexible Inverse Problem Solver) is built from the ground up to solve linear, matrix-based inverse problems without losing the context of your data. It provides the structural flexibility to handle messy, real-world realities seamlessly:
-
Native N-Dimensional Alignment: FIPS natively utilizes
pandas.MultiIndexto smoothly align heterogeneous datasets across any dimension. Whether you are mixing temporal, spatial, spectral, or sensor-specific data, your coordinates are never dropped or misaligned. -
Modular Block Architecture: Avoid wrangling monolithic arrays. Construct massive, multi-source state spaces and observation networks piece-by-piece using specialized
BlockandMatrixBlockobjects. -
Speak Your Domain's Language: Built explicitly around the standard
y = Hx + errorparadigm. Directly plug in your pre-computed forward operators ($H$), prior covariances ($S_0$), and model-data mismatches ($S_z$). -
Analytical Speed & Sparse Support: FIPS is built for scale. By leveraging optimized sparse data structures and direct linear algebra rather than expensive sampling algorithms, it computes exact analytical Maximum A Posteriori (MAP) estimates for massive state spaces in seconds.
Installation
From GitHub
pip install git+https://github.com/jmineau/fips
From Source
git clone https://github.com/jmineau/fips.git
cd fips
pip install -e .
Usage
Single-block — one observation source
import numpy as np
import pandas as pd
from fips import Block, CovarianceMatrix
from fips.problems.flux import FluxProblem
# State: gridded prior fluxes (time × lat × lon)
flux_idx = pd.MultiIndex.from_product(
[pd.date_range("2023-01", periods=3, freq="MS"), [37.0, 38.0], [-112.0, -111.0]],
names=["time", "lat", "lon"],
)
prior = pd.Series(np.ones(12) * 1.5, index=flux_idx, name="flux")
# Observations: tower concentration measurements
obs_idx = pd.MultiIndex.from_product(
[pd.date_range("2023-01", periods=8, freq="2W"), ["UOU"]],
names=["time", "site"],
)
obs = pd.Series(np.ones(8) * 400.0, index=obs_idx, name="concentration")
# Forward operator (Jacobian), flux error covariance, obs error covariance
H = pd.DataFrame(np.random.rand(8, 12), index=obs_idx, columns=flux_idx)
S_0 = pd.DataFrame(np.eye(12) * 0.5, index=flux_idx, columns=flux_idx)
S_z = pd.DataFrame(np.eye(8) * 0.1, index=obs_idx, columns=obs_idx)
problem = FluxProblem(
obs=obs, prior=prior,
forward_operator=H, prior_error=S_0, modeldata_mismatch=S_z,
).solve()
print(problem.posterior_fluxes) # posterior pd.Series indexed by (time, lat, lon)
print(problem.estimator.reduced_chi2) # reduced chi-squared statistic
Multi-block — combined station + satellite observations
import numpy as np
import pandas as pd
from fips import Block, Vector, Matrix, MatrixBlock, CovarianceMatrix, InverseProblem
# State: same gridded prior fluxes (from above)
N_f = 12
# Obs block 1: ground station in-situ concentrations
station_idx = pd.MultiIndex.from_product(
[pd.date_range("2023-01", periods=8, freq="2W"), ["UOU"]],
names=["time", "site"],
)
station_obs = Block(pd.Series(np.ones(8) * 400.0,
index=station_idx, name="station"))
# Obs block 2: satellite column-average concentrations
satellite_idx = pd.MultiIndex.from_product(
[pd.date_range("2023-01", periods=3, freq="MS"), [37.5], [-111.5]],
names=["time", "lat", "lon"],
)
satellite_obs = Block(pd.Series(np.ones(3) * 0.00400,
index=satellite_idx, name="satellite"))
# Combine obs blocks into a list
obs_blks = [station_obs, satellite_obs]
# Jacobian: one MatrixBlock per obs type, both mapping to the "flux" state block
H_blks = [
MatrixBlock(
pd.DataFrame(np.random.rand(8, N_f),
index=station_idx, columns=flux_idx),
row_block="station", col_block="flux",
),
MatrixBlock(
pd.DataFrame(np.random.rand(3, N_f),
index=satellite_idx, columns=flux_idx),
row_block="satellite", col_block="flux",
),]
# Prior error covariance: only flux errors, no cross-block covariances
S_0 = CovarianceMatrix(np.eye(N_f) * 0.5, index=flux_idx, columns=flux_idx)
# Model-data mismatch covariance: block-diagonal with separate error levels for stations vs. satellite
S_z_blks = [
CovarianceMatrix(np.eye(8) * 0.1, index=station_idx, columns=station_idx),
CovarianceMatrix(np.eye(3) * 0.2, index=satellite_idx, columns=satellite_idx),
]
# Pass blocks to the InverseProblem and solve
problem = InverseProblem(
obs=obs_blks, prior=prior,
forward_operator=H_blks, prior_error=S_0, modeldata_mismatch=S_z_blks,
).solve()
print(problem.posterior['flux']) # posterior pd.Series indexed by (time, lat, lon)
print(problem.estimator.reduced_chi2) # reduced chi-squared statistic
Documentation
Full documentation is available at https://jmineau.github.io/fips/
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fips-0.1.0b3.tar.gz.
File metadata
- Download URL: fips-0.1.0b3.tar.gz
- Upload date:
- Size: 83.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
708b1c77bcd8718bc80499be7d9a001f95fdb3a0a7b7989e7d7ae070c3431872
|
|
| MD5 |
c9ccc07036c67f69f775e41c5f3bb860
|
|
| BLAKE2b-256 |
3fc72b5a2a76caca305bf26fbc0c7326506a5ec393b1a76bac860677b18ea647
|
Provenance
The following attestation bundles were made for fips-0.1.0b3.tar.gz:
Publisher:
publish.yml on jmineau/fips
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fips-0.1.0b3.tar.gz -
Subject digest:
708b1c77bcd8718bc80499be7d9a001f95fdb3a0a7b7989e7d7ae070c3431872 - Sigstore transparency entry: 1518848556
- Sigstore integration time:
-
Permalink:
jmineau/fips@f57783e0180a8cc190c897dbf80252bc9e36f40d -
Branch / Tag:
refs/tags/v0.1.0b3 - Owner: https://github.com/jmineau
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f57783e0180a8cc190c897dbf80252bc9e36f40d -
Trigger Event:
push
-
Statement type:
File details
Details for the file fips-0.1.0b3-py3-none-any.whl.
File metadata
- Download URL: fips-0.1.0b3-py3-none-any.whl
- Upload date:
- Size: 60.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18e8d41f4c426e7822763ac063327f1e0d2c9ad0d7bfb2b60685d4e21d3ddfa4
|
|
| MD5 |
d632aab36b462ab0f199ae920a37f3c7
|
|
| BLAKE2b-256 |
897b2f5c39519b4003639d2b9817a6e3e3b10d996497b5db6161a2fb8684e5ea
|
Provenance
The following attestation bundles were made for fips-0.1.0b3-py3-none-any.whl:
Publisher:
publish.yml on jmineau/fips
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fips-0.1.0b3-py3-none-any.whl -
Subject digest:
18e8d41f4c426e7822763ac063327f1e0d2c9ad0d7bfb2b60685d4e21d3ddfa4 - Sigstore transparency entry: 1518848617
- Sigstore integration time:
-
Permalink:
jmineau/fips@f57783e0180a8cc190c897dbf80252bc9e36f40d -
Branch / Tag:
refs/tags/v0.1.0b3 - Owner: https://github.com/jmineau
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f57783e0180a8cc190c897dbf80252bc9e36f40d -
Trigger Event:
push
-
Statement type: