Installation¶
The core implementation of celerite is written in C++ so this will need to be compiled to be called from Python. The easiest way for a new user to do this will be by following the directions in the Using conda section below. Power users might be able to eke out a bit more performance by tuning the linear algebra library and installing From Source.
Using conda¶
The easiest way to install celerite is using conda (via conda-forge) with the following command:
conda install -c conda-forge celerite
From Source¶
The source code for celerite can be downloaded from GitHub by running
git clone https://github.com/dfm/celerite.git
Dependencies¶
For the Python interface, you’ll (obviously) need a Python installation and I recommend conda if you don’t already have your own opinions.
After installing Python, the following dependencies are required to build celerite:
- NumPy for math and linear algebra in Python, and
- pybind11 for the Python–C++ interface.
- autograd (optional) for computing gradients in celerite models.
If you’re using conda, you can install all of the dependencies with the following command:
conda install -c conda-forge numpy pybind11 autograd
Building¶
After installing the dependencies, you can build the celerite module by running:
python setup.py install
in the root directory of the source tree.
Automatic differentiation¶
Gradients of celerite models are computed using automatic differentiation. By
default, this is implemented using the AutoDiffScalar
in Eigen, but it is
possible to get faster performance by using the stan-math library. To do this, download the library from
the GitHub page and build celerite using
the following command:
python setup.py build_ext -I${STAN}:${STAN}/lib/boost_1.62.0:${STAN}/lib/cvodes_2.9.0/include -DUSE_STAN_MATH install
where ${STAN}
is the directory where you downloaded the stan-math library.
Testing¶
To run the unit tests, install pytest and then execute:
py.test -v
All of the tests should (of course) pass. If any of the tests don’t pass and if you can’t sort out why, open an issue on GitHub.