Skip to content

ladsantos/p-winds

Repository files navigation

p-winds

Documentation Status Build Status arXiv Code DOI

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 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).

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.

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.

Warning: As of version 1.4.5, p-winds does not include the MUSCLES data anymore to make the package leaner. You will need to download this data separately and set an environment variable containing the path to the data. Follow the installation instructions below.

Background

p-winds is 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).

Requirements

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 later
  • astropy
  • flatstar

Installation

You can install p-winds using pip or by compiling it from source.

Option 1: Using pip (stable version)

Simply run the following command:

pip install p-winds

Option 2: Compile from source (development version)

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

Download reference spectra and set environment variable

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.

Quickstart example

Check out a quickstart Google Colab Notebook here. A similar quickstart Jupyter notebook is also available inside the docs/source/ folder.

Contributing

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.

Future features and known problems

Check out the open issues.