normalising Flow exoPlanet Parameter Inference Toolkyt
Project description
FlopPITy
normalizing Flow exoplanet Parameter Inference Toolkyt
FlopPITy is a small Python package for atmospheric retrievals with
simulation-based inference. You provide observed spectra, define parameters,
and point FlopPITy at a simulator that returns model spectra. FlopPITy trains a
posterior with sbi.
This README is the shortest path to running a retrieval. For all options, ARCiS details, binary/multi-component retrievals, output files, resuming, plotting, PCA, and post-processing, see docs/detailed_guide.md.
Install
FlopPITy supports Python >=3.10, <3.13.
conda create -n floppity_env python=3.12.9
conda activate floppity_env
pip install floppity
Observation Files
Each observation file is a plain text table with at least three columns:
# wavelength observed_value uncertainty
Minimal Retrieval
import numpy as np
from floppity import Retrieval
def simulator(obs, parameters, thread=0, **kwargs):
"""Return model spectra keyed like obs.
parameters has shape (n_samples, n_parameters).
Each returned spectrum has shape (n_samples, n_wavelengths).
"""
spectra = {}
for key, obs_array in obs.items():
wavelength = obs_array[:, 0]
spectra[key] = # array of shape (n_samples, n_wavelengths)
return spectra
R = Retrieval(simulator)
R.get_obs(["path/to/observation.txt"])
R.add_parameter("parameter_name", prior_min, prior_max)
R.run()
That is the core FlopPITy workflow:
- Create a
Retrieval. - Load observations with
get_obs. - Add parameters with
add_parameter. - Run with
run.
Multiple Observations
R.get_obs({
"prism": "path/to/prism.txt",
"miri": "path/to/miri.txt",
})
Your simulator should return spectra with the same keys:
return {
"prism": prism_model,
"miri": miri_model,
}
Retrieval with ARCiS
FlopPITy comes with an ARCiS wrapper by default that can import the observations and parameters from an ARCiS input file. The workflow would then be:
from floppity import Retrieval
from floppity.simulators import read_ARCiS_input, ARCiS
R = Retrieval(ARCiS)
ARCiS_kwargs = dict(
input_file = 'path/to/ARCiS/input.txt',
output_dir = 'path/to/ARCiS/output',
)
parameters, observations = read_ARCiS_input(ARCiS_kwargs[input_file])
R.get_obs(observations)
R.parameters = parameters
R.run(simulator_kwargs=ARCiS_kwargs)
Inspecting Results
After run(), the trained posterior proposals are stored on the retrieval:
posterior = R.proposals[-1]
samples = posterior.sample((1000,))
You can also save and load the retrieval checkpoint:
R.save("retrieval.pkl")
R = Retrieval.load("retrieval.pkl")
posterior_samples_round_X.txt stores 1000 posterior samples from each round in
natural parameter units. If save_data=True, rounds/round_XXX/training_data.npz
stores the sampled parameters, simulated spectra, and per-sample metadata used
for that training round.
Next Steps
- Full guide: docs/detailed_guide.md
- ARCiS example: examples/ARCiS_retrieval.py
- Binary ARCiS notebook: examples/ARCiS_binary_retrieval.ipynb
- Plotting notebook: examples/plot_retrieval_results.ipynb
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 floppity-0.3.tar.gz.
File metadata
- Download URL: floppity-0.3.tar.gz
- Upload date:
- Size: 105.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2973e84a410ba824a5bce380c707ec89c7e03c8ef92b9a61c52aaa5dc85b9da
|
|
| MD5 |
1a7281e41414d1d7ba359f4d52cb3e06
|
|
| BLAKE2b-256 |
7bdefefddd7b1d34bf3d65c84b6df955866874dd5dbfe19d73ea24f0e3097352
|
Provenance
The following attestation bundles were made for floppity-0.3.tar.gz:
Publisher:
publish-pypi.yml on franciscoardevolmartinez/FlopPITy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
floppity-0.3.tar.gz -
Subject digest:
f2973e84a410ba824a5bce380c707ec89c7e03c8ef92b9a61c52aaa5dc85b9da - Sigstore transparency entry: 1395643784
- Sigstore integration time:
-
Permalink:
franciscoardevolmartinez/FlopPITy@48b4499ebcf0112faf4c4c0462ecc6645d968959 -
Branch / Tag:
refs/tags/v0.3 - Owner: https://github.com/franciscoardevolmartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@48b4499ebcf0112faf4c4c0462ecc6645d968959 -
Trigger Event:
release
-
Statement type:
File details
Details for the file floppity-0.3-py3-none-any.whl.
File metadata
- Download URL: floppity-0.3-py3-none-any.whl
- Upload date:
- Size: 80.7 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 |
6ca6b5ce349e6ead275016cb5be704f691b1bb2a281b1e608a43a97cdf714662
|
|
| MD5 |
c19b55730d33882287016151203049d4
|
|
| BLAKE2b-256 |
0b412809c6d8c45c6abff08b3c680af2d24af8c94d1626f1ae79f5514837a0e3
|
Provenance
The following attestation bundles were made for floppity-0.3-py3-none-any.whl:
Publisher:
publish-pypi.yml on franciscoardevolmartinez/FlopPITy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
floppity-0.3-py3-none-any.whl -
Subject digest:
6ca6b5ce349e6ead275016cb5be704f691b1bb2a281b1e608a43a97cdf714662 - Sigstore transparency entry: 1395643960
- Sigstore integration time:
-
Permalink:
franciscoardevolmartinez/FlopPITy@48b4499ebcf0112faf4c4c0462ecc6645d968959 -
Branch / Tag:
refs/tags/v0.3 - Owner: https://github.com/franciscoardevolmartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@48b4499ebcf0112faf4c4c0462ecc6645d968959 -
Trigger Event:
release
-
Statement type: