fastlisaresponse 1.0.9__cp312-cp312-macosx_11_0_arm64.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.
Potentially problematic release.
This version of fastlisaresponse might be problematic. Click here for more details.
- fastlisaresponse/__init__.py +1 -0
- fastlisaresponse/_version.py +1 -0
- fastlisaresponse/cutils/__init__.py +0 -0
- fastlisaresponse/cutils/include/LISAResponse.hh +22 -0
- fastlisaresponse/cutils/include/cuda_complex.hpp +1305 -0
- fastlisaresponse/cutils/pyresponse_cpu.cpython-312-darwin.so +0 -0
- fastlisaresponse/cutils/src/LISAResponse.cpp +919 -0
- fastlisaresponse/cutils/src/LISAResponse.cu +919 -0
- fastlisaresponse/cutils/src/responselisa.pyx +65 -0
- fastlisaresponse/pointer_adjust.py +33 -0
- fastlisaresponse/response.py +784 -0
- fastlisaresponse/utils/__init__.py +1 -0
- fastlisaresponse/utils/utility.py +82 -0
- fastlisaresponse-1.0.9.dist-info/METADATA +127 -0
- fastlisaresponse-1.0.9.dist-info/RECORD +17 -0
- fastlisaresponse-1.0.9.dist-info/WHEEL +5 -0
- fastlisaresponse-1.0.9.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .utility import get_overlap
|
|
@@ -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,127 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: fastlisaresponse
|
|
3
|
+
Version: 1.0.9
|
|
4
|
+
Home-page: https://github.com/mikekatz04/lisa-on-gpu
|
|
5
|
+
Author: Michael Katz
|
|
6
|
+
Author-email: mikekatz04@gmail.com
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
|
|
9
|
+
Classifier: Environment :: GPU :: NVIDIA CUDA
|
|
10
|
+
Classifier: Natural Language :: English
|
|
11
|
+
Classifier: Programming Language :: C++
|
|
12
|
+
Classifier: Programming Language :: Cython
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: >=3.6
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# fastlisaresponse: Generic LISA response function for GPUs
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
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/record/3981654#.XzS_KRNKjlw).
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Getting Started
|
|
27
|
+
|
|
28
|
+
Install with pip (CPU only for now):
|
|
29
|
+
```
|
|
30
|
+
pip install fastlisaresponse
|
|
31
|
+
```
|
|
32
|
+
To import fastlisaresponse:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
from fastlisaresponse import ResponseWrapper
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
See [examples notebook](https://github.com/mikekatz04/lisa-on-gpu/blob/master/examples/fast_LISA_response_tutorial.ipynb).
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Prerequisites
|
|
42
|
+
|
|
43
|
+
Now (version 1.0.9) `fastlisaresponse` requires the newest version of [LISA Analysis Tools](github.com/mikekatz04/LISAanalysistools). You can run `pip install lisaanalysistools`.
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Installing
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
Install with pip (CPU only for now):
|
|
54
|
+
```
|
|
55
|
+
pip install fastlisaresponse
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
To install from source:
|
|
59
|
+
|
|
60
|
+
0) [Install Anaconda](https://docs.anaconda.com/anaconda/install/) if you do not have it.
|
|
61
|
+
|
|
62
|
+
1) Create a virtual environment.
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
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
|
|
66
|
+
conda activate lisa_resp_env
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If on MACOSX, substitute `gcc_linux-64` and `gxx_linus-64` with `clang_osx-64` and `clangxx_osx-64`.
|
|
70
|
+
|
|
71
|
+
If you want a faster install, you can install the python packages (numpy, Cython, scipy, tqdm, jupyter, ipython, h5py, requests, matplotlib) with pip.
|
|
72
|
+
|
|
73
|
+
2) Clone the repository.
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
git clone https://github.com/mikekatz04/lisa-on-gpu.git
|
|
77
|
+
cd lisa-on-gpu
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
3) If using GPUs, use pip to [install cupy](https://docs-cupy.chainer.org/en/stable/install.html).
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
pip install cupy-12x
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
4) Run install. Make sure CUDA is on your PATH.
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
python scripts/prebuild.py
|
|
90
|
+
pip install .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Running the Tests
|
|
94
|
+
|
|
95
|
+
Run the example notebook or the tests using `unittest` from the main directory of the code:
|
|
96
|
+
```
|
|
97
|
+
python -m unittest discover
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Contributing
|
|
101
|
+
|
|
102
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
|
103
|
+
|
|
104
|
+
## Versioning
|
|
105
|
+
|
|
106
|
+
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).
|
|
107
|
+
|
|
108
|
+
Current Version: 1.0.9
|
|
109
|
+
|
|
110
|
+
## Authors
|
|
111
|
+
|
|
112
|
+
* **Michael Katz**
|
|
113
|
+
* Jean-Baptiste Bayle
|
|
114
|
+
* Alvin J. K. Chua
|
|
115
|
+
* Michele Vallisneri
|
|
116
|
+
|
|
117
|
+
### Contibutors
|
|
118
|
+
|
|
119
|
+
* Maybe you!
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
This project is licensed under the GNU License - see the [LICENSE.md](LICENSE.md) file for details.
|
|
124
|
+
|
|
125
|
+
## Acknowledgments
|
|
126
|
+
|
|
127
|
+
* 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/__init__.py,sha256=wwmiIBy9IuFwoc4jQyJVkJBhjB8B1XZjerTe_E8FkI8,53
|
|
2
|
+
fastlisaresponse/_version.py,sha256=q2ACMkQx0Hm5xKo2YKJFBE7rTruciTSIN6AvWWL9nB8,22
|
|
3
|
+
fastlisaresponse/pointer_adjust.py,sha256=TjcSehyffLxwgJnrAmcFlPvxXb3XPElMoHXLBOQN-PI,736
|
|
4
|
+
fastlisaresponse/response.py,sha256=_dHVDuSTbUhxnUW_gmweAJ0M-jLgPZMvZpVQmkx2eiE,28665
|
|
5
|
+
fastlisaresponse/cutils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
fastlisaresponse/cutils/pyresponse_cpu.cpython-312-darwin.so,sha256=lO19JH-noRl8llH7by9hkryurZ9RKsHBLKz0LMM5CCk,126136
|
|
7
|
+
fastlisaresponse/cutils/include/LISAResponse.hh,sha256=mbWEq31Q98PR7XCzhb6SqmygJrXGcQK_fs3sHbmZNe8,1024
|
|
8
|
+
fastlisaresponse/cutils/include/cuda_complex.hpp,sha256=qjBjBf5ctvcKYtMPO2ngqTi6qgq6xsnalFwaZG_NLTw,37562
|
|
9
|
+
fastlisaresponse/cutils/src/LISAResponse.cpp,sha256=AfIdBpwTVtwtpL0Rf2p6WB_XG4YZhII6_z66ldedtuE,29994
|
|
10
|
+
fastlisaresponse/cutils/src/LISAResponse.cu,sha256=AfIdBpwTVtwtpL0Rf2p6WB_XG4YZhII6_z66ldedtuE,29994
|
|
11
|
+
fastlisaresponse/cutils/src/responselisa.pyx,sha256=RexvhiGcb2fK_i1YIQMQxGZLKfJYukn59Hd3wOkZqHw,3075
|
|
12
|
+
fastlisaresponse/utils/__init__.py,sha256=pf2NmWKs_uQNzlyA5iNO1gTRDISKNmIIsvOcKqQ3hgw,33
|
|
13
|
+
fastlisaresponse/utils/utility.py,sha256=NrJdBmEnLkLPk6Ile1TZg8jNLw6xERiSp58iGVlz01s,2709
|
|
14
|
+
fastlisaresponse-1.0.9.dist-info/METADATA,sha256=tuXk6U6D0TM0nR--57ONepNeRKzRX_LdiBYR2gf9M38,4727
|
|
15
|
+
fastlisaresponse-1.0.9.dist-info/WHEEL,sha256=7Wd-yga4fjSiXpUH443rsPZpiZ4h8-uNrXJrYRW_e14,109
|
|
16
|
+
fastlisaresponse-1.0.9.dist-info/top_level.txt,sha256=J4M7Xx_52RqYZrLf99ryAbQjq8GbVjgZdhxekkYw8lg,17
|
|
17
|
+
fastlisaresponse-1.0.9.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fastlisaresponse
|