Installation

There are two possibilities to install ForMoSA. Installation of the package through PyPI or through GitHub.

Create a conda environment

We strongly recommend using a conda environment. You can learn more about conda here .

(For all users)

You can create your environment as:

$ conda create -n env_formosa python=3.11
$ conda activate env_formosa

(For macOS users)

To install and use our package in macOS with an M1 chip, a few extra steps are required. To use PyMultiNest to paralelize the processes, make sure you are building your conda environment under an OSX-ARM64 architecture. You can learn more here .

$ CONDA_SUBDIR=osx-arm64 conda create -n env_formosa python=3.11 numpy -c conda-forge
$ conda activate env_formosa
$ conda config --env --set subdir osx-arm64

A. Installation though PyPI

PyPI is the pip package manager, which will automatically install for you almost all the required dependencies in your environment. To install the latest version run:

$ pip install ForMoSA

To solve a standard error, run the following line in your environment:

$ conda install xarray dask netCDF4 bottleneck

B. Installation though GitHub

Install the following packages in your environment with pip install:

$ numpy
$ matplotlib
$ corner
$ astropy
$ scipy
$ scikit-learn
$ configobj
$ extinction
$ nestle
$ ultranest
$ PyAstronomy
$ spectres
$ pyyaml
$ importlib-metadata==4.13.0
$ xarray==2023.10.1

To solve a standard error, run the following line in your environment:

$ conda install xarray dask netCDF4 bottleneck

The last instalation step is to actually get ForMoSA. ForMoSA can be cloned from the main branch from our GitHub repository. You can do it by moving to the desired directory on your terminal and writing:

$ cd ~/YOUR_PATH/formosa_desk/
$ git clone https://github.com/exoAtmospheres/ForMoSA.git

PyMultiNest users

If you want to use Pymultinest to run your inversion, follow the installation instructions from PyMultinest, detailed below.

First, you need to clone PyMultinest from GitHub and install it.

$ cd ~/YOUR_PATH/formosa_desk/
$ git clone https://github.com/JohannesBuchner/PyMultiNest/
$ cd PyMultiNest
$ python setup.py install

Second, you need to corroborate that your system has a C++ and a Fortran interpreter. If you need to install brew, follow these instructions.

$ brew install cmake
$ brew install gcc
$ brew install open-mpi

Next, in your ForMoSA environment, install mpi4pi as:

$ pip install mpi4py

Then, install MultiNest by cloning the GitHub repository and building it. Make sure you empty the build folder if you run this step more than once.

$ cd ~/YOUR_PATH/formosa_desk/
$ git clone https://github.com/JohannesBuchner/MultiNest
$ cd MultiNest/build
$ cmake ..
$ make

Finally, copy the files that were generated by building MultiNest onto your conda environment by doing:

$ cp -v ~/YOUR_PATH/MultiNest/lib/* /YOUR_PATH/opt/anaconda3/envs/env_formosa/lib/

torch users

Torch is used for the emulators. If you wish to simply use it on CPU, you can do:

$ conda install torch torchvision torchaudio torchnmf

Otherwise, if you wish to use torch on GPU, you will need to have the right version on CUDA install on your device. Please follow the installation instructions from PyTorch.