FlopPITy
normalizing Flow exoplanet Parameter Inference Toolkyt
FlopPITy allows the user to easily perform atmospheric retrievals using SNPE-C (citation) and neural spline flows (citation).
Installation guide
Currently FlopPITy doesn't work with python 3.13
$ conda create -n floppity_env python==3.12.9
$ conda activate floppity_env
$ pip install floppity
Basic usage:
- First, import FlopPITy:
from floppity import Retrieval
- Now you can initialize the retrieval class with a simulator. A simulator is a function that takes in parameters and returns spectra, look below to see specifically how it needs to be written. Functionality for ARCiS and PICASO comes built-in (you need to install them separately). Look further down for examples.
R = Retrieval(your_simulator_function)
- Read in observations and define parameters to retrieve:
R.get_obs({obs_0:'path/to/obs_0', obs_1:'path/to/obs_1',..., obs_n:np.array(shape=[n_wvl,>3])})
R.add_parameter(par_0, min, max)
R.add_parameter(par_1, min, max)
...
R.add_parameter(par_m, min, max)
- You can now run the retrieval, indicating the number of rounds and samples per round:
R.run(n_rounds=10, n_samples=1000, simulator_kwargs=simulator_kwargs)
- Great! You can now inspect your posterior:
fig = R.plot_corner()
ARCiS example:
- Firstly, initialize your retrieval object:
from floppity import Retrieval
from floppity.simulators import read_ARCiS_input, ARCiS
R = Retrieval(ARCiS)
- For ARCiS, the observations and parameters can be read from the ARCiS input file:
pars, obs_list = read_ARCiS_input('path/to/ARCiS/input')
R.get_obs(obs_list)
R.parameters=pars
- The input file and output directory need to be passed in a dictionary:
ARCiS_kwargs= dict(
ARCiS_dir = "/path/to/ARCiS/executable", #only needs to be set if ARCiS is not on the default path
input_file = 'path/to/ARCiS/input',
output_dir = 'path/to/output',
)
- You can now run the retrieval as usual:
R.run(n_rounds=10, n_samples=1000, simulator_kwargs=ARCiS_kwargs)
PICASO example:
- Running a retrieval with PICASO is very similar (this only works with the gridtree branch):
from floppity import Retrieval
from floppity.simulators import read_PICASO_config, PICASO
R = Retrieval(PICASO)
pars, obs_list = read_PICASO_config('path/to/config.toml')
R.get_obs(obs_list)
R.parameters=pars
- The configuration file needs to be passed as a kwarg:
PICASO_kwargs= dict(
config_file = 'path/to/config.toml'
)
- You can now run the retrieval as usual:
R.run(n_rounds=10, n_samples=1000, simulator_kwargs=PICASO_kwargs)
Writing a simulator
Writing a simulator to work for FlopPITy is relatively straightforward. All that's needed is a function that takes in observations and
parameters and returns spectra. The spectra need to be returned in a dictionary where each key represents each of the observations simulated (e.g. simulated['prism'] contains PRISM spectra and simulated['lrs'] contains MIRI/LRS spectra):
def simulator(obs, parameters, **kwargs):
wvl_prism = obs['prism'][:,0]
wvl_lrs = obs['lrs'][:,0]
...
wvl_n = obs[n][:,0]
spectra={}
spectra['prism'] = # array of shape (ndims, len(wvl_prism))
spectra['lrs'] = # array of shape (ndims, len(wvl_lrs))
...
spectra[n] = # array of shape (ndims, len(wvl_n))
return spectra
Advanced options:
- Additional post processing parameters (currently
RV,vrot,offsetandscaling) can be added, for example:
R.add_parameter('RV', -100, 100, post_process=True) # km/s
- For offsets and scalings between different observations, the parameters should be named 'offset_{observation_key}'. For example, if we wanted to fit for a scaling factor between 0.95 and 1.05:
R.add_parameter('scaling_obs2', 0.95, 1.05, post_process=True)
Metadata
Release files for FlopPITy 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| floppity-0.2.2.tar.gz | 1.6 MB | Without provenance | Details for floppity-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| floppity-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for floppity-0.2.2-py3-none-any.whl |
Total release size: 1.6 MB
Release files / floppity-0.2.2.tar.gz
| Download URL | floppity-0.2.2.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5adc36e70a7093b156393fac6e689c9815ca656e7128374989cedf5b5741c55
|
|
BLAKE2b-256 checksum How to use checksums |
9a7ed9b15bc694a687444e37d758f5a7b0490e73cbd1fc2b69786bdcd06be42b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.7
|
Release files / floppity-0.2.2-py3-none-any.whl
| Download URL | floppity-0.2.2-py3-none-any.whl |
|---|---|
| Size | 74.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c8885c7900d4a3037b0ea818e0a0d6d0a3ca2a2f64ba8455d56cfb546cf8280
|
|
BLAKE2b-256 checksum How to use checksums |
51e8ac6d2716e5f7d21429c1e1c132ccf216158ed0578c29f44dfc69a63c6571
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.7
|
Security for FlopPITy 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.