Installation & Setup¶
FastSpecFit
is simple to install and has a relatively small number of
standard dependencies. Here, we describe three 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 node simply run the following commands
and you are ready to go:
source /global/cfs/cdirs/desi/software/desi_environment.sh main
module load fastspecfit/main
export FASTSPECFIT_TEMPLATES=$DESI_ROOT/science/gqp/templates/SSP-CKC14z
Note that these commands will load the development (latest) versions of all the software, which are not guaranteed to be stable. To load a specific set of versions you can do:
source /global/cfs/cdirs/desi/software/desi_environment.sh 22.5
module load fastspecfit/v1.0.1
export FASTSPECFIT_TEMPLATES=$DESI_ROOT/science/gqp/templates/SSP-CKC14z
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, simply 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 conda environment. For example, to install everything transparently
into an environment called fastspecfit one would do:
conda create -y --name fastspecfit python numpy scipy numba astropy matplotlib seaborn
conda activate fastspecfit
pip install fitsio healpy speclite
for package in desiutil desimodel desitarget desispec fastspecfit; do
python -m pip install git+https://github.com/desihub/$package.git@main#egg=$package
done
Alternatively, some users may want the DESI software to be installed in a more accessible location (e.g., /path/to/desi/code), in which case one would do:
conda create -y --name fastspecfit python numpy scipy numba astropy matplotlib seaborn
conda activate fastspecfit
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
Finally, FastSpecFit
has three 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; and
FASTSPECFIT_TEMPLATES
, which indicates the location of the simple stellar population (SSP) templates used to model the stellar continuum.
Note
Currently, the DESI data and spectral templates are only available to DESI collaborators; however, once the data are publicly released these instructions will be updated.
With the preceding caveat in mind, one can set up the remaining dependencies with the following commands:
export DESI_ROOT=/path/to/desi/data
export DUST_DIR=/path/to/dustmaps
export FASTSPECFIT_TEMPLATES=/path/to/fastspecfit/templates
wget -rk -np -nH --cut-dirs 5 -A fits -P $DUST_DIR "https://portal.nersc.gov/project/cosmo/data/dust/v0_1/maps"
3. Using Docker¶
Finally, for production runs and for expert users, FastSpecFit
is also
available as a Docker container which is served publicly in the
DockerHub/desihub repository.
For example, on a laptop one would retrieve (or update) and enter the v1.0.1 version of the container with:
docker pull desihub/fastspecfit:v1.0.1
docker run -it desihub/fastspecfit:v1.0.1
Alternatively, at NERSC one would need to use shifter:
shifterimg pull docker:desihub/fastspecfit:v1.0.1
shifter --image docker:desihub/fastspecfit:v1.0.1 bash
However, neither of the preceding commands define the required environment variables, although we provide a simple setup script which does. For simple interactive work at NERSC (e.g., in a login node) do:
mkdir -p /path/to/fastspecfit/setup/script
wget https://raw.githubusercontent.com/desihub/fastspecfit/main/bin/fastspecfit-setup.sh \
-O /path/to/fastspecfit/setup/script/fastspecfit-setup.sh
/path/to/fastspecfit/setup/script/fastspecfit-setup.sh shifter
source /path/to/fastspecfit/setup/script/fastspecfit-setup.sh env
Note
To run FastSpecFit
on a large sample of objects (or for a full production
or data release), please do not use a login node; instead, see the
Running FastSpecFit documentation for instructions and best practices.