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
Or, to load a specific version or tag of the code simply replace main with
the desired version, for example:
source /global/cfs/cdirs/desi/software/desi_environment.sh 24.8
module load fastspecfit/2.5.2
JupyterHub¶
Alternatively, some users may want to access FastSpecFit through NERSC’s
JupyterHub notebook server. In order to use this service, however, we first
have to install the appropriate kernel. To set up the main kernel do (just
once!):
mkdir -p ${HOME}/.local/share/jupyter/kernels/fastspecfit-main
wget -O ${HOME}/.local/share/jupyter/kernels/fastspecfit-main/kernel.json \
https://raw.githubusercontent.com/desihub/fastspecfit/main/etc/jupyter-kernel.json
Or you can install a kernal with the latest version of the code by executing the following commands (as before, just one time):
mkdir -p ${HOME}/.local/share/jupyter/kernels/fastspecfit-latest
wget -O ${HOME}/.local/share/jupyter/kernels/fastspecfit-latest/kernel.json \
https://raw.githubusercontent.com/desihub/fastspecfit/main/etc/jupyter-kernel-latest.json
Then, in JupyterHub, select either the FastSpecFit Main or FastSpecFit Latest kernel and then have fun coding!
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:
DESI_ROOT, which specifies the top-level location of the DESI data;
DUST_DIR, which specifies the location of the Schlegel, Finkbeiner, & Davis dust maps;
FPHOTO_DIR, which specifies the location of the DESI Legacy Imaging Surveys Data Release 9 (DR9) data; and
FTEMPLATES_DIR, which indicates the location of the stellar population synthesis models used byFastSpecFit.
These environment variables can be set with the following commands:
export DESI_ROOT=/path/to/desi/data
export DUST_DIR=/path/to/dustmaps
export FPHOTO_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-2.0.0.fits \
https://data.desi.lbl.gov/public/external/templates/fastspecfit/2.0.0/ftemplates-chabrier-2.0.0.fits
Note
The DESI Early Data Release (EDR) became publicly available in June 2023!