Installation & Setup

FastSpecFit is simple to install and has a relatively small number of standard dependencies. Here, we describe two different ways of setting up FastSpecFit:

1. NERSC Installation

At NERSC, FastSpecFit can be loaded trivially on top of the standard DESI software stack. In a login or interactive Perlmutter node, simply run the following commands:

source /global/cfs/cdirs/desi/software/desi_environment.sh main
module load fastspecfit/main

Alternatively, some users may want to access FastSpecFit through NERSC’s JupyterHub notebook server. To set up the kernel first do:

mkdir -p ${HOME}/.local/share/jupyter/kernels/fastspecfit
wget -O ${HOME}/.local/share/jupyter/kernels/fastspecfit/kernel.json \
  https://raw.githubusercontent.com/desihub/fastspecfit/main/etc/jupyter-kernel.json

Then, in JupyterHub, select the FastSpecFit kernel and you are all set!

2. Laptop Installation

To install FastSpecFit and all its dependencies on a laptop we recommend a dedicated Miniforge environment. (Unfortunately, FastSpecFit has not yet been uploaded to PyPi, although there is an open ticket to do so.) Therefore, for the time being, the code and its dependencies must be installed “by hand” in an accessible location (e.g., /path/to/desi/code) with the following commands:

conda create -y --name fastspec python numpy scipy numba astropy matplotlib seaborn
conda activate fastspec
pip install fitsio healpy speclite

export DESI_CODE=/path/to/desi/code
mkdir -p $DESI_CODE

pushd $DESI_CODE
for package in desiutil desimodel desitarget desispec fastspecfit; do
  git clone https://github.com/desihub/$package.git
  export PATH=$DESI_CODE/$package/bin:$PATH
  export PYTHONPATH=$DESI_CODE/$package/py:$PYTHONPATH
done
popd

Note that if you are planning to write documentation you will also need to install the following dependencies:

pip install sphinx sphinx-toolbox sphinx-rtd-theme sphinxcontrib-napoleon

Finally, FastSpecFit has four more data dependencies, each specified with their own environment variable:

These environment variables can be set with the following commands:

export DESI_ROOT=/path/to/desi/data
export DUST_DIR=/path/to/dustmaps
export DR9_DIR=/path/to/dr9/data
export FTEMPLATES_DIR=/path/to/templates/fastspecfit

wget -r -np -nH --cut-dirs 5 -A fits -P $DUST_DIR \
  https://portal.nersc.gov/project/cosmo/data/dust/v0_1/maps
wget -O $FTEMPLATES_DIR/ftemplates-chabrier-1.2.0.fits \
  https://data.desi.lbl.gov/public/external/templates/fastspecfit/1.2.0/ftemplates-chabrier-1.2.0.fits

Note

The DESI Early Data Release (EDR) became publicly available in June 2023!