Installation#
CWInPy can currently be installed and run on Linux and Mac OS systems with Python 3.8 or higher, but Windows installation is not supported (although installation though WSL can be successful). One of the core package requirements needs the GNU Scientific Library (GSL) to be installed, so this should either be installed globally (e.g., via the OS’s standard package management system) or could be installed within a conda environment.
Note
If planning to use the Tempo2 pulsar timing package within CWInPy for phases calculations, it must already be installed on you system (this will be done by default if installing CWInPy through its conda package). The easiest way to install Tempo2 is within a conda environment and installing the libstempo package:
$ conda install -c conda-forge libstempo
Install CWInPy from source#
CWInPy can be installed from its source git repository using the supplied Python setup script.
First, clone the repository
$ git clone https://github.com/cwinpy/cwinpy.git
$ git clone git@github.com:cwinpy/cwinpy.git
Using the GitHub CLI
$ gh repo clone cwinpy/cwinpy
then install CWInPy along with all its requirements using:
$ cd cwinpy/
$ pip install .
Note
If installing on Mac OS, the required htcondor package is not installable via pip. Either install htcondor as described here, or install it in a conda environment with:
$ conda install -c conda-forge htcondor
before attempting to install CWInPy.
If wanting to be able to run the CWInPy test suite see the installation instructions in the “Developer” tab.
For developers, you can either install with the requirements using
$ cd cwinpy/
$ pip install -e .[test,dev,docs]
or install using your own versions of the required files using
$ cd cwinpy/
$ pip install --no-deps -e .[dev]
The development installation includes the pre-commit package. This is used to set up git pre-commit hooks that automatically run scripts such as flake8, black, isort and a spell check to ensure that any commits you make have a consistent style. Before starting as a developer you must run
$ pre-commit install
within the cwinpy
repository directory, which will add the pre-commit
hook file to
your .git/hooks
directory. After this, when running git commit
the checks will
automatically be run and results will be presented to you. In some cases the required fixes
will be automatically applied, but in cases where there was some failure it will print a
message about why it failed. In these cases you will have to manually correct the offending
files before running git commit
again.
Running parameter estimation via the bilby package with any sampler other than the default of dynesty requires those additional samplers to be installed separately.
Install CWInPy via a package manager#
CWInPy is available through the PyPI and Conda package management systems and can be installed using:
$ pip install cwinpy
Within a conda environment use
$ conda install -c conda-forge cwinpy
CWInPy is also available as part of the
IGWN Conda Distribution over CVMFS.
To install CVMFS (for Linux and Mac OS only) you can follow the instructions here. Once this is installed you can enter a Conda
environment, e.g., igwn
, from a terminal using:
$ source /cvmfs/software.igwn.org/conda/etc/profile.d/conda.sh $ conda activate igwn
If running on many of the IGWN Computing Grid clusters, the first line can be omitted as the required Conda distribution should automatically be in your path.
Documentation#
The documentation for the project can be built locally from the source code by installing CWInPy with the additional required dependencies using:
$ pip install .[docs]
and then running
$ cd docs
$ make html
Testing#
The package comes with a range of unit tests that can be run from the cloned repository. To run these tests first install CWInPy with the additional required dependencies using
$ pip install -e .[test]
and then run pytest with:
$ pytest
from the repository’s base directory after the code has been installed.