a python package for gravitational wave analysis with the F-statistic
Project description
PyFstat
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 installation, contributing to and citing PyFstat.
- The classes provided by PyFstat and the full API are documented at pyfstat.readthedocs.io (work in progress)
- Additional usage documentation will be added to the project wiki (work in progress).
- We also have a number of examples, demonstrating different use cases. Run them as jupyter notebooks with binder.
- New contributors are encouraged to have a look into how to set up a development environment
A changelog is also available (only maintained from v1.2 onwards).
Installation
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.6+) 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.
Docker container
Ready-to-use PyFstat containers are available at the Packages page. A git-hub account together with a personal access token is required. Go to the wiki page to learn how to pull them from the git-hub registry using Docker or Singularity.
conda installation
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.
pip install from PyPi
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.
Note that, if using pip, you need to install phemerides files manually.
pip install from github
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
In this case, you also need to install phemerides files manually.
install PyFstat from source (Zenodo or git clone)
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.
In this case, you also need to install phemerides files manually.
Dependencies
PyFstat uses the following external python modules,
which should all be pulled in automatically if you use pip:
In case the automatic install doesn't properly pull in all dependencies, to install all of these modules manually, you can also run
pip install -r /PATH/TO/THIS/DIRECTORY/requirements.txt
For a general introduction to installing modules, see here.
Optional dependencies:
- pycuda,
required for the
tCWFstatMapVersion=pycudaoption of theTransientGridSearchclass. (Note:pip install pycudarequires a workingnvcccompiler in your path.) - pytest for running the test suite locally
(
python -m pytest tests.py) - Developers are also highly encouraged to use the flake8 linter and black style checker locally, as these checks are required to pass by the online integration pipeline.
- Some optional plotting methods depend on the additional package
chainconsumer
and some of the example scripts require this to run.
For
pipusers, this is most conveniently installed by
pip install chainconsumer
- If you prefer to make your own LALSuite installation
from source,
make sure it is swig-enabled and contains at least the
lalpulsarandlalappspackages. A minimal configuration line to use would be e.g.:
./configure --prefix=${HOME}/lalsuite-install --disable-all-lal --enable-lalpulsar --enable-lalapps --enable-swig
Ephemerides installation
PyFstat requires paths to earth and sun ephemerides files
in order to use the lalpulsar.ComputeFstat module and various lalapps tools.
If you have done pip install lalsuite
(or it got pulled in automatically as a dependency),
you need to manually download at least these two files:
(Other ephemerides versions exist, but these two files should be sufficient for most applications.)
You then need to tell PyFstat where to find these files,
by either setting an environment variable $LALPULSAR_DATADIR
or by creating a ~/.pyfstat.conf file as described further below.
If you are working with a virtual environment,
you should be able to get a full working ephemerides installation with these commands:
mkdir $VIRTUAL_ENV/share/lalpulsar
wget https://git.ligo.org/lscsoft/lalsuite/raw/master/lalpulsar/lib/earth00-40-DE405.dat.gz -P $VIRTUAL_ENV/share/lalpulsar
wget https://git.ligo.org/lscsoft/lalsuite/raw/master/lalpulsar/lib/sun00-40-DE405.dat.gz -P $VIRTUAL_ENV/share/lalpulsar
echo 'export LALPULSAR_DATADIR=$VIRTUAL_ENV/share/lalpulsar' >> ${VIRTUAL_ENV}/bin/activate
deactivate
source path/to/venv/bin/activate
An executable version of this snippet is readily accessible by sourcing bin/get-and-export-ephemeris.sh.
Mind that this script does not include an export command anywhere, so you will have to source it every time
in order to properly set LALPULSAR_DATADIR variable.
If instead you have built and installed lalsuite from source,
and set your path up properly through something like
source $MYLALPATH/etc/lalsuite-user-env.sh,
then the ephemerides path should be automatically picked up from
the $LALPULSAR_DATADIR environment variable.
Similarly, if you have installed lalsuite from conda-forge,
it should come with ephemerides included and properly set up.
Alternatively, you can place a file
~/.pyfstat.conf into 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 the environment variable.
Finally, you can manually specify ephemerides files when initialising each PyFstat search (as one of the arguments).
Contributing to PyFstat
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.6,3.7,3.8] 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.shgets your virtual environment ready for you. After making sure you are using a virtual environment (venv or conda), it installsblack,flake8,pre-commit,pytest,wheelviapipand usespre-committo run theblackandflake8using a pre-commit hook. In this way, you will be prompted a warning whenever you forget to runblackorflake8before doing your commit :wink:.
Contributors
Maintainers:
- Greg Ashton
- David Keitel
Active contributors:
- Reinhard Prix
- Rodrigo Tenorio
Other contributors:
- Karl Wette
- Sylvia Zhu
- Dan Foreman-Mackey (
pyfstat.gridcorneris based on DFM's corner.py)
Citing this work
If you use PyFstat in a publication we would appreciate if you cite both a DOI for the software itself (see below)
and the original paper introducing the code:
Ashton&Prix 2018
(inspire:1655200
/ ADS:2018PhRvD..97j3020A).
If you use the transient module, please also cite:
Keitel&Ashton 2018
(inspire:1673205
/ ADS:2018CQGra..35t5003K).
If you'd like to cite the PyFstat package in general,
or versions from 1.5.x upwards,
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 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 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file PyFstat-1.10.1.tar.gz.
File metadata
- Download URL: PyFstat-1.10.1.tar.gz
- Upload date:
- Size: 161.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b9b4af61a19c55e7adb40353cf2552e1e22e32e451766541d252d00f113c46c
|
|
| MD5 |
61c495d57a12b85677785acf1f1c412c
|
|
| BLAKE2b-256 |
0c2bfd662d1bf3c8c838e36b5af8ac61159236a4b799c5e358e2cb59014efdd5
|
File details
Details for the file PyFstat-1.10.1-py3-none-any.whl.
File metadata
- Download URL: PyFstat-1.10.1-py3-none-any.whl
- Upload date:
- Size: 107.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2c482367fdae90ffa5f52f0ae18c47a09195ddfc9f755c966830ff4a9a6e8c6
|
|
| MD5 |
7d069b27ba485bd77817a846050b05e7
|
|
| BLAKE2b-256 |
079ffd47a3dab8da4e9dd659ae7b9694c2dccac620fa95c2fcff81ce31bf7e91
|