few: Fast EMRI Waveforms
This package contains the highly modular framework for fast and accurate extreme mass ratio inspiral (EMRI) waveforms from arxiv.org/2104.04582 and arxiv.org/2008.06071. The waveforms in this package combine a variety of separately accessible modules to form EMRI waveforms on both CPUs and GPUs. Generally, the modules fall into four categories: trajectory, amplitudes, summation, and utilities. Please see the documentation for further information on these modules. The code can be found on Github here. The data necessary for various modules in this package will automatically download the first time it is needed. If you would like to view the data, it can be found on Zenodo. The current and all past code release zip files can also be found on Zenodo here. Please see the citation section below for information on citing FEW.
This package is a part of the Black Hole Perturbation Toolkit.
If you use all or any parts of this code, please cite arxiv.org/2104.04582 and arxiv.org/2008.06071. See the documentation to properly cite specific modules.
Getting Started
Install with pip (CPU only for now):
pip install fastemriwaveforms
In a python file or notebook:
import few
See examples notebook.
Prerequisites
To install this software for CPU usage, you need gsl
>2.0 , lapack
(3.6.1), Python >3.4,
wget, and NumPy. If you install lapack with conda, the new version (3.9)
seems to not install the correct header files. Therefore, the lapack
version must be 3.6.1. To run the examples, you will also need jupyter
and matplotlib. We generally recommend installing everything, including
gcc and g++ compilers, in the conda environment as is shown in the
examples here. This generally helps avoid compilation and linking
issues. If you use your own chosen compiler, you will need to make sure
all necessary information is passed to the setup command (see below).
You also may need to add information to the setup.py
file.
To install this software for use with NVIDIA GPUs (compute capability
>2.0), you need the CUDA
toolkit
and CuPy. The CUDA toolkit must have
cuda version >8.0. Be sure to properly install CuPy within the correct
CUDA toolkit version. Make sure the nvcc binary is on $PATH
or set
it as the CUDA_HOME
environment variable.
There are a set of files required for total use of this package. They will download automatically the first time they are needed. Files are generally under 10MB. However, there is a 100MB file needed for the slow waveform and the bicubic amplitude interpolation. This larger file will only download if you run either of those two modules. The files are hosted on Zenodo.
Installing
Install with pip (CPU only for now):
pip install fastemriwaveforms
To install from source:
Install Anaconda if you do not have it.
Clone the repository.
git clone https://github.com/BlackHolePerturbationToolkit/FastEMRIWaveforms.git
cd FastEMRIWaveforms
Installation is made easy through install.sh. This is a bash script that will create a conda environment, install FEW, run tests, and install any additional packages needed for sampling or development. It will look for an
nvcc
binary, theCUDA_HOME
variable, or theCUDAHOME
variable. If it finds that information, it will install for CUDA as well (including installing the proper version ofcupy
). Note: If you already have performed installation and you are updating FEW after agit pull
, then runpip install .
rather than the following command.
bash install.sh
Options for installation can be applied by running
bash install.sh key=value
. These can be found with
bash install.sh -h
:
keyword argument options (given as key=value):
env_name: Name of generated conda environment. Default is 'few_env'.
install_type: Type of install. 'basic', 'development', or 'sampling'.
'development' adds packages needed for development and documentation.
'sampling' adds packages for sampling like eryn, lisatools, corner, chainconsumer.
Default is 'basic'.
run_tests: Either true or false. Whether to run tests after install. Default is true.
Load the environment (change “few_env” to the correct environment name is specified in previous step):
conda activate few_env
Please contact the developers if the installation does not work.
More Customized Installation (legacy)
Install Anaconda if you do not have it.
Create a virtual environment.
conda create -n few_env -c conda-forge gcc_linux-64 gxx_linux-64 wget gsl lapack=3.6.1 hdf5 numpy Cython scipy tqdm jupyter ipython h5py requests matplotlib python=3.7
conda activate few_env
If on MACOSX, substitute `gcc_linux-64` and `gxx_linus-64` with `clang_osx-64` and `clangxx_osx-64`.
If you want a faster install, you can install the python packages (numpy, Cython, scipy, tqdm, jupyter, ipython, h5py, requests, matplotlib) with pip.
Clone the repository.
git clone https://github.com/BlackHolePerturbationToolkit/FastEMRIWaveforms.git
cd FastEMRIWaveforms
If using GPUs, use pip to install cupy. If you have cuda version 9.2, for example:
pip install cupy-cuda92
Run install.
python setup.py install
When installing lapack and gsl, the setup file will default to assuming lib and include for both are in installed within the conda environment. To provide other lib and include directories you can provide command line options when installing. You can also remove usage of OpenMP.
python setup.py --help
usage: setup.py [-h] [--lapack_lib LAPACK_LIB]
[--lapack_include LAPACK_INCLUDE] [--lapack LAPACK]
[--gsl_lib GSL_LIB] [--gsl_include GSL_INCLUDE] [--gsl GSL]
[--ccbin CCBIN]
optional arguments:
-h, --help show this help message and exit
--lapack_lib LAPACK_LIB
Directory of the lapack lib. If you add lapack lib,
must also add lapack include.
--lapack_include LAPACK_INCLUDE
Directory of the lapack include. If you add lapack
includ, must also add lapack lib.
--lapack LAPACK Directory of both lapack lib and include. '/include'
and '/lib' will be added to the end of this string.
--gsl_lib GSL_LIB Directory of the gsl lib. If you add gsl lib, must
also add gsl include.
--gsl_include GSL_INCLUDE
Directory of the gsl include. If you add gsl include,
must also add gsl lib.
--gsl GSL Directory of both gsl lib and include. '/include' and
'/lib' will be added to the end of this string.
--ccbin CCBIN path/to/compiler to link with nvcc when installing
with CUDA.
When installing the package with python setup.py install
, the setup
file uses the C compiler present in your PATH
. However, it might
happen that the setup file incorrectly uses another compiler present on
your path. To solve this issue you can directly specify the C compiler
using the flag --ccbin
as in the following example:
python setup.py install --ccbin /path/to/anaconda3/envs/few_env/bin/x86_64-conda-linux-gnu-gcc
or if on MACOSX:
python setup.py install --ccbin /path/to/anaconda3/envs/few_env/bin/x86_64-apple-darwin13.4.0-clang
Running the Tests
In the main directory of the package run in the terminal (if you run install.sh with defaults, the tests will be performed):
python -m unittest discover
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
If you want to develop FEW and produce documentation, install few
with
bash install.sh install_type=development
This will install necessary packages for building the documentation
(sphinx
, pypandoc
, sphinx_rtd_theme
, nbsphinx
). The
documentation source files are in docs/source
. To compile the
documentation, change to the docs
directory and run make html
.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Current Version: 1.5.5
License
This project is licensed under the GNU License - see the LICENSE.md file for details.
Citation
Please make sure to cite FEW papers and the FEW software on
Zenodo. There are other papers
that require citation based on the classes used. For most classes this
applies to, you can find these by checking the citation
attribute
for that class. Below is a list of citable papers that have lead to the
development of FEW.
@article{Chua:2020stf,
author = "Chua, Alvin J. K. and Katz, Michael L. and Warburton, Niels and Hughes, Scott A.",
title = "{Rapid generation of fully relativistic extreme-mass-ratio-inspiral waveform templates for LISA data analysis}",
eprint = "2008.06071",
archivePrefix = "arXiv",
primaryClass = "gr-qc",
doi = "10.1103/PhysRevLett.126.051102",
journal = "Phys. Rev. Lett.",
volume = "126",
number = "5",
pages = "051102",
year = "2021"
}
@article{Katz:2021yft,
author = "Katz, Michael L. and Chua, Alvin J. K. and Speri, Lorenzo and Warburton, Niels and Hughes, Scott A.",
title = "{FastEMRIWaveforms: New tools for millihertz gravitational-wave data analysis}",
eprint = "2104.04582",
archivePrefix = "arXiv",
primaryClass = "gr-qc",
month = "4",
year = "2021"
}
@software{michael_l_katz_2023_8190418,
author = {Michael L. Katz and
Lorenzo Speri and
Alvin J. K. Chua and
Christian E. A. Chapman-Bird and
Niels Warburton and
Scott A. Hughes},
title = {{BlackHolePerturbationToolkit/FastEMRIWaveforms:
Frequency Domain Waveform Added!}},
month = jul,
year = 2023,
publisher = {Zenodo},
version = {v1.5.1},
doi = {10.5281/zenodo.8190418},
url = {https://doi.org/10.5281/zenodo.8190418}
}
@article{Chua:2018woh,
author = "Chua, Alvin J.K. and Galley, Chad R. and Vallisneri, Michele",
title = "{Reduced-order modeling with artificial neurons for gravitational-wave inference}",
eprint = "1811.05491",
archivePrefix = "arXiv",
primaryClass = "astro-ph.IM",
doi = "10.1103/PhysRevLett.122.211101",
journal = "Phys. Rev. Lett.",
volume = "122",
number = "21",
pages = "211101",
year = "2019"
}
@article{Fujita:2020zxe,
author = "Fujita, Ryuichi and Shibata, Masaru",
title = "{Extreme mass ratio inspirals on the equatorial plane in the adiabatic order}",
eprint = "2008.13554",
archivePrefix = "arXiv",
primaryClass = "gr-qc",
doi = "10.1103/PhysRevD.102.064005",
journal = "Phys. Rev. D",
volume = "102",
number = "6",
pages = "064005",
year = "2020"
}
@article{Stein:2019buj,
author = "Stein, Leo C. and Warburton, Niels",
title = "{Location of the last stable orbit in Kerr spacetime}",
eprint = "1912.07609",
archivePrefix = "arXiv",
primaryClass = "gr-qc",
doi = "10.1103/PhysRevD.101.064007",
journal = "Phys. Rev. D",
volume = "101",
number = "6",
pages = "064007",
year = "2020"
}
@article{Chua:2015mua,
author = "Chua, Alvin J.K. and Gair, Jonathan R.",
title = "{Improved analytic extreme-mass-ratio inspiral model for scoping out eLISA data analysis}",
eprint = "1510.06245",
archivePrefix = "arXiv",
primaryClass = "gr-qc",
doi = "10.1088/0264-9381/32/23/232002",
journal = "Class. Quant. Grav.",
volume = "32",
pages = "232002",
year = "2015"
}
@article{Chua:2017ujo,
author = "Chua, Alvin J.K. and Moore, Christopher J. and Gair, Jonathan R.",
title = "{Augmented kludge waveforms for detecting extreme-mass-ratio inspirals}",
eprint = "1705.04259",
archivePrefix = "arXiv",
primaryClass = "gr-qc",
doi = "10.1103/PhysRevD.96.044005",
journal = "Phys. Rev. D",
volume = "96",
number = "4",
pages = "044005",
year = "2017"
}
@article{Barack:2003fp,
author = "Barack, Leor and Cutler, Curt",
title = "{LISA capture sources: Approximate waveforms, signal-to-noise ratios, and parameter estimation accuracy}",
eprint = "gr-qc/0310125",
archivePrefix = "arXiv",
doi = "10.1103/PhysRevD.69.082005",
journal = "Phys. Rev. D",
volume = "69",
pages = "082005",
year = "2004"
}
@article{Speri:2023jte,
author = "Speri, Lorenzo and Katz, Michael L. and Chua, Alvin J. K. and Hughes, Scott A. and Warburton, Niels and Thompson, Jonathan E. and Chapman-Bird, Christian E. A. and Gair, Jonathan R.",
title = "{Fast and Fourier: Extreme Mass Ratio Inspiral Waveforms in the Frequency Domain}",
eprint = "2307.12585",
archivePrefix = "arXiv",
primaryClass = "gr-qc",
month = "7",
year = "2023"
}
Acknowledgments
This research resulting in this code was supported by National Science Foundation under grant DGE-0948017 and the Chateaubriand Fellowship from the Office for Science & Technology of the Embassy of France in the United States.
It was also supported in part through the computational resources and staff contributions provided for the Quest/Grail high performance computing facility at Northwestern University.
- Overall Waveform Models
- Trajectory Package
TrajectoryBase
- Generic Inspiral Generator from C/C++ functions
EMRIInspiral
EMRIInspiral.num_add_args
EMRIInspiral.background
EMRIInspiral.equatorial
EMRIInspiral.circular
EMRIInspiral.convert_Y
EMRIInspiral.files
EMRIInspiral.citations
EMRIInspiral.enforce_schwarz_sep
EMRIInspiral.inspiral_generator
EMRIInspiral.func
EMRIInspiral.specific_kwarg_keys
EMRIInspiral.attributes_EMRIInspiral()
EMRIInspiral.inspiral_generator
EMRIInspiral.specific_kwarg_keys
EMRIInspiral.citation
EMRIInspiral.__call__()
EMRIInspiral.get_inspiral()
- Amplitude Package
- Summation Package
SummationBase
- Interpolated Summation
CubicSplineInterpolant
CubicSplineInterpolant.attributes_CubicSplineInterpolate()
CubicSplineInterpolant.interpolate_arrays
CubicSplineInterpolant.interp_array
CubicSplineInterpolant.gpu_capability
CubicSplineInterpolant.citation
CubicSplineInterpolant.y
CubicSplineInterpolant.c1
CubicSplineInterpolant.c2
CubicSplineInterpolant.c3
CubicSplineInterpolant.__call__()
CubicSplineInterpolant.adjust_gpu_usage()
CubicSplineInterpolant.attributes_ParallelModuleBase()
CubicSplineInterpolant.use_gpu
CubicSplineInterpolant.xp
CubicSplineInterpolant.sanity_check_gpu()
InterpolatedModeSum
InterpolatedModeSum.__call__()
InterpolatedModeSum.adjust_gpu_usage()
InterpolatedModeSum.attributes_ParallelModuleBase()
InterpolatedModeSum.use_gpu
InterpolatedModeSum.xp
InterpolatedModeSum.attributes_SchwarzschildEccentric()
InterpolatedModeSum.background
InterpolatedModeSum.descriptor
InterpolatedModeSum.ndim
InterpolatedModeSum.m0sort
InterpolatedModeSum.m0mask
InterpolatedModeSum.m_zero_up_mask
InterpolatedModeSum.lmn_indices
InterpolatedModeSum.num_m_zero_up
InterpolatedModeSum.num_m0
InterpolatedModeSum.num_m_1_up
InterpolatedModeSum.inverse_lm
InterpolatedModeSum.index_map
InterpolatedModeSum.special_index_map
InterpolatedModeSum.attributes_SummationBase()
InterpolatedModeSum.waveform
InterpolatedModeSum.sanity_check_gpu()
InterpolatedModeSum.sanity_check_init()
InterpolatedModeSum.sanity_check_traj()
InterpolatedModeSum.sanity_check_viewing_angles()
InterpolatedModeSum.attributes_InterpolatedModeSum()
InterpolatedModeSum.get_waveform
InterpolatedModeSum.gpu_capability
InterpolatedModeSum.citation
InterpolatedModeSum.sum()
FDInterpolatedModeSum
FDInterpolatedModeSum.attributes_FDInterpolatedModeSum()
FDInterpolatedModeSum.get_waveform
FDInterpolatedModeSum.gpu_capability
FDInterpolatedModeSum.__call__()
FDInterpolatedModeSum.adjust_gpu_usage()
FDInterpolatedModeSum.attributes_ParallelModuleBase()
FDInterpolatedModeSum.use_gpu
FDInterpolatedModeSum.xp
FDInterpolatedModeSum.attributes_SchwarzschildEccentric()
FDInterpolatedModeSum.background
FDInterpolatedModeSum.descriptor
FDInterpolatedModeSum.ndim
FDInterpolatedModeSum.m0sort
FDInterpolatedModeSum.m0mask
FDInterpolatedModeSum.m_zero_up_mask
FDInterpolatedModeSum.lmn_indices
FDInterpolatedModeSum.num_m_zero_up
FDInterpolatedModeSum.num_m0
FDInterpolatedModeSum.num_m_1_up
FDInterpolatedModeSum.inverse_lm
FDInterpolatedModeSum.index_map
FDInterpolatedModeSum.special_index_map
FDInterpolatedModeSum.attributes_SummationBase()
FDInterpolatedModeSum.waveform
FDInterpolatedModeSum.citation
FDInterpolatedModeSum.sanity_check_gpu()
FDInterpolatedModeSum.sanity_check_init()
FDInterpolatedModeSum.sanity_check_traj()
FDInterpolatedModeSum.sanity_check_viewing_angles()
FDInterpolatedModeSum.sum()
- Direct Summation
DirectModeSum
DirectModeSum.citation
DirectModeSum.gpu_capability
DirectModeSum.sum()
DirectModeSum.__call__()
DirectModeSum.adjust_gpu_usage()
DirectModeSum.attributes_ParallelModuleBase()
DirectModeSum.use_gpu
DirectModeSum.xp
DirectModeSum.attributes_SchwarzschildEccentric()
DirectModeSum.background
DirectModeSum.descriptor
DirectModeSum.ndim
DirectModeSum.m0sort
DirectModeSum.m0mask
DirectModeSum.m_zero_up_mask
DirectModeSum.lmn_indices
DirectModeSum.num_m_zero_up
DirectModeSum.num_m0
DirectModeSum.num_m_1_up
DirectModeSum.inverse_lm
DirectModeSum.index_map
DirectModeSum.special_index_map
DirectModeSum.attributes_SummationBase()
DirectModeSum.waveform
DirectModeSum.sanity_check_gpu()
DirectModeSum.sanity_check_init()
DirectModeSum.sanity_check_traj()
DirectModeSum.sanity_check_viewing_angles()
- AAK Summation / Waveform Generator
AAKSummation
AAKSummation.gpu_capability
AAKSummation.attributes_AmplitudeAAK()
AAKSummation.waveform_generator
AAKSummation.spline
AAKSummation.__call__()
AAKSummation.adjust_gpu_usage()
AAKSummation.attributes_ParallelModuleBase()
AAKSummation.use_gpu
AAKSummation.xp
AAKSummation.attributes_Pn5AAK()
AAKSummation.xp
AAKSummation.background
AAKSummation.descriptor
AAKSummation.needs_Y
AAKSummation.attributes_SummationBase()
AAKSummation.waveform
AAKSummation.citation
AAKSummation.sanity_check_angles()
AAKSummation.sanity_check_gpu()
AAKSummation.sanity_check_init()
AAKSummation.sanity_check_traj()
AAKSummation.sum()
- Utilities
- Mode Filtering
ModeSelector
ModeSelector.gpu_capability
ModeSelector.attributes_ModeSelector()
ModeSelector.xp
ModeSelector.num_m_zero_up
ModeSelector.num_m_1_up
ModeSelector.num_m0
ModeSelector.sensitivity_fn
ModeSelector.citation
ModeSelector.__call__()
ModeSelector.adjust_gpu_usage()
ModeSelector.attributes_ParallelModuleBase()
ModeSelector.use_gpu
ModeSelector.xp
ModeSelector.sanity_check_gpu()
- (-2) Spin-Weighted Spherical Harmonics
- Frequency Domain Utilities
- Analysis and Other Tools
- Mode Filtering
- Citations
- Fast and Accurate EMRI Waveforms Tutorial
- Full EMRI Waveforms in Schwarzschild Eccentric
- Trajectory Module
- Amplitude Module
- Spin-weighted spherical harmonics
- Mode Selection
- Parallelized Cubic Spline Interpolation
- Mode Summation
- Utility functions
- Creating modules
- Augmented Analytic Kludge with 5PN trajectory
- Citing waveforms and modules
- Single Mode Frequency Domain Waveform Construction
- EMRI Waveforms in frequency domain