This is a python package providing an interface to perform F-statistic based continuous gravitational wave (CW) searches, built on top of the LALSuite library.
Getting started:
- This README provides information on installing, contributing to and citing PyFstat.
- PyFstat usage and its API are documented at pyfstat.readthedocs.io.
- We also have a number of examples, demonstrating different use cases. You can run them locally, or online as jupyter notebooks with binder.
- New contributors are encouraged to have a look into how to set up a development environment
- The project wiki is mainly used for developer information.
- A changelog is also available.
PyFstat releases can be installed in a variety of ways, including
Docker/Singularity images,
pip install
from PyPi,
conda
and from source releases on Zenodo.
Latest development versions can
also be installed with pip
or from a local git clone.
If you don't have a recent python
installation (3.7+
) on your system,
then Docker
or conda
are the easiest paths.
In either case, be sure to also check out the notes on dependencies, ephemerides files and citing this work.
Ready-to-use PyFstat containers are available at the Packages
page. A GitHub account together with a personal access token is required.
Go to the wiki page
to learn how to pull them from the GitHub registry using Docker
or Singularity
.
See this wiki page for installing conda itself and for a minimal .yml recipe to set up a PyFstat-specific environment.
To install into an existing conda environment, all you need to do is
conda install -c conda-forge pyfstat
If getting PyFstat from conda-forge, it already includes the required ephemerides files.
PyPI releases are available from https://pypi.org/project/PyFstat/.
Note that the PyFstat installation will fail at the
LALSuite dependency stage
if your pip
is too old (e.g. 18.1); to be on the safe side, before starting do
pip install --upgrade pip
Then, a simple
pip install pyfstat
should give you the latest release version with all dependencies.
If you are not installing into a venv
or conda environment,
on many systems you may need to use the --user
flag.
Recent releases now also include a sufficient minimal set of ephemerides files.
Development versions of PyFstat can also be easily installed by pointing pip directly to this git repository, which will give you the latest version of the master branch:
pip install git+https://github.com/PyFstat/PyFstat
or, if you have an ssh key installed in github:
pip install git+ssh://git@github.com/PyFstat/PyFstat
This should pull in all dependencies in the same way as installing from PyPI, and recent lalsuite dependencies will include ephemerides files too.
You can download a source release tarball from Zenodo and extract to an arbitrary temporary directory. Alternatively, clone this repository:
git clone https://github.com/PyFstat/PyFstat.git
The module and associated scripts can be installed system wide (or to the currently active venv), assuming you are in the (extracted or cloned) source directory, via
python setup.py install
As a developer, alternatively
python setup.py develop
or
pip install -e /path/to/PyFstat
can be useful so you can directly see any changes you make in action. Alternatively (not recommended!), add the source directory directly to your python path.
To check that the installation was successful, run
python -c 'import pyfstat'
if no error message is output, then you have installed pyfstat
. Note that
the module will be installed to whichever python executable you call it from.
This should pull in all dependencies in the same way as installing from PyPI, and recent lalsuite dependencies will include ephemerides files too.
PyFstat uses the following external python modules,
which should all be pulled in automatically if you use pip
:
For a general introduction to installing modules, see here.
PyFstat manages optional dependencies through setuptool's extras_require
.
Available sets of optional dependencies are:
chainconsumer
(Samreay/Chainconsumer): Required to run some optional plotting methods and some of the example scripts.pycuda
(PyPI): Required for thetCWFstatMapVersion=pycuda
option of theTransientGridSearch
class. (Note: Installingpycuda
requires a workingnvcc
compiler in your path.)style
: Includes theflake8
linter (flake8.pycqa) andblack
style checker (black.readthedocs). These checks are required to pass by the online integration pipeline.test
: For running the test suite locally using pytest (python -m pytest tests.py
).wheel
: Includeswheel
andcheck-wheel-contents
.dev
: Collectsstyle
,test
andwheel
.docs
: Required dependencies to build the documentation.
Installation can be done by adding one or more of the aforementioned tags to the installation command.
For example, installing PyFstat including chainconsumer
, pycuda
and style
dependencies would look like
(mind the lack of whitespaces!)
pip install pyfstat[chainconsumer,pycuda,style]
This command accepts the "development mode" tag -e
.
- If you prefer to make your own LALSuite installation
from source,
make sure it is swig-enabled and contains at least the
lalpulsar
andlalapps
packages. A minimal configuration line to use would be e.g.:
./configure --prefix=${HOME}/lalsuite-install --disable-all-lal --enable-lalpulsar --enable-lalapps --enable-swig
PyFstat requires paths to earth and sun ephemerides files
in order to use the lalpulsar.ComputeFstat
module and various lalapps
tools.
Recent releases of the lal
and lalpulsar
dependencies from conda
or lalsuite
from PyPI
include a sufficient minimal set of such files
(the [earth/sun]00-40-DE405
default versions)
and no further setup should be needed.
The same should be true if you have built and installed LALSuite from source,
and set your paths up properly through something like
source $MYLALPATH/etc/lalsuite-user-env.sh
.
However, if you run into errors with these files not found,
or want to use different versions,
you can manually download files from
this directory.
You then need to tell PyFstat where to find these files,
by creating a ~/.pyfstat.conf
file in your home directory which looks like
earth_ephem = '/home/<USER>/lalsuite-install/share/lalpulsar/earth00-19-DE405.dat.gz'
sun_ephem = '/home/<USER>/lalsuite-install/share/lalpulsar/sun00-19-DE405.dat.gz'
Paths set in this way will take precedence over lal's default resolution logic.
You can also manually specify ephemerides files when initialising
each PyFstat class with the earth_ephem
and sun_ephem
arguments.
The alternative of relying on environment variables (as previously recommended by PyFstat's documentation) is considered deprecated by LALSuite maintainers and will no longer be supported by PyFstat in future versions.
This project is open to development, please feel free to contact us for advice or just jump in and submit an issue or pull request.
Here's what you need to know:
- The github automated tests currently run on
python
[3.7,3.8,3.9,3.10] and new PRs need to pass all these. - The automated test also runs
the black style checker
and the flake8 linter.
If at all possible, please run these two tools locally before pushing changes / submitting PRs:
flake8 --count --statistics .
to find common coding errors and then fix them manually, and thenblack --check --diff .
to show the required style changes, orblack .
to automatically apply them. bin/setup-dev-tools.sh
gets your virtual environment ready for you. After making sure you are using a virtual environment (venv or conda), it installsblack
,flake8
,pre-commit
,pytest
,wheel
viapip
and usespre-commit
to run theblack
andflake8
using a pre-commit hook. In this way, you will be prompted a warning whenever you forget to runblack
orflake8
before doing your commit 😉.
Maintainers:
- Greg Ashton
- David Keitel
Active contributors:
- Reinhard Prix
- Rodrigo Tenorio
Other contributors:
- Karl Wette
- Sylvia Zhu
- Dan Foreman-Mackey (
pyfstat.gridcorner
is based on DFM's corner.py)
If you use PyFstat
in a publication we would appreciate if you cite both a release DOI for the software itself (see below)
and one or more of the following scientific papers:
- The recent JOSS (Journal of Open Source Software) paper summarising the package: Keitel, Tenorio, Ashton & Prix 2021 (inspire:1842895 / ADS:2021arXiv210110915K).
- The original paper introducing the package and the MCMC functionality: Ashton&Prix 2018 (inspire:1655200 / ADS:2018PhRvD..97j3020A).
- The methods paper introducing a Bayes factor to evaluate the multi-stage follow-up: Tenorio, Keitel, Sintes 2021 (inspire:1865975 / ADS:2021PhRvD.104h4012T)
- For transient searches: Keitel&Ashton 2018 (inspire:1673205 / ADS:2018CQGra..35t5003K).
- For glitch-robust searches: Ashton, Prix & Jones 2018 (inspire:1672396 / ADS:2018PhRvD..98f3011A
If you'd additionally like to cite the PyFstat
package in general,
please refer to the version-independent Zenodo listing
or use directly the following BibTeX entry:
@misc{pyfstat,
author = {Ashton, Gregory and
Keitel, David and
Prix, Reinhard
and Tenorio, Rodrigo},
title = {PyFstat},
month = jul,
year = 2020,
publisher = {Zenodo},
doi = {10.5281/zenodo.3967045},
url = {https://doi.org/10.5281/zenodo.3967045},
note = {\url{https://doi.org/10.5281/zenodo.3967045}}
}
You can also obtain DOIs for individual versioned releases (from 1.5.x upward) from the right sidebar at Zenodo.
Alternatively, if you've used PyFstat up to version 1.4.x in your works, the DOIs for those versions can be found from the sidebar at this older Zenodo record and please amend the BibTeX entry accordingly.
PyFstat uses the ptemcee
sampler, which can be
cited as
Vousden, Far & Mandel 2015
(ADS:2016MNRAS.455.1919V)
and Foreman-Mackey, Hogg, Lang, and Goodman 2012
(2013PASP..125..306F).
PyFstat also makes generous use of functionality from the LALSuite library and it will usually be appropriate to also cite that project (see this recommended bibtex entry) and also Wette 2020 (inspire:1837108 / ADS:2020SoftX..1200634W) for the C-to-python SWIG bindings.