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.

@@ -0,0 +1,65 @@
1
+ import numpy as np
2
+ cimport numpy as np
3
+
4
+ from lisatools.utils.pointeradjust import pointer_adjust
5
+
6
+ assert sizeof(int) == sizeof(np.int32_t)
7
+
8
+ cdef extern from "Detector.hpp":
9
+ ctypedef void* Orbits 'Orbits'
10
+
11
+ cdef extern from "LISAResponse.hh":
12
+ ctypedef void* cmplx 'cmplx'
13
+ void get_response(double* y_gw, double* t_data, double* k_in, double* u_in, double* v_in, double dt,
14
+ int num_delays,
15
+ cmplx *input_in, int num_inputs, int order,
16
+ double sampling_frequency, int buffer_integer, double* A_in, double deps, int num_A, double* E_in,
17
+ int projections_start_ind,
18
+ Orbits *orbits);
19
+
20
+ void get_tdi_delays(double *delayed_links, double *input_links, int num_inputs, int num_delays, double *t_arr, int *tdi_base_link, int *tdi_link_combinations, int *tdi_signs, int *channels, int num_units, int num_channels,
21
+ int order, double sampling_frequency, int buffer_integer, double *A_in, double deps, int num_A, double *E_in, int tdi_start_ind, Orbits *orbits);
22
+
23
+ @pointer_adjust
24
+ def get_response_wrap(y_gw, t_data, k_in, u_in, v_in, dt,
25
+ num_delays,
26
+ input_in, num_inputs, order, sampling_frequency, buffer_integer,
27
+ A_in, deps, num_A, E_in, projections_start_ind,
28
+ orbits):
29
+
30
+ cdef size_t y_gw_in = y_gw
31
+ cdef size_t t_data_in = t_data
32
+ cdef size_t k_in_in = k_in
33
+ cdef size_t u_in_in = u_in
34
+ cdef size_t v_in_in = v_in
35
+
36
+ cdef size_t orbits_in = orbits
37
+ cdef size_t input_in_in = input_in
38
+
39
+ cdef size_t A_in_in = A_in
40
+ cdef size_t E_in_in = E_in
41
+
42
+ get_response(<double* >y_gw_in, <double*> t_data_in, <double* >k_in_in, <double* >u_in_in, <double* >v_in_in, dt,
43
+ num_delays,
44
+ <cmplx *>input_in_in, num_inputs, order, sampling_frequency, buffer_integer,
45
+ <double*> A_in_in, deps, num_A, <double*> E_in_in, projections_start_ind,
46
+ <Orbits*> orbits_in)
47
+
48
+
49
+ @pointer_adjust
50
+ def get_tdi_delays_wrap(delayed_links, y_gw, num_inputs, num_delays, t_arr, tdi_base_link, tdi_link_combinations, tdi_signs, channels, num_units, num_channels,
51
+ order, sampling_frequency, buffer_integer, A_in, deps, num_A, E_in, tdi_start_ind, orbits):
52
+
53
+ cdef size_t delayed_links_in = delayed_links
54
+ cdef size_t y_gw_in = y_gw
55
+ cdef size_t A_in_in = A_in
56
+ cdef size_t E_in_in = E_in
57
+ cdef size_t t_arr_in = t_arr
58
+ cdef size_t tdi_base_link_in = tdi_base_link
59
+ cdef size_t tdi_link_combinations_in = tdi_link_combinations
60
+ cdef size_t tdi_signs_in = tdi_signs
61
+ cdef size_t channels_in = channels
62
+ cdef size_t orbits_in = orbits
63
+
64
+ get_tdi_delays(<double*> delayed_links_in, <double*> y_gw_in, num_inputs, num_delays, <double*> t_arr_in, <int*> tdi_base_link_in, <int*> tdi_link_combinations_in, <int*> tdi_signs_in, <int*> channels_in, num_units, num_channels,
65
+ order, sampling_frequency, buffer_integer, <double*> A_in_in, deps, num_A, <double*> E_in_in, tdi_start_ind, <Orbits*> orbits_in)
@@ -0,0 +1,33 @@
1
+ import numpy as np
2
+
3
+ try:
4
+ import cupy as cp
5
+
6
+ gpu = True
7
+
8
+ except (ImportError, ModuleNotFoundError) as e:
9
+ gpu = False
10
+
11
+
12
+ def pointer_adjust(func):
13
+ def func_wrapper(*args, **kwargs):
14
+ targs = []
15
+ for arg in args:
16
+ if gpu:
17
+ if isinstance(arg, cp.ndarray):
18
+ targs.append(arg.data.mem.ptr)
19
+ continue
20
+
21
+ if isinstance(arg, np.ndarray):
22
+ targs.append(arg.__array_interface__["data"][0])
23
+ continue
24
+
25
+ try:
26
+ targs.append(arg.ptr)
27
+ continue
28
+ except AttributeError:
29
+ targs.append(arg)
30
+
31
+ return func(*targs, **kwargs)
32
+
33
+ return func_wrapper