Warning: This is the development branch. Version 2.0 of
p-winds
implement self-consistent, fluid dynamics models instead of assuming isothermal Parker-wind models. If you would like to contribute, please submit a pull request to this branch.
Python implementation of Parker wind models for planetary atmospheres. p-winds
produces simplified, 1-D models of the upper atmosphere of a planet, and perform radiative transfer to calculate observable spectral signatures.
The scalable implementation of 1D isothermal models allows for atmospheric retrievals to calculate atmospheric escape rates and temperatures. In addition, the modular implementation allows for a smooth plugging-in of more complex descriptions to forward model their corresponding spectral signatures (e.g., self-consistent or 3D models).
As of version 2.0, p-winds
also includes a Python wrapper for the self-consistent, hydrodynamic escape simulation code ATES, originally developed by Andrea Caldiroli. See instructions on how to use it below.
The isothermal models of p-winds
are largely based on the theoretical framework of Oklopčić & Hirata (2018) and Lampón et al. (2020), which themselves based their work on the stellar wind model of Parker (1958). A description about the implementation of tidal effects is discussed in Vissapragada et al. (2022).
A paper describing p-winds
(Dos Santos et al. 2022) and its usage for research-grade astronomical applications was published in the journal Astronomy & Astrophysics. If you use this code in your research, please consider citing it. If you use the ATES interface within the fluid
module, please consider citing Caldiroli et al. (2021).
p-winds
contains and distributes data products from the MUSCLES and Mega-MUSCLES treasury surveys. If you use the tools.generate_muscles_spectrum()
function in your study, we highly encourage you to cite France et al. 2016, Youngblood et al. 2016, Loyd et al. 2016, Wilson et al. 2021 and Behr et al. 2023.
p-winds
requires the following packages:
python
versions 3.8 or later; the code has also been tested and validated in versions 3.6 (not supported) and 3.9.numpy
scipy
version 1.5 or laterastropy
flatstar
If you wish to use the ATES wrapper in the fluid
module, further requirements are necessary:
- A Fortran compiler: either
gfortran
orifort
needs to be available in your PATH - The custom version of ATES forked from the original and available here. The wrapper in the
fluid
module will not work with the original ATES code, only with the custom version.
You can install p-winds
using pip
or by compiling it from source.
Simply run the following command:
pip install p-winds
First, clone the repository and then navigate to it:
git clone https://github.com/ladsantos/p-winds.git
cd p-winds
And then compile it from source:
python setup.py install
You can test the installation from source with pytest
(you may need to
install pytest
first):
pytest tests
If you wish to use the ATES wrapper available in the fluid
module, you will need to download a custom ATES code here. The wrapper is not compatible with the original ATES code.
After downloading it, you will need to set the environment variable $ATES_DIR
to the location of the ATES code in your computer. For this example, I will use $HOME/ATES-Code
. This is done by running the following code in the command line:
export ATES_DIR="$HOME/ATES-Code"
If you do not want to set this environment variable every time you start a new session, you can add this line to your Record Columnar file (or rc
) in your user folder. Usually, this file is ~/.bashrc
if you use a bash shell, or ~/.zshrc
if you use zshell.
If you want to use the function tools.generate_muscles_spectrum()
or tools.standard_spectrum()
, you will need to download the reference data separately and set the environment variable $PWINDS_REFSPEC_DIR
. For your convenience, you can download all spectra supported by p-winds
in this compressed file.
After unzipping the compressed file, move the fits files to a path of your choosing; in this example, I will use the path $HOME/Data/p-winds_reference_spectra
. Next, set an environment variable $PWINDS_REFSPEC_DIR
that points to this path; this is done by running the following code in the command line:
export PWINDS_REFSPEC_DIR="$HOME/Data/p-winds_reference_spectra"
If you do not want to set this environment variable every time you start a new session, you can add this line to your Record Columnar file (or rc
) in your user folder. Usually, this file is ~/.bashrc
if you use a bash shell, or ~/.zshrc
if you use zshell.
Check out a quickstart Google Colab Notebook here. A similar quickstart Jupyter notebook is also available inside the docs/source/
folder.
You can contribute to the development of p-winds
either by submitting issues, or by submitting pull requests (PR). If you choose to submit a PR, please pull it to the dev
branch, which is where the experiments happen before being merged to the main
branch.
Check out the open issues.