normalising Flow exoPlanet Parameter Inference Toolkyt
Project description
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
from floppity.simulators import read_ARCiS_input, ARCiS
- Now you can initialize the retrieval class with a simulator. A python wrapper for ARCiS comes built-in (you need to install ARCiS on your own tho):
R = Retrieval(ARCiS)
- Read in observations and define parameters to retrieve:
R.get_obs(['path/to/obs_0', 'path/to/obs_1',..., 'path/to/obs_n'])
R.add_parameter(par_0, min, max)
R.add_parameter(par_1, min, max)
...
R.add_parameter(par_m, min, max)
- 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
- For retrievals using ARCiS, 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 = arcis_input,
output_dir = 'path/to/output',
)
- You can now run the retrieval, indicating the number of rounds and samples per round:
R.run_retrieval(n_rounds=10, n_samples=1000, simulator_kwargs=ARCiS_kwargs)
- Great! You can now inspect your posterior:
fig = R.plot_corner()
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[0] contains PRISM spectra and simulated[1] contains MIRI/LRS spectra):
def simulator(obs, parameters, **kwargs):
wvl_0 = obs[0][:,0]
wvl_1 = obs[1][:,0]
...
wvl_n = obs[n][:,0]
spectra={}
spectra[0] = # array of shape (ndims, len(wvl_0))
spectra[1] = # array of shape (ndims, len(wvl_1))
...
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
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.0.10.tar.gz.
File metadata
- Download URL: floppity-0.0.10.tar.gz
- Upload date:
- Size: 2.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1853c3cecece86fb3a9248040fb938eebf485744fc53624a86ac1db5976204ed
|
|
| MD5 |
e14a5ca86dfbf5afe01179e228cac2f8
|
|
| BLAKE2b-256 |
a9c222a927eab68ef35a4e0bdeb12a57aaf7f13fa5dcbc69127d15714d6c5898
|
File details
Details for the file floppity-0.0.10-py3-none-any.whl.
File metadata
- Download URL: floppity-0.0.10-py3-none-any.whl
- Upload date:
- Size: 69.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
794f196dac80bf01ef5422c33c35192a577160a930f40412137746a381e51e17
|
|
| MD5 |
02c76f04388c69a6cce0b9fd22fabbbc
|
|
| BLAKE2b-256 |
0590b6192d16d1b15bf3926b36427d1de69e233df421bedb244c045b37e94a77
|