fastlisaresponse 1.1.14__cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastlisaresponse/__init__.py +93 -0
- fastlisaresponse/_version.py +34 -0
- fastlisaresponse/cutils/__init__.py +141 -0
- fastlisaresponse/git_version.py +7 -0
- fastlisaresponse/git_version.py.in +7 -0
- fastlisaresponse/response.py +813 -0
- fastlisaresponse/utils/__init__.py +1 -0
- fastlisaresponse/utils/citations.py +356 -0
- fastlisaresponse/utils/config.py +793 -0
- fastlisaresponse/utils/exceptions.py +95 -0
- fastlisaresponse/utils/parallelbase.py +11 -0
- fastlisaresponse/utils/utility.py +82 -0
- fastlisaresponse-1.1.14.dist-info/METADATA +166 -0
- fastlisaresponse-1.1.14.dist-info/RECORD +17 -0
- fastlisaresponse-1.1.14.dist-info/WHEEL +6 -0
- fastlisaresponse_backend_cpu/git_version.py +7 -0
- fastlisaresponse_backend_cpu/responselisa.cpython-311-x86_64-linux-gnu.so +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Definition of FASTLISA package common exceptions"""
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from exceptiongroup import ExceptionGroup
|
|
5
|
+
except (ImportError, ModuleNotFoundError):
|
|
6
|
+
ExceptionGroup = ExceptionGroup
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class FASTLISAException(Exception):
|
|
10
|
+
"""Base class for FASTLISA package exceptions."""
|
|
11
|
+
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class CudaException(FASTLISAException):
|
|
16
|
+
"""Base class for CUDA-related exceptions."""
|
|
17
|
+
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class CuPyException(FASTLISAException):
|
|
22
|
+
"""Base class for CuPy-related exceptions."""
|
|
23
|
+
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class MissingDependency(FASTLISAException):
|
|
28
|
+
"""Exception raised when a required dependency is missing."""
|
|
29
|
+
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class InvalidInputFile(FASTLISAException):
|
|
34
|
+
"""Exception raised when the content of an input file does not match expectations."""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ConfigurationError(FASTLISAException):
|
|
38
|
+
"""Exception raised when configuration setup fails."""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class ConfigurationMissing(ConfigurationError):
|
|
42
|
+
"""Exception raised when an expected configuration entry is missing."""
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ConfigurationValidationError(ConfigurationError):
|
|
46
|
+
"""Exception raised when a configuration entry is invalid."""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class FileManagerException(FASTLISAException):
|
|
50
|
+
"""Exception raised by the FileManager."""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class FileNotInRegistry(FileManagerException):
|
|
54
|
+
"""Exception raised when a requested file is not in file registry."""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class FileNotFoundLocally(FileManagerException):
|
|
58
|
+
"""Exception raised when file not found locally but expected to be."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class FileInvalidChecksum(FileManagerException):
|
|
62
|
+
"""Exception raised when file has invalid checksum."""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class FileDownloadException(FileManagerException):
|
|
66
|
+
"""Exception raised if file download failed."""
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class FileDownloadNotFound(FileDownloadException):
|
|
70
|
+
"""Exception raised if file is not found at expected URL."""
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class FileDownloadConnectionError(FileDownloadException):
|
|
74
|
+
"""Exception raised in case of connection error during download."""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class FileDownloadIntegrityError(FileDownloadException):
|
|
78
|
+
"""Exception raised in case of integrity error after download."""
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class FileManagerDisabledAccess(FileManagerException):
|
|
82
|
+
"""Exception raised when trying to access a file whose tags are disabled"""
|
|
83
|
+
|
|
84
|
+
disabled_tag: str
|
|
85
|
+
file_name: str
|
|
86
|
+
|
|
87
|
+
def __init__(self, /, *args, disabled_tag: str, file_name: str, **kwargs):
|
|
88
|
+
self.disabled_tag = disabled_tag
|
|
89
|
+
self.file_name = file_name
|
|
90
|
+
super().__init__(*args, **kwargs)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### Trajectory-related exceptions
|
|
94
|
+
class TrajectoryOffGridException(Exception):
|
|
95
|
+
"""Exception raised when a trajectory goes off-grid (except for the lower boundary in p)."""
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from typing import Optional, Sequence, TypeVar, Union
|
|
2
|
+
import types
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from gpubackendtools import ParallelModuleBase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FastLISAResponseParallelModule(ParallelModuleBase):
|
|
9
|
+
def __init__(self, force_backend=None):
|
|
10
|
+
force_backend_in = ('fastlisaresponse', force_backend) if isinstance(force_backend, str) else force_backend
|
|
11
|
+
super().__init__(force_backend_in)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
import cupy as cp
|
|
5
|
+
from pyresponse import get_response_wrap as get_response_wrap_gpu
|
|
6
|
+
from pyresponse import get_tdi_delays_wrap as get_tdi_delays_wrap_gpu
|
|
7
|
+
|
|
8
|
+
gpu = True
|
|
9
|
+
|
|
10
|
+
except (ImportError, ModuleNotFoundError) as e:
|
|
11
|
+
import numpy as xp
|
|
12
|
+
|
|
13
|
+
gpu = False
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def get_overlap(sig1, sig2, phase_maximize=False, use_gpu=False):
|
|
17
|
+
"""Calculate the mismatch across TDI channels
|
|
18
|
+
|
|
19
|
+
Calculates the overlap between two sets of TDI observables in the time
|
|
20
|
+
domain. The overlap is complex allowing for the addition of overlap
|
|
21
|
+
over all channels. It can be phase maximized as well.
|
|
22
|
+
|
|
23
|
+
This function has GPU capabilities.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
sig1 (list or xp.ndarray): TDI observables for first signal. Must be ``list`` of
|
|
27
|
+
``xp.ndarray`` or a single ``xp.ndarray``. Must have same length as ``sig2`` in terms
|
|
28
|
+
of number of channels and length of the indivudal channels.
|
|
29
|
+
sig2 (list or xp.ndarray): TDI observables for second signal. Must be ``list`` of
|
|
30
|
+
``xp.ndarray`` or a single ``xp.ndarray``. Must have same length as ``sig1`` in terms
|
|
31
|
+
of number of channels and length of the individual channels.
|
|
32
|
+
phase_maximize (bool, optional): If ``True``, maximize over the phase in the overlap.
|
|
33
|
+
This is equivalent to getting the magnitude of the phasor that is the complex
|
|
34
|
+
overlap. (Defaut: ``False``)
|
|
35
|
+
use_gpu (bool, optional): If ``True``, use the GPU. This sets ``xp=cupy``. If ``False,
|
|
36
|
+
use the CPU and set ``xp=numpy``.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
double: Overlap as a real value.
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
# choose right array library
|
|
44
|
+
if use_gpu:
|
|
45
|
+
xp = cp
|
|
46
|
+
else:
|
|
47
|
+
xp = np
|
|
48
|
+
|
|
49
|
+
# check inputs
|
|
50
|
+
if not isinstance(sig1, list):
|
|
51
|
+
if not isinstance(sig1, xp.ndarray):
|
|
52
|
+
raise ValueError("sig1 must be list of or single xp.ndarray.")
|
|
53
|
+
|
|
54
|
+
elif sig1.ndim < 2:
|
|
55
|
+
sig1 = [sig1]
|
|
56
|
+
|
|
57
|
+
if not isinstance(sig2, list):
|
|
58
|
+
if not isinstance(sig2, xp.ndarray):
|
|
59
|
+
raise ValueError("sig1 must be list of or single xp.ndarray.")
|
|
60
|
+
|
|
61
|
+
elif sig1.ndim < 2:
|
|
62
|
+
sig2 = [sig2]
|
|
63
|
+
|
|
64
|
+
assert len(sig1) == len(sig2)
|
|
65
|
+
assert len(sig1[0]) == len(sig2[0])
|
|
66
|
+
|
|
67
|
+
# complex overlap
|
|
68
|
+
overlap = 0.0 + 1j * 0.0
|
|
69
|
+
for sig1_i, sig2_i in zip(sig1, sig2):
|
|
70
|
+
overlap_i = np.dot(np.fft.rfft(sig1_i).conj(), np.fft.rfft(sig2_i)) / np.sqrt(
|
|
71
|
+
np.dot(np.fft.rfft(sig1_i).conj(), np.fft.rfft(sig1_i))
|
|
72
|
+
* np.dot(np.fft.rfft(sig2_i).conj(), np.fft.rfft(sig2_i))
|
|
73
|
+
)
|
|
74
|
+
overlap += overlap_i
|
|
75
|
+
|
|
76
|
+
overlap /= len(sig1)
|
|
77
|
+
|
|
78
|
+
if phase_maximize:
|
|
79
|
+
return np.abs(overlap)
|
|
80
|
+
|
|
81
|
+
else:
|
|
82
|
+
return overlap.real
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: fastlisaresponse
|
|
3
|
+
Version: 1.1.14
|
|
4
|
+
Summary: GPU-accelerated LISA Response Function
|
|
5
|
+
Author-Email: Michael Katz <mikekatz04@gmail.com>
|
|
6
|
+
Classifier: Environment :: GPU :: NVIDIA CUDA
|
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
8
|
+
Classifier: Natural Language :: English
|
|
9
|
+
Classifier: Programming Language :: C++
|
|
10
|
+
Classifier: Programming Language :: Cython
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Requires-Dist: lisaanalysistools>=1.1.16
|
|
19
|
+
Requires-Dist: exceptiongroup; python_version < "3.11"
|
|
20
|
+
Requires-Dist: h5py<3.15
|
|
21
|
+
Requires-Dist: matplotlib
|
|
22
|
+
Requires-Dist: gpubackendtools
|
|
23
|
+
Requires-Dist: jsonschema
|
|
24
|
+
Requires-Dist: lisaconstants
|
|
25
|
+
Requires-Dist: multispline
|
|
26
|
+
Requires-Dist: numba
|
|
27
|
+
Requires-Dist: numpy
|
|
28
|
+
Requires-Dist: nvidia-ml-py
|
|
29
|
+
Requires-Dist: platformdirs
|
|
30
|
+
Requires-Dist: pydantic
|
|
31
|
+
Requires-Dist: pyyaml
|
|
32
|
+
Requires-Dist: requests
|
|
33
|
+
Requires-Dist: rich
|
|
34
|
+
Requires-Dist: scipy
|
|
35
|
+
Requires-Dist: tqdm
|
|
36
|
+
Requires-Dist: wrapt
|
|
37
|
+
Provides-Extra: doc
|
|
38
|
+
Requires-Dist: ipykernel; extra == "doc"
|
|
39
|
+
Requires-Dist: ipython; extra == "doc"
|
|
40
|
+
Requires-Dist: ipywidgets; extra == "doc"
|
|
41
|
+
Requires-Dist: myst-parser; extra == "doc"
|
|
42
|
+
Requires-Dist: nbsphinx; extra == "doc"
|
|
43
|
+
Requires-Dist: pypandoc; extra == "doc"
|
|
44
|
+
Requires-Dist: sphinx; extra == "doc"
|
|
45
|
+
Requires-Dist: sphinx-rtd-theme; extra == "doc"
|
|
46
|
+
Requires-Dist: sphinx-tippy; extra == "doc"
|
|
47
|
+
Requires-Dist: astropy; extra == "doc"
|
|
48
|
+
Provides-Extra: sampling
|
|
49
|
+
Requires-Dist: eryn; extra == "sampling"
|
|
50
|
+
Requires-Dist: astropy; extra == "sampling"
|
|
51
|
+
Provides-Extra: testing
|
|
52
|
+
Requires-Dist: matplotlib; extra == "testing"
|
|
53
|
+
Requires-Dist: astropy; extra == "testing"
|
|
54
|
+
Description-Content-Type: text/markdown
|
|
55
|
+
|
|
56
|
+
# fastlisaresponse: Generic LISA response function for GPUs
|
|
57
|
+
|
|
58
|
+
This code base provides a GPU-accelerated version of the generic time-domain LISA response function. The GPU-acceleration allows this code to be used directly in Parameter Estimation.
|
|
59
|
+
|
|
60
|
+
Please see the [documentation](https://mikekatz04.github.io/lisa-on-gpu/) for further information on these modules. The code can be found on Github [here](https://github.com/mikekatz04/lisa-on-gpu). It can be found on [Zenodo](https://zenodo.org/records/17162632).
|
|
61
|
+
|
|
62
|
+
If you use all or any parts of this code, please cite [arXiv:2204.06633](https://arxiv.org/abs/2204.06633). See the [documentation](https://mikekatz04.github.io/lisa-on-gpu/) to properly cite specific modules.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Getting Started
|
|
66
|
+
|
|
67
|
+
Install with pip:
|
|
68
|
+
```
|
|
69
|
+
pip install fastlisaresponse
|
|
70
|
+
```
|
|
71
|
+
To import fastlisaresponse:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
from fastlisaresponse import ResponseWrapper
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See [examples notebook](https://github.com/mikekatz04/lisa-on-gpu/blob/master/examples/fast_LISA_response_tutorial.ipynb).
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Prerequisites
|
|
81
|
+
|
|
82
|
+
Now (version 1.0.11) `fastlisaresponse` requires the newest version of [LISA Analysis Tools](github.com/mikekatz04/LISAanalysistools). You can run `pip install lisaanalysistools`.
|
|
83
|
+
|
|
84
|
+
To install this software for CPU usage, you need Python >3.4 and NumPy. 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.
|
|
85
|
+
|
|
86
|
+
To install this software for use with NVIDIA GPUs (compute capability >2.0), you need the [CUDA toolkit](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html) and [CuPy](https://cupy.chainer.org/). 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 `CUDAHOME` environment variable.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Installing
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
Install with pip (CPU only for now):
|
|
93
|
+
```
|
|
94
|
+
pip install fastlisaresponse
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
To install from source:
|
|
98
|
+
|
|
99
|
+
0) [Install Anaconda](https://docs.anaconda.com/anaconda/install/) if you do not have it.
|
|
100
|
+
|
|
101
|
+
1) Create a virtual environment.
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
conda create -n lisa_resp_env -c conda-forge gcc_linux-64 gxx_linux-64 numpy Cython scipy jupyter ipython h5py matplotlib python=3.12
|
|
105
|
+
conda activate lisa_resp_env
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
If on MACOSX, substitute `gcc_linux-64` and `gxx_linus-64` with `clang_osx-64` and `clangxx_osx-64`.
|
|
109
|
+
|
|
110
|
+
If you want a faster install, you can install the python packages (numpy, Cython, scipy, tqdm, jupyter, ipython, h5py, requests, matplotlib) with pip.
|
|
111
|
+
|
|
112
|
+
2) Clone the repository.
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
git clone https://github.com/mikekatz04/lisa-on-gpu.git
|
|
116
|
+
cd lisa-on-gpu
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
3) If using GPUs, use pip to [install cupy](https://docs-cupy.chainer.org/en/stable/install.html).
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
pip install cupy-12x
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
4) Run install. Make sure CUDA is on your PATH.
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
python scripts/prebuild.py
|
|
129
|
+
pip install .
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Running the Tests
|
|
133
|
+
|
|
134
|
+
Run the example notebook or the tests using `unittest` from the main directory of the code:
|
|
135
|
+
```
|
|
136
|
+
python -m unittest discover
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Contributing
|
|
140
|
+
|
|
141
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
|
142
|
+
|
|
143
|
+
## Versioning
|
|
144
|
+
|
|
145
|
+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/mikekatz04/lisa-on-gpu/tags).
|
|
146
|
+
|
|
147
|
+
Current Version: 1.0.11
|
|
148
|
+
|
|
149
|
+
## Authors
|
|
150
|
+
|
|
151
|
+
* **Michael Katz**
|
|
152
|
+
* Jean-Baptiste Bayle
|
|
153
|
+
* Alvin J. K. Chua
|
|
154
|
+
* Michele Vallisneri
|
|
155
|
+
|
|
156
|
+
### Contibutors
|
|
157
|
+
|
|
158
|
+
* Maybe you!
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
This project is licensed under the GNU License - see the [LICENSE.md](LICENSE.md) file for details.
|
|
163
|
+
|
|
164
|
+
## Acknowledgments
|
|
165
|
+
|
|
166
|
+
* 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.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
fastlisaresponse_backend_cpu/git_version.py,sha256=r0r4TJdfJeDGyqULEUpINAuHil8mFWKB-L_SUOSM7K8,140
|
|
2
|
+
fastlisaresponse_backend_cpu/responselisa.cpython-311-x86_64-linux-gnu.so,sha256=3TmTPJ0uzqSEUdMCKp2JMHOOqkAq2Vd9lxhKHtj47AI,249216
|
|
3
|
+
fastlisaresponse-1.1.14.dist-info/WHEEL,sha256=SdD_Ze46rbG8O82pDF4NTDXbsCKrpf8pf8aQc3IgDLU,156
|
|
4
|
+
fastlisaresponse-1.1.14.dist-info/METADATA,sha256=94scizJzJB222emuZqV6n0fAOk6hyn8qUpi5PPUXENU,6058
|
|
5
|
+
fastlisaresponse-1.1.14.dist-info/RECORD,,
|
|
6
|
+
fastlisaresponse/_version.py,sha256=LqGHDuI3LsZEbWsasOE2owH4mT6VrWmmmg7K1xYg7hM,706
|
|
7
|
+
fastlisaresponse/git_version.py,sha256=r0r4TJdfJeDGyqULEUpINAuHil8mFWKB-L_SUOSM7K8,140
|
|
8
|
+
fastlisaresponse/response.py,sha256=jQu6Z3kWui0gPv-_sRBgo3-M-NF0gRBzMG9oJHyz1XI,29512
|
|
9
|
+
fastlisaresponse/git_version.py.in,sha256=Yt2d-2rBlJCK1XzVzjO81molm1_Nb_6NrYsxGuoCxmc,147
|
|
10
|
+
fastlisaresponse/__init__.py,sha256=lqEQW-_q1ltPycsMvNZ70TgM6hJaOMIjvywWjKUesJ8,2478
|
|
11
|
+
fastlisaresponse/cutils/__init__.py,sha256=SvtC-YZqLyS06vk0sPhZ56bd7dFdnzV4nMcPj1HLXuY,5282
|
|
12
|
+
fastlisaresponse/utils/parallelbase.py,sha256=Hqkmggnz9Kkae910fz0_KvGLJ8EPIAQ6J_azdgDjlog,379
|
|
13
|
+
fastlisaresponse/utils/utility.py,sha256=NrJdBmEnLkLPk6Ile1TZg8jNLw6xERiSp58iGVlz01s,2709
|
|
14
|
+
fastlisaresponse/utils/citations.py,sha256=zf79Zb37isbgBmTa9YNZOaYnoOz7tRwHz_MShID_f8E,11150
|
|
15
|
+
fastlisaresponse/utils/exceptions.py,sha256=ypqEROHLYcEdhQeI6k6TLzdtkr7ox0Hv7jx6tG9PK5U,2599
|
|
16
|
+
fastlisaresponse/utils/config.py,sha256=dMdcOXTVNS9__DwynXInM2DGbBpwbB93IZI-EkQtisE,28450
|
|
17
|
+
fastlisaresponse/utils/__init__.py,sha256=pf2NmWKs_uQNzlyA5iNO1gTRDISKNmIIsvOcKqQ3hgw,33
|