lisaanalysistools 1.0.7__cp312-cp312-macosx_10_9_x86_64.whl → 1.0.9__cp312-cp312-macosx_10_9_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.

Potentially problematic release.


This version of lisaanalysistools might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lisaanalysistools
3
- Version: 1.0.7
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
@@ -11,7 +11,7 @@ Classifier: Natural Language :: English
11
11
  Classifier: Programming Language :: C++
12
12
  Classifier: Programming Language :: Cython
13
13
  Classifier: Programming Language :: Python :: 3.12
14
- Requires-Python: >=3.12
14
+ Requires-Python: >=3.6
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
17
 
@@ -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.7
69
+ Current Version: 1.0.9
70
70
 
71
71
  ## Authors/Developers
72
72
 
@@ -0,0 +1,43 @@
1
+ lisatools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ lisatools/_version.py,sha256=QbUYcRE1ARwVrFkV2kInId-i0dmrMze1qvmx5x5kC7A,123
3
+ lisatools/analysiscontainer.py,sha256=kvTP0KSzfAlLBkeF3RNn0BcZs_K1Z0ntQA4xglfxqgI,15345
4
+ lisatools/datacontainer.py,sha256=QVz0twD46Fl_J-ueGQUCXOJkkXUEum7yrwp9LaVeohU,9853
5
+ lisatools/detector.py,sha256=M0bFi2sGd8RJHGlHblOfcWoJjE0HEPVPBB5SCaoq8kk,21035
6
+ lisatools/diagnostic.py,sha256=o9vtfXbY3yMDk4cGNeOsTrlP7gYG_BRROw7gyuThDaM,34192
7
+ lisatools/sensitivity.py,sha256=cUgYvfsfd-MrKCAUk2rwb-oQm6IfHI-IMndbRLOKqVs,27380
8
+ lisatools/stochastic.py,sha256=CysAQ5BIVD349fLjAMpZAXaT0X0dFjrd4QFi0vfqops,9458
9
+ lisatools/cutils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ lisatools/cutils/detector_cpu.cpython-312-darwin.so,sha256=YllH2vtquGFNiYQghMveEtsH9HvvN_cejSNoCqvmKb4,154720
11
+ lisatools/cutils/include/Detector.hpp,sha256=Ic37OgP-gvEg8qouhv9aFYf7vQP98tJ_i6PGu8RI1YQ,2050
12
+ lisatools/cutils/include/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ lisatools/cutils/include/global.hpp,sha256=3VPiqglTMRrIBXlEvDUJO2-CjKy_SLUXZt-9A1fH6lQ,572
14
+ lisatools/cutils/src/Detector.cpp,sha256=JvAK8UCoYxgTACBhx3hi0EK9hT-HRYOxX2XozHuHI7E,7947
15
+ lisatools/cutils/src/Detector.cu,sha256=JvAK8UCoYxgTACBhx3hi0EK9hT-HRYOxX2XozHuHI7E,7947
16
+ lisatools/cutils/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ lisatools/cutils/src/pycppdetector.pyx,sha256=e0tz79VNS7Sxxwyx9RQwsFVdpuClBsUf7OArSkyRBa0,7613
18
+ lisatools/sampling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ lisatools/sampling/likelihood.py,sha256=G2kAQ43qlhAzIFWvYsrSmHXd7WKJAzcCN2o07vRE8vc,29585
20
+ lisatools/sampling/prior.py,sha256=1K1PMStpwO9WT0qG0aotKSyoNjuehXNbzTDtlk8Q15M,21407
21
+ lisatools/sampling/stopping.py,sha256=Q8q7nM0wnJervhRduf2tBXZZHUVza5kJiAUAMUQXP5o,9682
22
+ lisatools/sampling/utility.py,sha256=rOGotS0Aj8-DAWqsTVy2xWNsxsoz74BVrHEnG2mOkwU,14340
23
+ lisatools/sampling/moves/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ lisatools/sampling/moves/skymodehop.py,sha256=0nf72eFhFMGwi0dLJci6XZz-bIMGqco2B2_J72hQvf8,3348
25
+ lisatools/sources/__init__.py,sha256=Fm085xHQ3VpRjqaSlws0bdVefFofAxNzVZyGQQYrQic,140
26
+ lisatools/sources/defaultresponse.py,sha256=2SMbRf-UwgLNaA89tIANjw4BCKh1XEuRg5mgkvAg3-k,839
27
+ lisatools/sources/utils.py,sha256=wuk2pHMTNN2r03K98uQCAYIh3eXZqk_SUcStyJZLJl8,14061
28
+ lisatools/sources/waveformbase.py,sha256=JPLqLZd1e-6E3ySyXodO83nZGH8bVq2K_s8sF2Oy84w,845
29
+ lisatools/sources/bbh/__init__.py,sha256=M3yP4eaScZZMhOucn88iiJ2WGL6zZTQI0xUEnmw4Nu8,37
30
+ lisatools/sources/bbh/waveform.py,sha256=-xg2uYB8AWf233W34hxwLsnlSYPF9d7TqzNfXj95zaA,2599
31
+ lisatools/sources/emri/__init__.py,sha256=3W0kL4bfTtZNm-wM5t6Y0TTjtZMh4fe_qDyZ6a5rLck,38
32
+ lisatools/sources/emri/waveform.py,sha256=W7Dx_ibygF8zbz1neJzyddy7HGH0kDppDI3HKStdbqc,2422
33
+ lisatools/sources/gb/__init__.py,sha256=GDlLi4M4QPoEdvScIyOyhTuqk0XvFM5ymhR1EE7FYXY,36
34
+ lisatools/sources/gb/waveform.py,sha256=Plwym5CHCEZIDiQ4Fc7MrTh7T74hMNkqGqy2YDpd_OE,1777
35
+ lisatools/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
+ lisatools/utils/constants.py,sha256=r1kVwkpbZS13JTOxj2iRxT5sMgTYX30y-S0JdVmD5Oo,1354
37
+ lisatools/utils/pointeradjust.py,sha256=2sT-7qeYWr1pd_sHk9leVHUTSJ7jJgYIRoWQOtYqguE,2995
38
+ lisatools/utils/utility.py,sha256=MKqRsG8qRI1xCsj51mt6QRa80-deUUgedxibyMV3KD4,6776
39
+ lisaanalysistools-1.0.9.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
40
+ lisaanalysistools-1.0.9.dist-info/METADATA,sha256=YnlE4nlJwhEHXdksYlclsuPIP1UPMRvfwhs6xFqTb2s,4200
41
+ lisaanalysistools-1.0.9.dist-info/WHEEL,sha256=EahQufTUtBnyvrECh1gpiswxGRRuu1fCWmVm0K3Ige4,110
42
+ lisaanalysistools-1.0.9.dist-info/top_level.txt,sha256=qXUn8Xi8yvK0vr3QH0vvT5cmoccjSj-UPeKGLAxdYGo,10
43
+ lisaanalysistools-1.0.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.1.0)
2
+ Generator: setuptools (72.2.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp312-cp312-macosx_10_9_x86_64
5
5
 
lisatools/_version.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = '1.0.7'
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
@@ -225,7 +225,7 @@ class DataResidualArray:
225
225
  raise ValueError
226
226
 
227
227
  self.nchannels = len(new_out)
228
- self._data_res_arr = np.asarray(list(new_out), dtype=complex)
228
+ self._data_res_arr = np.asarray(list(new_out), dtype=new_out[0].dtype)
229
229
 
230
230
  def __getitem__(self, index: tuple) -> np.ndarray:
231
231
  """Index this class directly in ``self.data_res_arr``."""