-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified cython code with own version of likelihood_parts function fo…
…r waveforms whcih compute own det response
- Loading branch information
Showing
2 changed files
with
54 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,38 @@ cpdef likelihood_parts(double [::1] freqs, | |
x0 = x0n | ||
return hd, hh | ||
|
||
cpdef likelihood_parts_det(double [::1] freqs, | ||
double fp, | ||
double dtc, | ||
double complex[::1] hp, | ||
double complex[::1] hc, | ||
double complex[::1] h00, | ||
double complex[::1] a0, | ||
double complex[::1] a1, | ||
double [::1] b0, | ||
double [::1] b1, | ||
) : | ||
cdef size_t i | ||
cdef double complex hd=0, r0, r0n, r1, x0, x1, x0n; | ||
cdef double hh=0 | ||
|
||
N = freqs.shape[0] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
spxiwh
Contributor
|
||
for i in range(N): | ||
r0n = (exp(-2.0j * 3.141592653 * dtc * freqs[i]) | ||
* (fp * hp[i])) / h00[i] | ||
r1 = r0n - r0 | ||
|
||
x0n = norm(r0n) | ||
x1 = x0n - x0 | ||
|
||
if i > 0: | ||
hd += a0[i-1] * r0 + a1[i-1] * r1 | ||
hh += real(b0[i-1] * x0 + b1[i-1] * x1) | ||
|
||
r0 = r0n | ||
x0 = x0n | ||
return hd, hh | ||
|
||
cpdef likelihood_parts_v(double [::1] freqs, | ||
double[::1] fp, | ||
double[::1] fc, | ||
|
You need to declare that N is an int or the code will be significantly slower.