We recommend using Spaceborne in a dedicated Conda environment. This ensures all dependencies are properly managed.
In the root folder of the Spaceborne repository, run:
$ conda env create -f environment.yaml
$ conda activate spaceborne
🐍 note: using mamba
instead of conda
in the first line will significantly speed up the environment creation. To install mamba
, run conda install mamba
in your base
environment)
Spaceborne
uses CCL
as the backend library for many cosmological calculations. Some installation issues have been found with its Python wrapper pyccl
; in case of problems with this package, please refer to the official instructions (see also the CCL GitHub page). To facilitate the process, however, its main dependencies - Swig
and CMake
- have already been included in the environment, so after creating and activating it, a simple
$ conda install -c conda-forge pyccl
or
$ pip install pyccl
should do the job.
If the problem persists, you can try with
$ sudo apt-get install gfortran cmake build-essential autoconf bison
on Linux and
$ brew install gfortran cmake build-essential autoconf bison
on OSX. The installation on Windows machines is not supported.
To install Spaceborne directly:
$ pip install .
Poetry is an alternative package manager. To use it:
- Install Poetry:
$ curl -sSL https://install.python-poetry.org | python3 -
- Install Spaceborne:
$ poetry install
Spaceborne leverages julia
for computationally intensive tasks. We recommend installing julia
via juliaup
:
$ curl -fsSL https://install.julialang.org | sh # Install juliaup
$ juliaup default 1.10 # Install Julia version 1.10
Then, install the required Julia packages:
$ julia -e 'using Pkg; Pkg.add("LoopVectorization"); Pkg.add("YAML"); Pkg.add("NPZ")'
All the available options and configurations can be found, along with their explanation, in the config.yaml
file. To run Spaceborne
with the configuration specified in the Spaceborne/config.yaml
file, simply execute the following command:
$ python main.py
If you want to use a configuration file with a different name and/or location, you can instead run with
$ python main.py --config=<path_to_config_file>
for example:
$ python main.py --config="path/to/my/config/config.yaml"
To display the plots generated by the code, add the --show_plots
flag:
$ python main.py --config="path/to/my/config/config.yaml" --show_plots