lisaanalysistools 1.0.8__tar.gz → 1.0.9__tar.gz

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 lisaanalysistools might be problematic. Click here for more details.

Files changed (67) hide show
  1. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9/LISAanalysistools.egg-info}/PKG-INFO +4 -4
  2. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/LISAanalysistools.egg-info/SOURCES.txt +8 -1
  3. {lisaanalysistools-1.0.8/LISAanalysistools.egg-info → lisaanalysistools-1.0.9}/PKG-INFO +4 -4
  4. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/README.md +3 -3
  5. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/_version.py +1 -1
  6. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/analysiscontainer.py +3 -3
  7. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/include/Detector.hpp +20 -14
  8. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/src/Detector.cpp +108 -11
  9. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/src/Detector.cu +108 -11
  10. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/src/pycppdetector.pyx +62 -6
  11. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/src/pycppdetector_cpu.cpp +6239 -4091
  12. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/src/pycppdetector_cpu.pyx +62 -6
  13. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/datacontainer.py +1 -1
  14. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/detector.py +212 -47
  15. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/diagnostic.py +3 -1
  16. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/sensitivity.py +59 -54
  17. lisaanalysistools-1.0.9/lisatools/sources/__init__.py +6 -0
  18. lisaanalysistools-1.0.9/lisatools/sources/bbh/__init__.py +1 -0
  19. lisaanalysistools-1.0.9/lisatools/sources/bbh/waveform.py +91 -0
  20. lisaanalysistools-1.0.9/lisatools/sources/defaultresponse.py +36 -0
  21. lisaanalysistools-1.0.9/lisatools/sources/emri/__init__.py +1 -0
  22. lisaanalysistools-1.0.8/lisatools/sources/emri/tdiwaveform.py → lisaanalysistools-1.0.9/lisatools/sources/emri/waveform.py +11 -5
  23. lisaanalysistools-1.0.9/lisatools/sources/gb/__init__.py +1 -0
  24. lisaanalysistools-1.0.9/lisatools/sources/gb/waveform.py +67 -0
  25. lisaanalysistools-1.0.9/lisatools/sources/utils.py +440 -0
  26. lisaanalysistools-1.0.9/lisatools/sources/waveformbase.py +41 -0
  27. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/pyproject.toml +1 -1
  28. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/setup.py +2 -0
  29. lisaanalysistools-1.0.8/lisatools/sources/emri/__init__.py +0 -1
  30. lisaanalysistools-1.0.8/lisatools/utils/__init__.py +0 -0
  31. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/CHANGELOG +0 -0
  32. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/LICENSE +0 -0
  33. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/LISAanalysistools.egg-info/dependency_links.txt +0 -0
  34. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/LISAanalysistools.egg-info/not-zip-safe +0 -0
  35. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/LISAanalysistools.egg-info/top_level.txt +0 -0
  36. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/MANIFEST.in +0 -0
  37. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/Makefile +0 -0
  38. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/__init__.py +0 -0
  39. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/__init__.py +0 -0
  40. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/include/__init__.py +0 -0
  41. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/include/global.hpp +0 -0
  42. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/src/__init__.py +0 -0
  43. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/cutils/src/pycppdetector.cpp +0 -0
  44. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/sampling/__init__.py +0 -0
  45. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/sampling/likelihood.py +0 -0
  46. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/sampling/moves/__init__.py +0 -0
  47. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/sampling/moves/skymodehop.py +0 -0
  48. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/sampling/prior.py +0 -0
  49. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/sampling/stopping.py +0 -0
  50. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/sampling/utility.py +0 -0
  51. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/stochastic.py +0 -0
  52. {lisaanalysistools-1.0.8/lisatools/sources → lisaanalysistools-1.0.9/lisatools/utils}/__init__.py +0 -0
  53. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/utils/constants.py +0 -0
  54. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/utils/pointeradjust.py +0 -0
  55. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/lisatools/utils/utility.py +0 -0
  56. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/requirements-sources.txt +0 -0
  57. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/requirements.txt +0 -0
  58. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/scripts/data_download.py +0 -0
  59. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/scripts/generate-changelog.bash +0 -0
  60. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/scripts/install-hooks.bash +0 -0
  61. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/scripts/post-commit.bash +0 -0
  62. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/scripts/prebuild.py +0 -0
  63. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/scripts/run-tests.bash +0 -0
  64. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/scripts/space_2050_install.sh +0 -0
  65. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/scripts/to_conda.bash +0 -0
  66. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/setup.cfg +0 -0
  67. {lisaanalysistools-1.0.8 → lisaanalysistools-1.0.9}/src/pycppdetector.cpp +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lisaanalysistools
3
- Version: 1.0.8
3
+ Version: 1.0.9
4
4
  Home-page: https://github.com/mikekatz04/LISAanalysistools
5
5
  Author: Michael Katz
6
6
  Author-email: mikekatz04@gmail.com
@@ -40,7 +40,7 @@ LISA Analysis Tools leverages conda environments to install and use necessary pa
40
40
 
41
41
  For an easy full install, follow these instructions.
42
42
 
43
- First, clone the repo and `cd` to the `LATW` directory.:
43
+ First, clone the repo and `cd` to the `LISAanalysistools` directory.:
44
44
  ```
45
45
  git clone https://github.com/mikekatz04/LISAanalysistools.git
46
46
  cd LISAanalysistools/
@@ -56,7 +56,7 @@ If you want more flexibility, you can install each package given above separatel
56
56
 
57
57
  To install this software for use with NVIDIA GPUs (compute capability >5.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 `CUDA_HOME` environment variable.
58
58
 
59
- We are currently working on building wheels and making the GPU version pip installable. For now, to work with GPUs, git clone the repository and install it from source.
59
+ We are currently working on building wheels and making the GPU version pip installable. For now, to work with GPUs, git clone the repository and install it from source. You must run `python scripts/prebuild.py` before running the install process.
60
60
 
61
61
  ## Contributing
62
62
 
@@ -66,7 +66,7 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
66
66
 
67
67
  We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/mikekatz04/LISAanalysistools/tags).
68
68
 
69
- Current Version: 1.0.8
69
+ Current Version: 1.0.9
70
70
 
71
71
  ## Authors/Developers
72
72
 
@@ -43,8 +43,15 @@ lisatools/sampling/utility.py
43
43
  lisatools/sampling/moves/__init__.py
44
44
  lisatools/sampling/moves/skymodehop.py
45
45
  lisatools/sources/__init__.py
46
+ lisatools/sources/defaultresponse.py
47
+ lisatools/sources/utils.py
48
+ lisatools/sources/waveformbase.py
49
+ lisatools/sources/bbh/__init__.py
50
+ lisatools/sources/bbh/waveform.py
46
51
  lisatools/sources/emri/__init__.py
47
- lisatools/sources/emri/tdiwaveform.py
52
+ lisatools/sources/emri/waveform.py
53
+ lisatools/sources/gb/__init__.py
54
+ lisatools/sources/gb/waveform.py
48
55
  lisatools/utils/__init__.py
49
56
  lisatools/utils/constants.py
50
57
  lisatools/utils/pointeradjust.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lisaanalysistools
3
- Version: 1.0.8
3
+ Version: 1.0.9
4
4
  Home-page: https://github.com/mikekatz04/LISAanalysistools
5
5
  Author: Michael Katz
6
6
  Author-email: mikekatz04@gmail.com
@@ -40,7 +40,7 @@ LISA Analysis Tools leverages conda environments to install and use necessary pa
40
40
 
41
41
  For an easy full install, follow these instructions.
42
42
 
43
- First, clone the repo and `cd` to the `LATW` directory.:
43
+ First, clone the repo and `cd` to the `LISAanalysistools` directory.:
44
44
  ```
45
45
  git clone https://github.com/mikekatz04/LISAanalysistools.git
46
46
  cd LISAanalysistools/
@@ -56,7 +56,7 @@ If you want more flexibility, you can install each package given above separatel
56
56
 
57
57
  To install this software for use with NVIDIA GPUs (compute capability >5.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 `CUDA_HOME` environment variable.
58
58
 
59
- We are currently working on building wheels and making the GPU version pip installable. For now, to work with GPUs, git clone the repository and install it from source.
59
+ We are currently working on building wheels and making the GPU version pip installable. For now, to work with GPUs, git clone the repository and install it from source. You must run `python scripts/prebuild.py` before running the install process.
60
60
 
61
61
  ## Contributing
62
62
 
@@ -66,7 +66,7 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
66
66
 
67
67
  We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/mikekatz04/LISAanalysistools/tags).
68
68
 
69
- Current Version: 1.0.8
69
+ Current Version: 1.0.9
70
70
 
71
71
  ## Authors/Developers
72
72
 
@@ -23,7 +23,7 @@ LISA Analysis Tools leverages conda environments to install and use necessary pa
23
23
 
24
24
  For an easy full install, follow these instructions.
25
25
 
26
- First, clone the repo and `cd` to the `LATW` directory.:
26
+ First, clone the repo and `cd` to the `LISAanalysistools` directory.:
27
27
  ```
28
28
  git clone https://github.com/mikekatz04/LISAanalysistools.git
29
29
  cd LISAanalysistools/
@@ -39,7 +39,7 @@ If you want more flexibility, you can install each package given above separatel
39
39
 
40
40
  To install this software for use with NVIDIA GPUs (compute capability >5.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 `CUDA_HOME` environment variable.
41
41
 
42
- We are currently working on building wheels and making the GPU version pip installable. For now, to work with GPUs, git clone the repository and install it from source.
42
+ We are currently working on building wheels and making the GPU version pip installable. For now, to work with GPUs, git clone the repository and install it from source. You must run `python scripts/prebuild.py` before running the install process.
43
43
 
44
44
  ## Contributing
45
45
 
@@ -49,7 +49,7 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
49
49
 
50
50
  We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/mikekatz04/LISAanalysistools/tags).
51
51
 
52
- Current Version: 1.0.8
52
+ Current Version: 1.0.9
53
53
 
54
54
  ## Authors/Developers
55
55
 
@@ -1,4 +1,4 @@
1
- __version__ = '1.0.8'
1
+ __version__ = '1.0.9'
2
2
  __copyright__ = "Michael L. Katz 2024"
3
3
  __name__ = "lisaanalysistools"
4
4
  __author__ = "Michael L. Katz"
@@ -112,17 +112,17 @@ class AnalysisContainer:
112
112
  # char strain
113
113
  ax[i * self.sens_mat.shape[1] + j].loglog(
114
114
  self.data_res_arr.f_arr,
115
- self.data_res_arr.f_arr * self.data_res_arr[i],
115
+ self.data_res_arr.f_arr * np.abs(self.data_res_arr[i]),
116
116
  )
117
117
  ax[i * self.sens_mat.shape[1] + j].loglog(
118
118
  self.data_res_arr.f_arr,
119
- self.data_res_arr.f_arr * self.data_res_arr[j],
119
+ self.data_res_arr.f_arr * np.abs(self.data_res_arr[j]),
120
120
  )
121
121
  else:
122
122
  for i in range(self.sens_mat.shape[0]):
123
123
  ax[i].loglog(
124
124
  self.data_res_arr.f_arr,
125
- self.data_res_arr.f_arr * self.data_res_arr[i],
125
+ self.data_res_arr.f_arr * np.abs(self.data_res_arr[i]),
126
126
  )
127
127
  return (fig, ax)
128
128
 
@@ -30,11 +30,12 @@ public:
30
30
  double *x_arr;
31
31
  int nlinks;
32
32
  int nspacecraft;
33
+ double armlength;
33
34
  int *links;
34
35
  int *sc_r;
35
36
  int *sc_e;
36
37
 
37
- Orbits(double dt_, int N_, double *n_arr_, double *ltt_arr_, double *x_arr_, int *links_, int *sc_r_, int *sc_e_)
38
+ Orbits(double dt_, int N_, double *n_arr_, double *ltt_arr_, double *x_arr_, int *links_, int *sc_r_, int *sc_e_, double armlength_)
38
39
  {
39
40
  dt = dt_;
40
41
  N = N_;
@@ -47,15 +48,22 @@ public:
47
48
  sc_r = sc_r_;
48
49
  sc_e = sc_e_;
49
50
  links = links_;
51
+ armlength = armlength_;
52
+ };
50
53
 
51
- // std::cout << " START " << std::endl;
52
- // for (int i = 0; i < nlinks; i += 1)
53
- // {
54
- // sc_r[i] = sc_r_[i];
55
- // sc_e[i] = sc_e_[i];
56
- // links[i] = links_[i];
57
- // // std::cout << i << " HAHAHAH " << sc_r_[i] << " " << sc_e_[i] << std::endl;
58
- // }
54
+ int get_sc_r_from_arr(int i)
55
+ {
56
+ return sc_r[i];
57
+ };
58
+
59
+ int get_sc_e_from_arr(int i)
60
+ {
61
+ return sc_e[i];
62
+ };
63
+
64
+ int get_link_from_arr(int i)
65
+ {
66
+ return links[i];
59
67
  };
60
68
 
61
69
  CUDA_DEVICE int get_window(double t);
@@ -68,11 +76,9 @@ public:
68
76
  CUDA_DEVICE void get_normal_unit_vec_ptr(Vec *vec, double t, int link);
69
77
  CUDA_DEVICE void get_pos_ptr(Vec *vec, double t, int sc);
70
78
  void get_light_travel_time_arr(double *ltt, double *t, int *link, int num);
71
- void dealloc(){
72
- // delete[] links;
73
- // delete[] sc_r;
74
- // delete[] sc_e;
75
- };
79
+ void get_pos_arr(double *pos_x, double *pos_y, double *pos_z, double *t, int *sc, int num);
80
+ void get_normal_unit_vec_arr(double *normal_unit_vec_x, double *normal_unit_vec_y, double *normal_unit_vec_z, double *t, int *link, int num);
81
+ void dealloc() {};
76
82
  };
77
83
 
78
84
  #endif // __DETECTOR_HPP__
@@ -55,8 +55,7 @@ int Orbits::get_sc_ind(int sc)
55
55
  printf("BAD sc ind. Must be 1,2,3. %d\n", sc);
56
56
  #else
57
57
  std::ostringstream oss;
58
- int xxxx = 1;
59
- oss << "Bad sc ind. Must be 1,2,3. Input sc is " << sc << " " << xxxx;
58
+ oss << "Bad sc ind. Must be 1,2,3. Input sc is " << sc << " " << std::endl;
60
59
  std::string var = oss.str();
61
60
  throw std::invalid_argument(var);
62
61
  #endif // __CUDACC__
@@ -166,19 +165,20 @@ void Orbits::get_pos_ptr(Vec *vec, double t, int sc)
166
165
 
167
166
  #define NUM_THREADS 64
168
167
 
168
+
169
169
  CUDA_KERNEL
170
- void get_light_travel_time_kernel(double *ltt, double *t, int *link, int num, Orbits& orbits)
170
+ void get_light_travel_time_kernel(double *ltt, double *t, int *link, int num, Orbits &orbits)
171
171
  {
172
172
  int start, end, increment;
173
- #ifdef __CUDACC__
173
+ #ifdef __CUDACC__
174
174
  start = blockIdx.x * blockDim.x + threadIdx.x;
175
175
  end = num;
176
176
  increment = gridDim.x * blockDim.x;
177
- #else // __CUDACC__
177
+ #else // __CUDACC__
178
178
  start = 0;
179
179
  end = num;
180
180
  increment = 1;
181
- #endif // __CUDACC__
181
+ #endif // __CUDACC__
182
182
 
183
183
  for (int i = start; i < end; i += increment)
184
184
  {
@@ -188,7 +188,7 @@ void get_light_travel_time_kernel(double *ltt, double *t, int *link, int num, Or
188
188
 
189
189
  void Orbits::get_light_travel_time_arr(double *ltt, double *t, int *link, int num)
190
190
  {
191
- #ifdef __CUDACC__
191
+ #ifdef __CUDACC__
192
192
  int num_blocks = std::ceil((num + NUM_THREADS - 1) / NUM_THREADS);
193
193
 
194
194
  // copy self to GPU
@@ -199,12 +199,109 @@ void Orbits::get_light_travel_time_arr(double *ltt, double *t, int *link, int nu
199
199
  get_light_travel_time_kernel<<<num_blocks, NUM_THREADS>>>(ltt, t, link, num, *orbits_gpu);
200
200
  cudaDeviceSynchronize();
201
201
  gpuErrchk(cudaGetLastError());
202
-
202
+
203
203
  gpuErrchk(cudaFree(orbits_gpu));
204
204
 
205
- #else // __CUDACC__
205
+ #else // __CUDACC__
206
206
 
207
207
  get_light_travel_time_kernel(ltt, t, link, num, *this);
208
208
 
209
- #endif // __CUDACC__
210
- }
209
+ #endif // __CUDACC__
210
+ }
211
+
212
+
213
+ CUDA_KERNEL
214
+ void get_pos_kernel(double *pos_x, double *pos_y, double *pos_z, double *t, int *sc, int num, Orbits &orbits)
215
+ {
216
+ int start, end, increment;
217
+ #ifdef __CUDACC__
218
+ start = blockIdx.x * blockDim.x + threadIdx.x;
219
+ end = num;
220
+ increment = gridDim.x * blockDim.x;
221
+ #else // __CUDACC__
222
+ start = 0;
223
+ end = num;
224
+ increment = 1;
225
+ #endif // __CUDACC__
226
+ Vec _tmp(0.0, 0.0, 0.0);
227
+
228
+ for (int i = start; i < end; i += increment)
229
+ {
230
+ _tmp = orbits.get_pos(t[i], sc[i]);
231
+ pos_x[i] = _tmp.x;
232
+ pos_y[i] = _tmp.y;
233
+ pos_z[i] = _tmp.z;
234
+ }
235
+ }
236
+
237
+ void Orbits::get_pos_arr(double *pos_x, double *pos_y, double *pos_z, double *t, int *sc, int num)
238
+ {
239
+ #ifdef __CUDACC__
240
+ int num_blocks = std::ceil((num + NUM_THREADS - 1) / NUM_THREADS);
241
+
242
+ // copy self to GPU
243
+ Orbits *orbits_gpu;
244
+ gpuErrchk(cudaMalloc(&orbits_gpu, sizeof(Orbits)));
245
+ gpuErrchk(cudaMemcpy(orbits_gpu, this, sizeof(Orbits), cudaMemcpyHostToDevice));
246
+
247
+ get_pos_kernel<<<num_blocks, NUM_THREADS>>>(pos_x, pos_y, pos_z, t, sc, num, *orbits_gpu);
248
+ cudaDeviceSynchronize();
249
+ gpuErrchk(cudaGetLastError());
250
+
251
+ gpuErrchk(cudaFree(orbits_gpu));
252
+
253
+ #else // __CUDACC__
254
+
255
+ get_pos_kernel(pos_x, pos_y, pos_z, t, sc, num, *this);
256
+
257
+ #endif // __CUDACC__
258
+ }
259
+
260
+
261
+ CUDA_KERNEL
262
+ void get_normal_unit_vec_kernel(double *normal_unit_vec_x, double *normal_unit_vec_y, double *normal_unit_vec_z, double *t, int *link, int num, Orbits &orbits)
263
+ {
264
+ int start, end, increment;
265
+ #ifdef __CUDACC__
266
+ start = blockIdx.x * blockDim.x + threadIdx.x;
267
+ end = num;
268
+ increment = gridDim.x * blockDim.x;
269
+ #else // __CUDACC__
270
+ start = 0;
271
+ end = num;
272
+ increment = 1;
273
+ #endif // __CUDACC__
274
+ Vec _tmp(0.0, 0.0, 0.0);
275
+
276
+ for (int i = start; i < end; i += increment)
277
+ {
278
+ _tmp = orbits.get_normal_unit_vec(t[i], link[i]);
279
+ normal_unit_vec_x[i] = _tmp.x;
280
+ normal_unit_vec_y[i] = _tmp.y;
281
+ normal_unit_vec_z[i] = _tmp.z;
282
+ }
283
+ }
284
+
285
+ void Orbits::get_normal_unit_vec_arr(double *normal_unit_vec_x, double *normal_unit_vec_y, double *normal_unit_vec_z, double *t, int *link, int num)
286
+ {
287
+ #ifdef __CUDACC__
288
+ int num_blocks = std::ceil((num + NUM_THREADS - 1) / NUM_THREADS);
289
+
290
+ // copy self to GPU
291
+ Orbits *orbits_gpu;
292
+ gpuErrchk(cudaMalloc(&orbits_gpu, sizeof(Orbits)));
293
+ gpuErrchk(cudaMemcpy(orbits_gpu, this, sizeof(Orbits), cudaMemcpyHostToDevice));
294
+
295
+ get_normal_unit_vec_kernel<<<num_blocks, NUM_THREADS>>>(normal_unit_vec_x, normal_unit_vec_y, normal_unit_vec_z, t, link, num, *orbits_gpu);
296
+ cudaDeviceSynchronize();
297
+ gpuErrchk(cudaGetLastError());
298
+
299
+ gpuErrchk(cudaFree(orbits_gpu));
300
+
301
+ #else // __CUDACC__
302
+
303
+ get_normal_unit_vec_kernel(normal_unit_vec_x, normal_unit_vec_y, normal_unit_vec_z, t, link, num, *this);
304
+
305
+ #endif // __CUDACC__
306
+ }
307
+
@@ -55,8 +55,7 @@ int Orbits::get_sc_ind(int sc)
55
55
  printf("BAD sc ind. Must be 1,2,3. %d\n", sc);
56
56
  #else
57
57
  std::ostringstream oss;
58
- int xxxx = 1;
59
- oss << "Bad sc ind. Must be 1,2,3. Input sc is " << sc << " " << xxxx;
58
+ oss << "Bad sc ind. Must be 1,2,3. Input sc is " << sc << " " << std::endl;
60
59
  std::string var = oss.str();
61
60
  throw std::invalid_argument(var);
62
61
  #endif // __CUDACC__
@@ -166,19 +165,20 @@ void Orbits::get_pos_ptr(Vec *vec, double t, int sc)
166
165
 
167
166
  #define NUM_THREADS 64
168
167
 
168
+
169
169
  CUDA_KERNEL
170
- void get_light_travel_time_kernel(double *ltt, double *t, int *link, int num, Orbits& orbits)
170
+ void get_light_travel_time_kernel(double *ltt, double *t, int *link, int num, Orbits &orbits)
171
171
  {
172
172
  int start, end, increment;
173
- #ifdef __CUDACC__
173
+ #ifdef __CUDACC__
174
174
  start = blockIdx.x * blockDim.x + threadIdx.x;
175
175
  end = num;
176
176
  increment = gridDim.x * blockDim.x;
177
- #else // __CUDACC__
177
+ #else // __CUDACC__
178
178
  start = 0;
179
179
  end = num;
180
180
  increment = 1;
181
- #endif // __CUDACC__
181
+ #endif // __CUDACC__
182
182
 
183
183
  for (int i = start; i < end; i += increment)
184
184
  {
@@ -188,7 +188,7 @@ void get_light_travel_time_kernel(double *ltt, double *t, int *link, int num, Or
188
188
 
189
189
  void Orbits::get_light_travel_time_arr(double *ltt, double *t, int *link, int num)
190
190
  {
191
- #ifdef __CUDACC__
191
+ #ifdef __CUDACC__
192
192
  int num_blocks = std::ceil((num + NUM_THREADS - 1) / NUM_THREADS);
193
193
 
194
194
  // copy self to GPU
@@ -199,12 +199,109 @@ void Orbits::get_light_travel_time_arr(double *ltt, double *t, int *link, int nu
199
199
  get_light_travel_time_kernel<<<num_blocks, NUM_THREADS>>>(ltt, t, link, num, *orbits_gpu);
200
200
  cudaDeviceSynchronize();
201
201
  gpuErrchk(cudaGetLastError());
202
-
202
+
203
203
  gpuErrchk(cudaFree(orbits_gpu));
204
204
 
205
- #else // __CUDACC__
205
+ #else // __CUDACC__
206
206
 
207
207
  get_light_travel_time_kernel(ltt, t, link, num, *this);
208
208
 
209
- #endif // __CUDACC__
210
- }
209
+ #endif // __CUDACC__
210
+ }
211
+
212
+
213
+ CUDA_KERNEL
214
+ void get_pos_kernel(double *pos_x, double *pos_y, double *pos_z, double *t, int *sc, int num, Orbits &orbits)
215
+ {
216
+ int start, end, increment;
217
+ #ifdef __CUDACC__
218
+ start = blockIdx.x * blockDim.x + threadIdx.x;
219
+ end = num;
220
+ increment = gridDim.x * blockDim.x;
221
+ #else // __CUDACC__
222
+ start = 0;
223
+ end = num;
224
+ increment = 1;
225
+ #endif // __CUDACC__
226
+ Vec _tmp(0.0, 0.0, 0.0);
227
+
228
+ for (int i = start; i < end; i += increment)
229
+ {
230
+ _tmp = orbits.get_pos(t[i], sc[i]);
231
+ pos_x[i] = _tmp.x;
232
+ pos_y[i] = _tmp.y;
233
+ pos_z[i] = _tmp.z;
234
+ }
235
+ }
236
+
237
+ void Orbits::get_pos_arr(double *pos_x, double *pos_y, double *pos_z, double *t, int *sc, int num)
238
+ {
239
+ #ifdef __CUDACC__
240
+ int num_blocks = std::ceil((num + NUM_THREADS - 1) / NUM_THREADS);
241
+
242
+ // copy self to GPU
243
+ Orbits *orbits_gpu;
244
+ gpuErrchk(cudaMalloc(&orbits_gpu, sizeof(Orbits)));
245
+ gpuErrchk(cudaMemcpy(orbits_gpu, this, sizeof(Orbits), cudaMemcpyHostToDevice));
246
+
247
+ get_pos_kernel<<<num_blocks, NUM_THREADS>>>(pos_x, pos_y, pos_z, t, sc, num, *orbits_gpu);
248
+ cudaDeviceSynchronize();
249
+ gpuErrchk(cudaGetLastError());
250
+
251
+ gpuErrchk(cudaFree(orbits_gpu));
252
+
253
+ #else // __CUDACC__
254
+
255
+ get_pos_kernel(pos_x, pos_y, pos_z, t, sc, num, *this);
256
+
257
+ #endif // __CUDACC__
258
+ }
259
+
260
+
261
+ CUDA_KERNEL
262
+ void get_normal_unit_vec_kernel(double *normal_unit_vec_x, double *normal_unit_vec_y, double *normal_unit_vec_z, double *t, int *link, int num, Orbits &orbits)
263
+ {
264
+ int start, end, increment;
265
+ #ifdef __CUDACC__
266
+ start = blockIdx.x * blockDim.x + threadIdx.x;
267
+ end = num;
268
+ increment = gridDim.x * blockDim.x;
269
+ #else // __CUDACC__
270
+ start = 0;
271
+ end = num;
272
+ increment = 1;
273
+ #endif // __CUDACC__
274
+ Vec _tmp(0.0, 0.0, 0.0);
275
+
276
+ for (int i = start; i < end; i += increment)
277
+ {
278
+ _tmp = orbits.get_normal_unit_vec(t[i], link[i]);
279
+ normal_unit_vec_x[i] = _tmp.x;
280
+ normal_unit_vec_y[i] = _tmp.y;
281
+ normal_unit_vec_z[i] = _tmp.z;
282
+ }
283
+ }
284
+
285
+ void Orbits::get_normal_unit_vec_arr(double *normal_unit_vec_x, double *normal_unit_vec_y, double *normal_unit_vec_z, double *t, int *link, int num)
286
+ {
287
+ #ifdef __CUDACC__
288
+ int num_blocks = std::ceil((num + NUM_THREADS - 1) / NUM_THREADS);
289
+
290
+ // copy self to GPU
291
+ Orbits *orbits_gpu;
292
+ gpuErrchk(cudaMalloc(&orbits_gpu, sizeof(Orbits)));
293
+ gpuErrchk(cudaMemcpy(orbits_gpu, this, sizeof(Orbits), cudaMemcpyHostToDevice));
294
+
295
+ get_normal_unit_vec_kernel<<<num_blocks, NUM_THREADS>>>(normal_unit_vec_x, normal_unit_vec_y, normal_unit_vec_z, t, link, num, *orbits_gpu);
296
+ cudaDeviceSynchronize();
297
+ gpuErrchk(cudaGetLastError());
298
+
299
+ gpuErrchk(cudaFree(orbits_gpu));
300
+
301
+ #else // __CUDACC__
302
+
303
+ get_normal_unit_vec_kernel(normal_unit_vec_x, normal_unit_vec_y, normal_unit_vec_z, t, link, num, *this);
304
+
305
+ #endif // __CUDACC__
306
+ }
307
+
@@ -14,7 +14,7 @@ cdef extern from "../include/Detector.hpp":
14
14
  VecWrap(double x_, double y_, double z_) except+
15
15
 
16
16
  cdef cppclass OrbitsWrap "Orbits":
17
- OrbitsWrap(double dt_, int N_, double *n_arr_, double *L_arr_, double *x_arr_, int *links_, int *sc_r_, int *sc_e_) except+
17
+ OrbitsWrap(double dt_, int N_, double *n_arr_, double *L_arr_, double *x_arr_, int *links_, int *sc_r_, int *sc_e_, double armlength_) except+
18
18
  int get_window(double t) except+
19
19
  void get_normal_unit_vec_ptr(VecWrap *vec, double t, int link)
20
20
  int get_link_ind(int link) except+
@@ -23,6 +23,11 @@ cdef extern from "../include/Detector.hpp":
23
23
  VecWrap get_pos_ptr(VecWrap* out, double t, int sc) except+
24
24
  void get_light_travel_time_arr(double *ltt, double *t, int *link, int num) except+
25
25
  void dealloc();
26
+ void get_pos_arr(double *pos_x, double *pos_y, double *pos_z, double *t, int *sc, int num) except+
27
+ void get_normal_unit_vec_arr(double *normal_unit_vec_x, double *normal_unit_vec_y, double *normal_unit_vec_z, double *t, int *link, int num) except+
28
+ int get_sc_r_from_arr(int i) except+
29
+ int get_sc_e_from_arr(int i) except+
30
+ int get_link_from_arr(int i) except+
26
31
 
27
32
 
28
33
  cdef class pycppDetector:
@@ -35,6 +40,7 @@ cdef class pycppDetector:
35
40
  cdef size_t links
36
41
  cdef size_t sc_r
37
42
  cdef size_t sc_e
43
+ cdef double armlength
38
44
 
39
45
  def __cinit__(self,
40
46
  *args,
@@ -48,7 +54,8 @@ cdef class pycppDetector:
48
54
  x_arr,
49
55
  links,
50
56
  sc_r,
51
- sc_e
57
+ sc_e,
58
+ armlength
52
59
  ), tkwargs = wrapper(*args, **kwargs)
53
60
 
54
61
  self.dt = dt
@@ -59,6 +66,7 @@ cdef class pycppDetector:
59
66
  self.links = links
60
67
  self.sc_r = sc_r
61
68
  self.sc_e = sc_e
69
+ self.armlength = armlength
62
70
 
63
71
  cdef size_t n_arr_in = n_arr
64
72
  cdef size_t L_arr_in = L_arr
@@ -75,7 +83,8 @@ cdef class pycppDetector:
75
83
  <double*> x_arr_in,
76
84
  <int*> links_in,
77
85
  <int*> sc_r_in,
78
- <int*> sc_e_in
86
+ <int*> sc_e_in,
87
+ armlength
79
88
  )
80
89
 
81
90
  def __dealloc__(self):
@@ -84,7 +93,7 @@ cdef class pycppDetector:
84
93
  del self.g
85
94
 
86
95
  def __reduce__(self):
87
- return (rebuild, (self.dt, self.N, self.n_arr, self.L_arr, self.x_arr, self.links, self.sc_r, self.sc_e,))
96
+ return (rebuild, (self.dt, self.N, self.n_arr, self.L_arr, self.x_arr, self.links, self.sc_r, self.sc_e, self.armlength))
88
97
 
89
98
  def get_window(self, t: float) -> int:
90
99
  return self.g.get_window(t)
@@ -157,6 +166,42 @@ cdef class pycppDetector:
157
166
  elif isinstance(t, np.ndarray):
158
167
  return self.get_pos_arr(t, sc)
159
168
 
169
+ def get_pos_arr_wrap(self, *args, **kwargs):
170
+ (pos_x, pos_y, pos_z, t, sc, num), tkwargs = wrapper(*args, **kwargs)
171
+
172
+ cdef size_t pos_x_in = pos_x
173
+ cdef size_t pos_y_in = pos_y
174
+ cdef size_t pos_z_in = pos_z
175
+ cdef size_t t_in = t
176
+ cdef size_t sc_in = sc
177
+
178
+ self.g.get_pos_arr(
179
+ <double *>pos_x_in,
180
+ <double *>pos_y_in,
181
+ <double *>pos_z_in,
182
+ <double *>t_in,
183
+ <int *>sc_in,
184
+ num
185
+ )
186
+
187
+ def get_normal_unit_vec_arr_wrap(self, *args, **kwargs):
188
+ (normal_unit_vec_x, normal_unit_vec_y, normal_unit_vec_z, t, sc, num), tkwargs = wrapper(*args, **kwargs)
189
+
190
+ cdef size_t normal_unit_vec_x_in = normal_unit_vec_x
191
+ cdef size_t normal_unit_vec_y_in = normal_unit_vec_y
192
+ cdef size_t normal_unit_vec_z_in = normal_unit_vec_z
193
+ cdef size_t t_in = t
194
+ cdef size_t sc_in = sc
195
+
196
+ self.g.get_normal_unit_vec_arr(
197
+ <double *>normal_unit_vec_x_in,
198
+ <double *>normal_unit_vec_y_in,
199
+ <double *>normal_unit_vec_z_in,
200
+ <double *>t_in,
201
+ <int *>sc_in,
202
+ num
203
+ )
204
+
160
205
  def get_light_travel_time_arr_wrap(self, *args, **kwargs):
161
206
  (ltt, t, link, num), tkwargs = wrapper(*args, **kwargs)
162
207
 
@@ -170,6 +215,15 @@ cdef class pycppDetector:
170
215
  <int *>link_in,
171
216
  num
172
217
  )
218
+
219
+ def get_sc_r_from_arr(self, i: int) -> int:
220
+ return self.g.get_sc_r_from_arr(i)
221
+
222
+ def get_sc_e_from_arr(self, i: int) -> int:
223
+ return self.g.get_sc_e_from_arr(i)
224
+
225
+ def get_link_from_arr(self, i: int) -> int:
226
+ return self.g.get_link_from_arr(i)
173
227
 
174
228
 
175
229
  @property
@@ -184,7 +238,8 @@ def rebuild(dt,
184
238
  x_arr,
185
239
  links,
186
240
  sc_r,
187
- sc_e
241
+ sc_e,
242
+ armlength
188
243
  ):
189
244
  c = pycppDetector(
190
245
  dt,
@@ -194,6 +249,7 @@ def rebuild(dt,
194
249
  x_arr,
195
250
  links,
196
251
  sc_r,
197
- sc_e
252
+ sc_e,
253
+ armlength
198
254
  )
199
255
  return c