16 #ifndef _LALSIMIMREOBHYBRIDRINGDOWNPREC_C
17 #define _LALSIMIMREOBHYBRIDRINGDOWNPREC_C
22 #include <lal/LALStdlib.h>
23 #include <lal/AVFactories.h>
24 #include <lal/SeqFactories.h>
25 #include <gsl/gsl_linalg.h>
26 #include <gsl/gsl_interp.h>
27 #include <gsl/gsl_spline.h>
28 #include <gsl/gsl_blas.h>
40 #define UNUSED __attribute__ ((unused))
64 A1coeff00[2][2] = 0.0830664;
65 A1coeff01[2][2] = -0.0196758;
66 A1coeff02[2][2] = -0.0136459;
67 A1coeff10[2][2] = 0.0612892;
68 A1coeff11[2][2] = 0.00146142;
69 A1coeff20[2][2] = -0.0893454;
71 A1coeff00[2][1] = 0.07780330893915006;
72 A1coeff01[2][1] = -0.05070638166864379;
73 A1coeff10[2][1] = 0.24091006920322164;
74 A1coeff11[2][1] = 0.38582622780596576;
75 A1coeff20[2][1] = -0.7456327888190485;
76 A1coeff21[2][1] = -0.9695534075470388;
78 A1coeff00[3][3] = 0.07638733045623343;
79 A1coeff01[3][3] = -0.030993441267953236;
80 A1coeff10[3][3] = 0.2543447497371546;
81 A1coeff11[3][3] = 0.2516879591102584;
82 A1coeff20[3][3] = -1.0892686061231245;
83 A1coeff21[3][3] = -0.7980907313033606;
85 A1coeff00[4][4] = -0.06392710223439678;
86 A1coeff01[4][4] = -0.03646167590514318;
87 A1coeff10[4][4] = 0.345195277237925;
88 A1coeff11[4][4] = 1.2777441574118558;
89 A1coeff20[4][4] = -1.764352185878576;
90 A1coeff21[4][4] = -14.825262897834696;
91 A1coeff31[4][4] = 40.67135475479875;
93 A1coeff00[5][5] = -0.06704614393611373;
94 A1coeff01[5][5] = 0.021905949257025503;
95 A1coeff10[5][5] = -0.24754936787743445;
96 A1coeff11[5][5] = -0.0943771022698497;
97 A1coeff20[5][5] = 0.7588042862093705;
98 A1coeff21[5][5] = 0.4357768883690394;
102 return A1coeff00[modeL][modeM] + A1coeff01[modeL][modeM] * chi + A1coeff02[modeL][modeM] * chi * chi + A1coeff10[modeL][modeM] * eta +
103 A1coeff11[modeL][modeM] * eta * chi + A1coeff20[modeL][modeM] * eta * eta + A1coeff21[modeL][modeM]*eta*eta*chi + A1coeff31[modeL][modeM]*eta*eta*eta*chi;
123 A2coeff00[2][2] = -0.623953;
124 A2coeff01[2][2] = -0.371365;
125 A2coeff10[2][2] = 1.39777;
126 A2coeff11[2][2] = 2.40203;
127 A2coeff20[2][2] = -1.82173;
128 A2coeff21[2][2] = -5.25339;
130 A2coeff00[2][1] = -1.2451852641667298;
131 A2coeff01[2][1] = -1.195786238319961;
132 A2coeff10[2][1] = 6.134202504312409;
133 A2coeff11[2][1] = 15.66696619631313;
134 A2coeff20[2][1] = -14.67251127485556;
135 A2coeff21[2][1] = -44.41982201432511;
137 A2coeff00[3][3] = -0.8325292359346013;
138 A2coeff01[3][3] = -0.598880303198448;
139 A2coeff10[3][3] = 2.767989795032018;
140 A2coeff11[3][3] = 5.904371617277156;
141 A2coeff20[3][3] = -7.028151926115957;
142 A2coeff21[3][3] = -18.232606706124482;
144 A2coeff00[4][4] = 0.7813275473485185;
145 A2coeff01[4][4] = 0.8094706044462984;
146 A2coeff10[4][4] = -5.18689829943586;
147 A2coeff11[4][4] = -5.38343327318501;
148 A2coeff20[4][4] = 14.026415859369477;
149 A2coeff21[4][4] = 0.1051625997942299;
150 A2coeff31[4][4] = 46.978434956814006;
152 A2coeff00[5][5] = 1.6763424265367357;
153 A2coeff01[5][5] = 0.4925695499534606;
154 A2coeff10[5][5] = -5.604559311983177;
155 A2coeff11[5][5] = -6.209095657439377;
156 A2coeff20[5][5] = 16.751319143123386;
157 A2coeff21[5][5] = 16.778452555342554;
159 return A2coeff00[modeL][modeM] + A2coeff01[modeL][modeM] * chi + A2coeff10[modeL][modeM] * eta +
160 A2coeff11[modeL][modeM] * eta * chi + A2coeff20[modeL][modeM] * eta * eta + A2coeff21[modeL][modeM] * eta * eta * chi + A2coeff31[modeL][modeM]*eta*eta*eta*chi;
179 P1coeff00[2][2] = 0.147584;
180 P1coeff01[2][2] = 0.00779176;
181 P1coeff02[2][2] = -0.0244358;
182 P1coeff10[2][2] = 0.263456;
183 P1coeff11[2][2] = -0.120853;
184 P1coeff20[2][2] = -0.808987;
186 P1coeff00[2][1] = 0.15601401627613815;
187 P1coeff01[2][1] = 0.10219957917717622;
188 P1coeff10[2][1] = 0.023346852452720928;
189 P1coeff11[2][1] = -0.9435308286367039;
190 P1coeff20[2][1] = 0.15326558178697175;
191 P1coeff21[2][1] = 1.7979082057513565;
193 P1coeff00[3][3] = 0.11085299117493969;
194 P1coeff01[3][3] = 0.018959099261813613;
195 P1coeff10[3][3] = 0.9999800463662053;
196 P1coeff11[3][3] = -0.729149797691242;
197 P1coeff20[3][3] = -3.3983315694441125;
198 P1coeff21[3][3] = 2.5192011762934037;
200 P1coeff00[4][4] = 0.11498976343440313;
201 P1coeff01[4][4] = 0.008389519706605305;
202 P1coeff10[4][4] = 1.6126522800609633;
203 P1coeff11[4][4] = -0.8069979888526699;
204 P1coeff20[4][4] = -6.255895564079467;
205 P1coeff21[4][4] = 7.595651881827078;
206 P1coeff31[4][4] = -19.32367406125053;
208 P1coeff00[5][5] = 0.16465380962882128;
209 P1coeff01[5][5] = -0.026574817803812007;
210 P1coeff10[5][5] = -0.19184523794508765;
211 P1coeff11[5][5] = -0.05519618962738479;
212 P1coeff20[5][5] = 0.33328424135336965;
213 P1coeff21[5][5] = 0.3194274548351241;
216 return P1coeff00[modeL][modeM] + P1coeff01[modeL][modeM] * chi + P1coeff02[modeL][modeM] * chi * chi + P1coeff10[modeL][modeM] * eta +
217 P1coeff11[modeL][modeM] * eta * chi + P1coeff20[modeL][modeM] * eta * eta + P1coeff21[modeL][modeM]*eta*eta*chi + P1coeff31[modeL][modeM]*eta*eta*eta*chi;
237 P2coeff00[2][2] = 2.46654;
238 P2coeff01[2][2] = 3.13067;
239 P2coeff02[2][2] = 0.581626;
240 P2coeff10[2][2] = -6.99396;
241 P2coeff11[2][2] = -9.61861;
242 P2coeff20[2][2] = 17.5646;
244 P2coeff00[2][1] = 2.7886287922318105;
245 P2coeff01[2][1] = 4.29290053494256;
246 P2coeff10[2][1] = -0.8145406685320334;
247 P2coeff11[2][1] = -15.93796979597706;
248 P2coeff20[2][1] = 5.549338798935832;
249 P2coeff21[2][1] = 12.649775582333442;
250 P2coeff02[2][1] = 2.5582321247274726;
251 P2coeff12[2][1] = -10.232928498772893;
253 P2coeff00[3][3] = 2.7825237371542735;
254 P2coeff01[3][3] = 2.8796835808075003;
255 P2coeff10[3][3] = -7.844741660437831;
256 P2coeff11[3][3] = -34.7670039322078;
257 P2coeff20[3][3] = 27.181024362399302;
258 P2coeff21[3][3] = 127.13948436435182;
260 P2coeff00[4][4] = 3.111817347262856;
261 P2coeff01[4][4] = 5.399341180960216;
262 P2coeff10[4][4] = 15.885333959709488;
263 P2coeff11[4][4] = -87.92421137153823;
264 P2coeff20[4][4] = -79.64931908155609;
265 P2coeff21[4][4] = 657.7156442271963;
266 P2coeff31[4][4] = -1555.2968529739226;
267 P2coeff02[4][4] = 2.3832321567874686;
268 P2coeff12[4][4] = -9.532928476043567;
270 P2coeff00[5][5] = 11.102447263357977;
271 P2coeff01[5][5] = 6.015112119742853;
272 P2coeff10[5][5] = -58.605776859097084;
273 P2coeff11[5][5] = -81.68032025902797;
274 P2coeff20[5][5] = 176.60643662729498;
275 P2coeff21[5][5] = 266.47345742836745;
278 return P2coeff00[modeL][modeM] + P2coeff01[modeL][modeM] * chi + P2coeff02[modeL][modeM] * chi * chi + P2coeff12[modeL][modeM] * chi * chi * eta + P2coeff10[modeL][modeM] * eta +
279 P2coeff11[modeL][modeM] * eta * chi + P2coeff20[modeL][modeM] * eta * eta + P2coeff21[modeL][modeM]*eta*eta*chi + P2coeff31[modeL][modeM]*eta*eta*eta*chi;
317 UINT4 i, j, k, nmodes = 8;
320 REAL8 t1, t2, t3, t4, t5, rt;
332 t5 = (matchrange->
data[0] - matchrange->
data[1]) *
m;
340 if ( inspwave1->
length != 3 || inspwave2->
length != 3 ||
341 modefreqs->
length != nmodes )
348 XLAL_CALLGSL( coef = (gsl_matrix *) gsl_matrix_alloc(2 * nmodes, 2 * nmodes) );
349 XLAL_CALLGSL( hderivs = (gsl_vector *) gsl_vector_alloc(2 * nmodes) );
350 XLAL_CALLGSL(
x = (gsl_vector *) gsl_vector_alloc(2 * nmodes) );
351 XLAL_CALLGSL(
p = (gsl_permutation *) gsl_permutation_alloc(2 * nmodes) );
354 if ( !coef || !hderivs || !
x || !
p )
356 if (coef) gsl_matrix_free(coef);
357 if (hderivs) gsl_vector_free(hderivs);
358 if (
x) gsl_vector_free(
x);
359 if (
p) gsl_permutation_free(
p);
368 for (
i = 0;
i < nmodes; ++
i)
370 gsl_matrix_set(coef, 0,
i, 1);
371 gsl_matrix_set(coef, 1,
i, - cimag(modefreqs->
data[
i]));
372 gsl_matrix_set(coef, 2,
i, exp(-cimag(modefreqs->
data[
i])*t1) * cos(creal(modefreqs->
data[
i])*t1));
373 gsl_matrix_set(coef, 3,
i, exp(-cimag(modefreqs->
data[
i])*t2) * cos(creal(modefreqs->
data[
i])*t2));
374 gsl_matrix_set(coef, 4,
i, exp(-cimag(modefreqs->
data[
i])*t3) * cos(creal(modefreqs->
data[
i])*t3));
375 gsl_matrix_set(coef, 5,
i, exp(-cimag(modefreqs->
data[
i])*t4) * cos(creal(modefreqs->
data[
i])*t4));
376 gsl_matrix_set(coef, 6,
i, exp(-cimag(modefreqs->
data[
i])*t5) * cos(creal(modefreqs->
data[
i])*t5));
377 gsl_matrix_set(coef, 7,
i, exp(-cimag(modefreqs->
data[
i])*t5) *
378 (-cimag(modefreqs->
data[
i]) * cos(creal(modefreqs->
data[
i])*t5)
379 -creal(modefreqs->
data[
i]) * sin(creal(modefreqs->
data[
i])*t5)));
380 gsl_matrix_set(coef, 8,
i, 0);
381 gsl_matrix_set(coef, 9,
i, - creal(modefreqs->
data[
i]));
382 gsl_matrix_set(coef, 10,
i, -exp(-cimag(modefreqs->
data[
i])*t1) * sin(creal(modefreqs->
data[
i])*t1));
383 gsl_matrix_set(coef, 11,
i, -exp(-cimag(modefreqs->
data[
i])*t2) * sin(creal(modefreqs->
data[
i])*t2));
384 gsl_matrix_set(coef, 12,
i, -exp(-cimag(modefreqs->
data[
i])*t3) * sin(creal(modefreqs->
data[
i])*t3));
385 gsl_matrix_set(coef, 13,
i, -exp(-cimag(modefreqs->
data[
i])*t4) * sin(creal(modefreqs->
data[
i])*t4));
386 gsl_matrix_set(coef, 14,
i, -exp(-cimag(modefreqs->
data[
i])*t5) * sin(creal(modefreqs->
data[
i])*t5));
387 gsl_matrix_set(coef, 15,
i, exp(-cimag(modefreqs->
data[
i])*t5) *
388 ( cimag(modefreqs->
data[
i]) * sin(creal(modefreqs->
data[
i])*t5)
389 -creal(modefreqs->
data[
i]) * cos(creal(modefreqs->
data[
i])*t5)));
391 for (
i = 0;
i < 2; ++
i)
394 gsl_vector_set(hderivs,
i + nmodes, inspwave2->
data[(
i + 1) * inspwave2->
vectorLength - 1]);
396 gsl_vector_set(hderivs,
i + 6 + nmodes, inspwave2->
data[
i * inspwave2->
vectorLength]);
398 gsl_vector_set(hderivs, 2, inspwave1->
data[4]);
399 gsl_vector_set(hderivs, 2 + nmodes, inspwave2->
data[4]);
400 gsl_vector_set(hderivs, 3, inspwave1->
data[3]);
401 gsl_vector_set(hderivs, 3 + nmodes, inspwave2->
data[3]);
402 gsl_vector_set(hderivs, 4, inspwave1->
data[2]);
403 gsl_vector_set(hderivs, 4 + nmodes, inspwave2->
data[2]);
404 gsl_vector_set(hderivs, 5, inspwave1->
data[1]);
405 gsl_vector_set(hderivs, 5 + nmodes, inspwave2->
data[1]);
408 for (
i = 0;
i < nmodes; ++
i)
410 for (k = 0; k < nmodes; ++k)
412 gsl_matrix_set(coef,
i, k + nmodes, - gsl_matrix_get(coef,
i + nmodes, k));
413 gsl_matrix_set(coef,
i + nmodes, k + nmodes, gsl_matrix_get(coef,
i, k));
420 for (
i = 0;
i < 16; ++
i)
422 for (j = 0; j < 16; ++j)
429 for (
i = 0;
i < 16; ++
i)
438 if ( gslStatus == GSL_SUCCESS )
440 XLAL_CALLGSL( gslStatus = gsl_linalg_LU_solve(coef,
p, hderivs,
x) );
442 if ( gslStatus != GSL_SUCCESS )
444 gsl_matrix_free(coef);
445 gsl_vector_free(hderivs);
447 gsl_permutation_free(
p);
456 gsl_matrix_free(coef);
457 gsl_vector_free(hderivs);
459 gsl_permutation_free(
p);
463 for (
i = 0;
i < nmodes; ++
i)
465 modeamps->
data[
i] = gsl_vector_get(
x,
i);
466 modeamps->
data[
i + nmodes] = gsl_vector_get(
x,
i + nmodes);
470 gsl_matrix_free(coef);
471 gsl_vector_free(hderivs);
473 gsl_permutation_free(
p);
481 for (
i=0;
i<nmodes;
i++){
482 printf(
"RD info: QNM: (re) %.16e, (im) %.16e, Amp %16e \n", creal(modefreqs->
data[
i]),
483 cimag(modefreqs->
data[
i]), modeamps->
data[
i]);
488 for (j = 0; j < rdwave1->
length; ++j)
490 tj = j *
dt - timeOffset;
491 rdwave1->
data[j] = 0;
492 rdwave2->
data[j] = 0;
493 for (
i = 0;
i < nmodes; ++
i)
495 rdwave1->
data[j] += exp(- tj * cimag(modefreqs->
data[
i]))
496 * ( modeamps->
data[
i] * cos(tj * creal(modefreqs->
data[
i]))
497 + modeamps->
data[
i + nmodes] * sin(tj * creal(modefreqs->
data[
i])) );
498 rdwave2->
data[j] += exp(- tj * cimag(modefreqs->
data[
i]))
499 * (- modeamps->
data[
i] * sin(tj * creal(modefreqs->
data[
i]))
500 + modeamps->
data[
i + nmodes] * cos(tj * creal(modefreqs->
data[
i])) );
539 gsl_interp_accel *acc;
545 tlist = (
double *)
LALMalloc(6 *
sizeof(
double));
546 rt = (matchrange->
data[1] - matchrange->
data[0]) / 5.;
547 tlist[0] = matchrange->
data[0];
548 tlist[1] = tlist[0] + rt;
549 tlist[2] = tlist[1] + rt;
550 tlist[3] = tlist[2] + rt;
551 tlist[4] = tlist[3] + rt;
552 tlist[5] = matchrange->
data[1];
555 vecLength = (
m * matchrange->
data[2] /
dt ) + 1;
559 y = (
double *)
LALMalloc(vecLength *
sizeof(
double));
566 for (j = 0; j < vecLength; ++j)
568 y[j] = wave->
data[j];
572 XLAL_CALLGSL( acc = (gsl_interp_accel*) gsl_interp_accel_alloc() );
573 XLAL_CALLGSL( spline = (gsl_spline*) gsl_spline_alloc(gsl_interp_cspline, vecLength) );
574 if ( !acc || !spline )
576 if ( acc ) gsl_interp_accel_free(acc);
577 if ( spline ) gsl_spline_free(spline);
583 gslStatus = gsl_spline_init(spline, timeVec->
data,
y, vecLength);
584 if ( gslStatus != GSL_SUCCESS )
586 gsl_spline_free(spline);
587 gsl_interp_accel_free(acc);
593 for (j = 0; j < 6; ++j)
595 gslStatus = gsl_spline_eval_e( spline, tlist[j], acc, &ry );
596 if ( gslStatus == GSL_SUCCESS )
598 gslStatus = gsl_spline_eval_deriv_e(spline, tlist[j], acc, &dy );
599 gslStatus = gsl_spline_eval_deriv2_e(spline, tlist[j], acc, &dy2 );
601 if (gslStatus != GSL_SUCCESS )
603 gsl_spline_free(spline);
604 gsl_interp_accel_free(acc);
615 gsl_spline_free(spline);
616 gsl_interp_accel_free(acc);
632 INT4 major_approximant = 0;
638 if(major_approximant == 0)
XLAL_PRINT_ERROR(
"In LALSimIMREOBHybridRingdownPrec.c major_approximant not assigned.\n");
640 return major_approximant;
699 REAL8 NRPeakOmega22 = 0;
701 REAL8 sh , kk, kt1, kt2;
703 REAL8 spin1 [3] = {spin1x, spin1y, spin1z};
704 REAL8 spin2 [3] = {spin2x, spin2y, spin2z};
705 REAL8 finalMass, finalSpin;
706 REAL8 chi1 , chi2, theta1, theta2;
712 eta = mass1 * mass2 / ((mass1 + mass2) * (mass1 + mass2));
729 if(major_approximant == 3) {
731 mHere = (int)fabs((
REAL8)
m);
733 mHere = -(int)fabs((
REAL8)
m);
741 if (m < 0 && JLN >= 0) {
742 for (j = 0; j < nmodes; j++) {
743 modefreqs->
data[j] = conjl(-1.0 * modefreqs->
data[j]);
746 if (
m > 0 && JLN < 0) {
747 for (j = 0; j < nmodes; j++) {
748 modefreqs->
data[j] = conjl(-1.0 * modefreqs->
data[j]);
752 for (j = 5; j < nmodes; j++) {
753 modefreqs->
data[j] = conjl(-1.0 * modefreqs->
data[j - 5]);
767 for (j = 0; j < nmodes; j++) {
770 XLAL_PRINT_INFO(
"spin1 [%e, %e, %e], spin2 [%e, %e, %e] \n", spin1x, spin1y, spin1z, spin2x, spin2y, spin2z);
771 XLAL_PRINT_INFO(
"(Mf, af) = (%3.10f, %3.10f)\n", finalMass, finalSpin);
773 if (major_approximant == 1) {
776 a = (spin1[2] + spin2[2]) / 2. * (1.0 - 2.0 * eta) + (spin1[2] - spin2[2]) / 2. * (mass1 - mass2) / (mass1 + mass2);
783 modefreqs->
data[7] = (NRPeakOmega22 / finalMass + creal(modefreqs->
data[0])) / 2.;
784 modefreqs->
data[7] += I * 10. / 3. * cimag(modefreqs->
data[0]);
786 if (major_approximant == 2)
797 a = (spin1[2] + spin2[2]) / 2. * (1.0 - 2.0 * eta) + (spin1[2] - spin2[2]) / 2. * (mass1 - mass2) / (mass1 + mass2);
801 chi = (spin1[2] + spin2[2]) / 2. + (spin1[2] - spin2[2]) / 2. * ((mass1 - mass2) / (mass1 + mass2)) / (1. - 2. * eta);
811 kk = 0.7 + 0.3 * exp(100. * (eta - 0.25));
812 kt1 = 0.5 * sqrt(1. + 800.0 * eta * eta / 3.0) - 0.125;
813 kt2 = 0.5 * pow(1. + 0.5 * eta * sqrt(eta) / 0.0225, 2. / 3.) - 0.2;
831 modefreqs->
data[7] = (2. / 3. * NRPeakOmega22 / finalMass) + (1. / 3. * creal(modefreqs->
data[0]));
832 modefreqs->
data[7] += I * 3.5 / 0.9 * cimag(modefreqs->
data[0]);
833 modefreqs->
data[6] = (3. / 4. * NRPeakOmega22 / finalMass) + (1. / 4. * creal(modefreqs->
data[0]));
834 modefreqs->
data[6] += I * 3.5 * cimag(modefreqs->
data[0]);
842 if (chi >= 0.7 && chi < 0.8) {
843 sh = -9. * (eta - 0.25);
845 if ((eta > 30. / 31. / 31. && eta <= 10. / 121. && chi >= 0.8) || (eta <= 30. / 31. / 31. && chi >= 0.8 && chi < 0.9)) {
847 sh = -9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
848 kk = 0.7 + 0.3 * exp(100. * (eta - 0.25));
849 kt1 = 0.5 * sqrt(1. + 800.0 * eta * eta / 3.0) - 0.125;
850 kt2 = 0.5 * pow(1. + 0.5 * eta * sqrt(eta) / 0.0225, 2. / 3.) - 0.2;
851 modefreqs->
data[4] = 0.4 * (1. + kk) * creal(modefreqs->
data[6])
852 + I * cimag(modefreqs->
data[6]) / (2.5 * kt2 * exp(-(eta - 0.005) / 0.03));
853 modefreqs->
data[5] = 0.4 * (1. + kk) * creal(modefreqs->
data[7])
854 + I * cimag(modefreqs->
data[7]) / (1.5 * kt1 * exp(-(eta - 0.005) / 0.03));
855 modefreqs->
data[6] = kk * creal(modefreqs->
data[6]) + I * cimag(modefreqs->
data[6]) / kt2;
856 modefreqs->
data[7] = kk * creal(modefreqs->
data[7]) + I * cimag(modefreqs->
data[7]) / kt1;
858 if (eta < 30. / 31. / 31. && chi >= 0.9) {
860 sh = 0.55 - 9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
861 kk = 0.7 + 0.3 * exp(100. * (eta - 0.25));
862 kt1 = 0.5 * sqrt(1. + 800.0 * eta * eta / 3.0) - 0.125;
863 kt2 = 0.5 * pow(1. + 0.5 * eta * sqrt(eta) / 0.0225, 2. / 3.) - 0.2;
864 modefreqs->
data[4] = 1.1 * 0.4 * (1. + kk) * creal(modefreqs->
data[6])
865 + I * cimag(modefreqs->
data[6]) / (1.05 * 2.5 * kt2 * exp(-(eta - 0.005) / 0.03));
866 modefreqs->
data[5] = 0.4 * (1. + kk) * creal(modefreqs->
data[7])
867 + I * cimag(modefreqs->
data[7]) / (1.05 * 1.5 * kt1 * exp(-(eta - 0.005) / 0.03));
868 modefreqs->
data[6] = kk * creal(modefreqs->
data[6]) + I * cimag(modefreqs->
data[6]) / kt2;
869 modefreqs->
data[7] = kk * creal(modefreqs->
data[7]) + I * cimag(modefreqs->
data[7]) / kt1;
871 if (eta > 10. / 121. && chi >= 0.8) {
873 sh = 1. - 9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
874 kk = 0.7 + 0.3 * exp(100. * (eta - 0.25));
875 kt1 = 0.45 * sqrt(1. + 200.0 * eta * eta / 3.0) - 0.125;
876 kt2 = 0.5 * pow(1. + 0.5 * eta * sqrt(eta) / 0.0225, 2. / 3.) - 0.2;
877 modefreqs->
data[6] = kk * creal(modefreqs->
data[6]) + I * cimag(modefreqs->
data[6]) / 0.95 / kt2;
878 modefreqs->
data[7] = kk * creal(modefreqs->
data[7]) + I * cimag(modefreqs->
data[7]) / kt1;
881 matchrange->
data[0] -= sh;
882 matchrange->
data[1] -= sh;
904 if (major_approximant == 3) {
905 REAL8 kappa_thr = 0.175;
907 REAL8 eJL_thr = 5.0e-2;
909 chi1 = sqrt(spin1[0] * spin1[0] + spin1[1] * spin1[1] + spin1[2] * spin1[2]);
910 chi2 = sqrt(spin2[0] * spin2[0] + spin2[1] * spin2[1] + spin2[2] * spin2[2]);
911 if (chi1 < 1.0e-15) {
914 theta1 = acos(spin1[2] / chi1);
916 if (chi2 < 1.0e-15) {
919 theta2 = acos(spin2[2] / chi2);
921 chi1 = chi1 * cos(theta1);
922 chi2 = chi2 * cos(theta2);
927 gsl_interp_accel *acc;
932 double hRe, dhRe, hIm, dhIm;
938 for (j = 0; j < timeVec->
length; ++j) {
939 y[j] = signal1->
data[j];
946 XLAL_CALLGSL(acc = (gsl_interp_accel *) gsl_interp_accel_alloc());
948 XLAL_CALLGSL(spline = (gsl_spline *) gsl_spline_alloc(gsl_interp_cspline, timeVec->
length));
949 if (!acc || !spline) {
951 gsl_interp_accel_free(acc);
953 gsl_spline_free(spline);
960 INT4 gslStatus = gsl_spline_init(spline, timeVec->
data,
y, timeVec->
length);
961 if (gslStatus != GSL_SUCCESS) {
962 gsl_spline_free(spline);
963 gsl_interp_accel_free(acc);
967 gslStatus = gsl_spline_eval_e(spline, matchrange->
data[1], acc, &ry);
970 if (gslStatus == GSL_SUCCESS) {
971 gslStatus = gsl_spline_eval_deriv_e(spline, matchrange->
data[1], acc, &dy);
974 if (gslStatus != GSL_SUCCESS) {
975 gsl_spline_free(spline);
976 gsl_interp_accel_free(acc);
987 for (j = 0; j < timeVec->
length; ++j) {
988 y[j] = signal2->
data[j];
995 if (!acc || !spline) {
997 gsl_interp_accel_free(acc);
999 gsl_spline_free(spline);
1004 gslStatus = gsl_spline_init(spline, timeVec->
data,
y, timeVec->
length);
1005 if (gslStatus != GSL_SUCCESS) {
1006 gsl_spline_free(spline);
1007 gsl_interp_accel_free(acc);
1011 gslStatus = gsl_spline_eval_e(spline, matchrange->
data[1], acc, &ry);
1012 if (gslStatus == GSL_SUCCESS) {
1013 gslStatus = gsl_spline_eval_deriv_e(spline, matchrange->
data[1], acc, &dy);
1015 if (gslStatus != GSL_SUCCESS) {
1016 gsl_spline_free(spline);
1017 gsl_interp_accel_free(acc);
1022 dhIm = (
REAL8) (dy);
1025 double hNorm2 = hRe*hRe + hIm*hIm;
1026 double omegaWavePeak = creal(modefreqs->
data[0]);
1028 omegaWavePeak = ((-dhRe*hIm + dhIm*hRe)/hNorm2) / mTot;
1036 a = (chi1 + chi2) / 2. * (1.0 - 2.0 * eta) + (chi1 - chi2) / 2. * (mass1 - mass2) / (mass1 + mass2);
1037 NRPeakOmega22 = fabs(omegaWavePeak);
1039 gsl_spline_free(spline);
1040 gsl_interp_accel_free(acc);
1049 chi = (chi1 + chi2) / 2. + (chi1 - chi2) / 2. * ((mass1 - mass2) / (mass1 + mass2)) / (1. - 2. * eta);
1052 if (chi >= 0.7 && chi < 0.8) {
1053 sh = -9. * (eta - 0.25);
1055 if ((eta > 30. / 31. / 31. && eta <= 10. / 121. && chi >= 0.8) || (eta <= 30. / 31. / 31. && chi >= 0.8 && chi < 0.9)) {
1057 sh = -9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
1059 if (eta < 30. / 31. / 31. && chi >= 0.9) {
1061 sh = 0.55 - 9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
1063 if (eta > 10. / 121. && chi >= 0.8) {
1065 sh = 1. - 9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
1067 if ((
int)fabs((
REAL8)
m) == 2 &&
l == 2) {
1081 kk = kt1 = kt2 = 1.;
1083 kk = 0.7 + 0.3 * exp(100. * (eta - 0.25));
1084 kt1 = -0.125 + sqrt(1. + 200. * pow(eta, 2) / 3.) / 2.;
1085 kt2 = -0.2 + pow(1. + 200. * pow(eta, 3. / 2.) / 9., 2. / 3.) / 2.;
1093 modefreqs->
data[6] = (-3. / 4. * NRPeakOmega22 / finalMass) + (1. / 4. * creal(modefreqs->
data[0]));
1094 modefreqs->
data[7] = (-2. / 3. * NRPeakOmega22 / finalMass) + (1. / 3. * creal(modefreqs->
data[0]));
1096 modefreqs->
data[6] = (3. / 4. * NRPeakOmega22 / finalMass) + (1. / 4. * creal(modefreqs->
data[0]));
1097 modefreqs->
data[7] = (2. / 3. * NRPeakOmega22 / finalMass) + (1. / 3. * creal(modefreqs->
data[0]));
1101 modefreqs->
data[7] += I * 3.5 / 0.9 * cimag(modefreqs->
data[0]);
1102 modefreqs->
data[6] += I * 3.5 * cimag(modefreqs->
data[0]);
1104 if ((eta > 30. / 31. / 31. && eta <= 10. / 121. && chi >= 0.8) || (eta <= 30. / 31. / 31. && chi >= 0.8 && chi < 0.9)) {
1107 XLAL_PRINT_INFO(
"Stas, this is case4 for pQNM eta = %f, chi = %f \n", eta, chi);
1108 sh = -9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
1109 kk = 0.7 + 0.3 * exp(100. * (eta - 0.25));
1110 kt1 = 0.5 * sqrt(1. + 800.0 * eta * eta / 3.0) - 0.125;
1111 kt2 = 0.5 * pow(1. + 0.5 * eta * sqrt(eta) / 0.0225, 2. / 3.) - 0.2;
1113 modefreqs->
data[4] = 0.4 * (1. + kk) * creal(modefreqs->
data[6])
1114 + I * cimag(modefreqs->
data[6]) / (2.5 * kt2 * exp(-(eta - 0.005) / 0.03));
1115 modefreqs->
data[5] = 0.4 * (1. + kk) * creal(modefreqs->
data[7])
1116 + I * cimag(modefreqs->
data[7]) / (1.5 * kt1 * exp(-(eta - 0.005) / 0.03));
1117 modefreqs->
data[6] = kk * creal(modefreqs->
data[6]) + I * cimag(modefreqs->
data[6]) / kt2;
1118 modefreqs->
data[7] = kk * creal(modefreqs->
data[7]) + I * cimag(modefreqs->
data[7]) / kt1;
1120 if (eta < 30. / 31. / 31. && chi >= 0.9) {
1123 XLAL_PRINT_INFO(
"Stas, this is case5 for pQNM eta = %f, chi = %f \n", eta, chi);
1124 sh = 0.55 - 9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
1125 kk = 0.7 + 0.3 * exp(100. * (eta - 0.25));
1126 kt1 = 0.5 * sqrt(1. + 800.0 * eta * eta / 3.0) - 0.125;
1127 kt2 = 0.5 * pow(1. + 0.5 * eta * sqrt(eta) / 0.0225, 2. / 3.) - 0.2;
1128 modefreqs->
data[4] = 1.1 * 0.4 * (1. + kk) * creal(modefreqs->
data[6])
1129 + I * cimag(modefreqs->
data[6]) / (1.05 * 2.5 * kt2 * exp(-(eta - 0.005) / 0.03));
1130 modefreqs->
data[5] = 0.4 * (1. + kk) * creal(modefreqs->
data[7])
1131 + I * cimag(modefreqs->
data[7]) / (1.05 * 1.5 * kt1 * exp(-(eta - 0.005) / 0.03));
1132 modefreqs->
data[6] = kk * creal(modefreqs->
data[6]) + I * cimag(modefreqs->
data[6]) / kt2;
1133 modefreqs->
data[7] = kk * creal(modefreqs->
data[7]) + I * cimag(modefreqs->
data[7]) / kt1;
1135 if (eta > 10. / 121. && chi >= 0.8) {
1138 XLAL_PRINT_INFO(
"Stas, this is case6 for pQNM eta = %f, chi = %f \n", eta, chi);
1139 sh = 1. - 9. * (eta - 0.25) * (1. + 2. * exp(-(chi - 0.85) * (chi - 0.85) / 0.05 / 0.05)) * (1. + 1. / (1. + exp((eta - 0.01) / 0.001)));
1140 kk = 0.7 + 0.3 * exp(100. * (eta - 0.25));
1141 kt1 = 0.45 * sqrt(1. + 200.0 * eta * eta / 3.0) - 0.125;
1142 kt2 = 0.5 * pow(1. + 0.5 * eta * sqrt(eta) / 0.0225, 2. / 3.) - 0.2;
1143 modefreqs->
data[6] = kk * creal(modefreqs->
data[6]) + I * cimag(modefreqs->
data[6]) / 0.95 / kt2;
1144 modefreqs->
data[7] = kk * creal(modefreqs->
data[7]) + I * cimag(modefreqs->
data[7]) / kt1;
1147 XLAL_PRINT_INFO(
"Stas, default (if nothing specified above) for pQNM eta = %f, chi = %f chi1 = %f \n", eta, chi, chi1);
1195 XLAL_PRINT_INFO(
"NRPeakOmega22 = %3.10f, %3.10f, %3.10f, %3.10f\n", NRPeakOmega22 * mTot /finalMass, NRPeakOmega22 / finalMass, finalMass, mTot);
1196 for (j = 0; j < nmodes; j++) {
1197 XLAL_PRINT_INFO(
"QNM frequencies: %d %d %d %3.10f %3.10f\n",
l,
m, j, creal(modefreqs->
data[j]) * mTot, 1. / cimag(modefreqs->
data[j]) / mTot);
1214 if (!modefreqs_xtr) {
1243 if ((JLN > 0.0 && JLN < 0.98) || (eta*JLN < eJL_thr && eta*JLN>0.0)){
1246 modefreqs->
data[5] = modefreqs_xtr->
data[0];
1248 modefreqs->
data[5] = conjl(-1.0 * modefreqs_xtr->
data[0]);
1252 if ((JLN < 0.0 && JLN > -0.98) || (eta*JLN > -eJL_thr && eta*JLN<0.0) ){
1266 modefreqs->
data[5] = modefreqs_xtr->
data[0];
1271 modefreqs->
data[5] = conjl(-1.0 * modefreqs->
data[5]);
1317 if ((
int)fabs((
REAL8)
m) == 1 &&
l == 2) {
1319 XLAL_PRINT_INFO(
"Stas, default (if nothing specified above) for pQNM eta = %f, chi = %f chi1 = %f \n", eta, chi, chi1);
1322 XLAL_PRINT_INFO(
"NRPeakOmega22 = %3.10f, %3.10f, %3.10f, %3.10f\n", NRPeakOmega22 * mTot /finalMass, NRPeakOmega22 / finalMass, finalMass, mTot);
1323 for (j = 0; j < nmodes; j++) {
1324 XLAL_PRINT_INFO(
"QNM frequencies: %d %d %d %3.10f %3.10f\n",
l,
m, j, creal(modefreqs->
data[j]) * mTot, 1. / cimag(modefreqs->
data[j]) / mTot);
1330 if (!modefreqs_xtr) {
1334 if ( 1==1 || (JLN < 0.0 && eta <= 0.1)){
1348 modefreqs->
data[7] = modefreqs_xtr->
data[0];
1349 modefreqs->
data[6] = NRPeakOmega22 + I/mTot/((1./cimag(modefreqs->
data[0])/mTot)/2.);
1352 modefreqs->
data[6] = conjl(-1.0 * modefreqs->
data[6]);
1353 modefreqs->
data[7] = conjl(-1.0 * modefreqs->
data[7]);
1375 if (1==0 &&(
m==1 ||
m==-1)){
1390 if (!modefreqs_xtr) {
1397 modefreqs->
data[5] = modefreqs_xtr->
data[0];
1400 if (JLN < kappa_thr || eta*JLN < eJL_thr){
1401 modefreqs->
data[6] = modefreqs_xtr->
data[1];
1402 modefreqs->
data[7] = modefreqs_xtr->
data[2];
1406 modefreqs->
data[5] = conjl(-1.0 * modefreqs_xtr->
data[0]);
1409 if (JLN < kappa_thr || eta*JLN < eJL_thr){
1410 modefreqs->
data[6] = conjl(-1.0 * modefreqs_xtr->
data[1]);
1411 modefreqs->
data[7] = conjl(-1.0 * modefreqs_xtr->
data[2]);
1430 modefreqs->
data[5] = modefreqs_xtr->
data[0];
1433 if (JLN > -1.0*kappa_thr || fabs(eta*JLN) < eJL_thr){
1434 modefreqs->
data[6] = modefreqs_xtr->
data[1];
1435 modefreqs->
data[7] = modefreqs_xtr->
data[2];
1439 modefreqs->
data[5] = conjl(-1.0 * modefreqs_xtr->
data[0]);
1442 if (JLN > -1.0*kappa_thr || fabs(eta*JLN) < eJL_thr){
1443 modefreqs->
data[6] = conjl(-1.0 * modefreqs_xtr->
data[1]);
1444 modefreqs->
data[7] = conjl(-1.0 * modefreqs_xtr->
data[2]);
1475 XLAL_PRINT_INFO(
"NRPeakOmega22 = %3.10f, %3.10f, %3.10f, %3.10f\n", NRPeakOmega22 * mTot /finalMass, NRPeakOmega22 / finalMass, finalMass, mTot);
1476 for (j = 0; j < nmodes; j++) {
1477 XLAL_PRINT_INFO(
"QNM frequencies: %d %d %d %3.10f %3.10f\n",
l,
m, j, creal(modefreqs->
data[j]) * mTot, 1. / cimag(modefreqs->
data[j]) / mTot);
1491 if (matchrange->
data[0] * mTot / dt < 5 || matchrange->
data[1] * mTot /
dt > matchrange->
data[2] * mTot /
dt - 2) {
1492 XLALPrintError(
"More inspiral points needed for ringdown matching.\n");
1516 if (!rdwave1 || !rdwave2 || !rinspwave || !dinspwave
1517 || !ddinspwave || !inspwaves1 || !inspwaves2) {
1557 for (j = 0; j < 6; j++) {
1558 inspwaves1->
data[j] = rinspwave->
data[j];
1559 inspwaves1->
data[j + 6] = dinspwave->
data[j];
1560 inspwaves1->
data[j + 12] = ddinspwave->
data[j];
1576 for (j = 0; j < 6; j++) {
1577 inspwaves2->
data[j] = rinspwave->
data[j];
1578 inspwaves2->
data[j + 6] = dinspwave->
data[j];
1579 inspwaves2->
data[j + 12] = ddinspwave->
data[j];
1612 UINT4 attachIdx = round(matchrange->
data[1] * mTot /
dt);
1613 for (j = 1; j < Nrdwave; ++j) {
1614 signal1->
data[j + attachIdx] = rdwave1->
data[j];
1615 signal2->
data[j + attachIdx] = rdwave2->
data[j];
1619 memset(signal1->
data + Nrdwave + attachIdx, 0, (signal1->
length - Nrdwave - attachIdx) *
sizeof(
REAL8));
1620 memset(signal2->
data + Nrdwave + attachIdx, 0, (signal2->
length - Nrdwave - attachIdx) *
sizeof(
REAL8));
1644 if ( indAmax == NULL || timeVec == NULL || ampWave == NULL || valAmax == NULL ) {
1651 if (timeVec->
data[
i] == tofAmax) {
1654 *valAmax = ampWave->
data[
i];
1662 printf(
" found maximum times: %f, %f \n", timeVec->
data[*indAmax], tofAmax );
1700 if ( mass1 <= 0. || mass2 <= 0.
1701 || fabs(spin1x) > 1. || fabs(spin1y) > 1. || fabs(spin1z) > 1.
1702 || fabs(spin2x) > 1. || fabs(spin2y) > 1. || fabs(spin2z) > 1.
1703 || spin1x*spin1x + spin1y*spin1y + spin1z*spin1z > 1.
1704 || spin2x*spin2x + spin2y*spin2y + spin2z*spin2z > 1.
1710 UNUSED
INT4 phasecount;
1720 REAL8 mtot = mass1 + mass2;
1721 REAL8 eta = mass1 * mass2 / (mtot * mtot);
1725 REAL8 chi1 = spin1z;
1726 REAL8 chi2 = spin2z;
1733 gsl_spline *spline0 = NULL;
1734 gsl_interp_accel *acc0 = NULL;
1739 printf(
"RDfit: we use spin1 %f, spin2 %f, and it should be dimensionless [-1,1] \n", chi1, chi2);
1740 printf(
"We use approximant = %d \n", appr);
1742 REAL8 chi = 0.5 * (chi1 + chi2) + 0.5 * (chi1 - chi2) * (mass1 - mass2)/(mass1 + mass2) / (1.0 - 2.0 * eta);
1764 sigmalm0 = (-cimag(modefreqs->
data[0]) - I * creal(modefreqs->
data[0])) * (mtot *
LAL_MTSUN_SI);
1768 printf(
"Mode %d %d \n",
l,
m);
1769 printf(
"matchpoints are: %.16f, %.16f, %.16f \n", matchrange->
data[0], matchrange->
data[1], matchrange->
data[2]);
1770 printf(
"the 0-overtone is: %.16f + i %.16f \n", creal(sigmalm0), cimag(sigmalm0));
1782 ampWave->
data[
i] = 0.0;
1783 phWave->
data[
i] = 0.0;
1786 prev = atan2(signal2->
data[0], signal1->
data[0]);
1787 phWave->
data[0] = prev;
1796 phWave->
data[
i] = phWave->
data[
i - 1] + corph;
1803 char filename2[
sizeof "CheckStasAmplPhaseXX.dat"];
1804 sprintf(filename2,
"CheckStasAmplPhase%01d%01d.dat",
l,
m);
1805 fout = fopen(filename2,
"w");
1806 printf(
"Check the length: time %d, signal %d \n", timeVec->
length, signal1->
length);
1818 if (
l == 5 &&
m==5) {
1819 tofAmax = matchrange->
data[3];
1823 if((
l == 2 &&
m == 2) || (
l == 5 &&
m == 5)){
1830 *indAmpMax = indAmax;
1833 if(
l == 5 &&
m == 5){
1834 spline0 = gsl_spline_alloc (gsl_interp_cspline, timeVec->
length);
1835 acc0 = gsl_interp_accel_alloc ();
1836 gsl_spline_init (spline0, timeVec->
data, ampWave->
data, timeVec->
length);
1837 gsl_interp_accel_reset (acc0);
1838 valdAmax = gsl_spline_eval_deriv (spline0, tofAmax, acc0);
1842 indAmax = *indAmpMax;
1843 valAmax = ampWave->
data[indAmax];
1845 spline0 = gsl_spline_alloc (gsl_interp_cspline, timeVec->
length);
1846 acc0 = gsl_interp_accel_alloc ();
1847 gsl_spline_init (spline0, timeVec->
data, ampWave->
data, timeVec->
length);
1848 gsl_interp_accel_reset (acc0);
1849 valdAmax = gsl_spline_eval_deriv (spline0, tofAmax, acc0);
1856 printf(
"Check: The maximum of amplitude is %.16e found at t=%f, index = %d (out of %d) \n", valAmax, tofAmax, indAmax, timeVec->
length);
1857 printf(
"Amp@Attachment = %.16f \n", valAmax);
1858 printf(
"dAmp@Attachment = %.16f \n", valdAmax);
1859 FILE *indMax = NULL;
1860 char filename2[
sizeof "indexMaxXXHi.dat"];
1861 sprintf(filename2,
"indexMax%01d%01dHi.dat",
l,
m);
1862 indMax = fopen (filename2,
"w");
1863 fprintf(indMax,
"%d \n",indAmax);
1880 printf(
"ampcf1 = %.16f \n", ampcf1);
1889 printf(
"ampcf2 = %.16f \n", ampcf2);
1893 if(
l == 2 &&
m == 2){
1894 if (creal(sigmalm0) > 2. * ampcf1 * tanh(ampcf2)) {
1895 ampcf1 = creal(sigmalm0) / (2. * tanh(ampcf2));
1903 printf(
"phasecf1 = %.16f \n", phasecf1);
1911 printf(
"phasecf2 = %.16f \n", phasecf2);
1922 for (
i = 0;
i < Nrdwave;
i++) {
1923 rdtime->
data[
i] =
i * dtM;
1928 REAL8 Arescaledtcons = valAmax * exp(-creal(sigmalm0) * tcons) / eta;
1929 REAL8 dtArescaledtcons = (valdAmax - creal(sigmalm0) * valAmax) * exp(-creal(sigmalm0) * tcons) / eta;
1930 REAL8 ampcc1 = dtArescaledtcons * pow(
cosh(ampcf2), 2) / ampcf1;
1931 REAL8 ampcc2 = (Arescaledtcons * ampcf1 - dtArescaledtcons *
cosh(ampcf2) * sinh(ampcf2)) / ampcf1;
1941 for (
i = 0;
i < Nrdwave;
i++) {
1942 ampRD->
data[
i] = eta * exp(creal(sigmalm0) * rdtime->
data[
i]) * (ampcc1 * tanh(ampcf1 * rdtime->
data[
i] + ampcf2) + ampcc2);
1946 char filename[
sizeof "StasAmpRD_fullXX.dat"];
1947 sprintf(
filename,
"StasAmpRD_full%01d%01d.dat",
l,
m);
1952 for (
i = 1;
i < Nrdwave;
i++) {
1959 REAL8 omegarescaledtcons = (phWave->
data[indAmax] - phWave->
data[indAmax - 1]) / dtM - cimag(sigmalm0);
1966 printf(
"omega0 = %.16f\n", phWave->
data[0]);
1969 REAL8 phasecc1 = omegarescaledtcons * (phasecf2 + 1.0) / phasecf2 / phasecf1;
1976 printf(
"phi_0 = %.16f \n", phi0);
1978 REAL8 logargnum, logargden;
1980 for (
i = 0;
i < Nrdwave;
i++) {
1981 logargnum = 1. + phasecf2 * exp(-phasecf1 * rdtime->
data[
i]);
1982 logargden = 1. + phasecf2;
1983 phRD->
data[
i] = phi0 - phasecc1 * log(logargnum / logargden) + cimag(sigmalm0) * rdtime->
data[
i];
1986 char filename[
sizeof "StasPhRD_fullXX.dat"];
1987 sprintf(
filename,
"StasPhRD_full%01d%01d.dat",
l,
m);
1992 for (
i = 1;
i < Nrdwave;
i++) {
1998 UINT4 totSz = indAmax + Nrdwave;
2006 for (
i = 0;
i < indAmax;
i++) {
2010 for (
i = 0;
i < Nrdwave;
i++) {
2011 tFull->
data[
i + indAmax] = rdtime->
data[
i] + tofAmax;
2014 fout = fopen(
"StasPhRD_full2.dat",
"w");
2015 for (
i = 0;
i < totSz;
i++) {
2020 gsl_spline *spline = NULL;
2021 gsl_interp_accel *acc = NULL;
2022 spline = gsl_spline_alloc(gsl_interp_cspline, totSz);
2023 acc = gsl_interp_accel_alloc();
2024 gsl_spline_init(spline, tFull->
data, PhFull->
data, totSz);
2025 for (
i = 0;
i < totSz;
i++) {
2026 frFull->
data[
i] = gsl_spline_eval_deriv(spline, tFull->
data[
i], acc);
2028 fout = fopen(
"StasFrRD_full.dat",
"w");
2029 for (
i = 0;
i < totSz;
i++) {
2034 gsl_spline_free(spline);
2035 gsl_interp_accel_free(acc);
2044 for (
i = 0;
i < Nrdwave;
i++) {
2049 gsl_spline_free (spline0);
2050 gsl_interp_accel_free (acc0);
INT4 XLALSimIMREOBFinalMassSpinPrec(REAL8 *finalMass, REAL8 *finalSpin, const REAL8 mass1, const REAL8 mass2, const REAL8 spin1[3], const REAL8 spin2[3], Approximant approximant)
Computes the final mass and spin of the black hole resulting from merger.
INT4 XLALSimIMREOBGenerateQNMFreqV2FromFinalPrec(COMPLEX16Vector *modefreqs, const REAL8 mass1, const REAL8 mass2, const REAL8 finalMass, REAL8 finalSpin, UINT4 l, INT4 m, UINT4 nmodes)
This function generates the quasinormal mode frequencies for a black hole ringdown.
INT4 XLALSimIMREOBGenerateQNMFreqV2Prec(COMPLEX16Vector *modefreqs, const REAL8 mass1, const REAL8 mass2, const REAL8 spin1[3], const REAL8 spin2[3], UINT4 l, INT4 m, UINT4 nmodes, Approximant approximant)
This function generates the quasinormal mode frequencies for a black hole ringdown.
static REAL8 XLALCalculateRDPhaseCoefficient1(UINT4 modeL, UINT4 modeM, REAL8 eta, REAL8 chi)
static INT4 XLALSimIMREOBHybridRingdownWave(REAL8Vector *rdwave1, REAL8Vector *rdwave2, const REAL8 dt, const REAL8 mass1, const REAL8 mass2, REAL8VectorSequence *inspwave1, REAL8VectorSequence *inspwave2, COMPLEX16Vector *modefreqs, REAL8Vector *matchrange)
Generates the ringdown wave associated with the given real and imaginary parts of the inspiral wavefo...
static REAL8 XLALCalculateRDPhaseCoefficient2(UINT4 modeL, UINT4 modeM, REAL8 eta, REAL8 chi)
static INT4 XLALGenerateHybridWaveDerivatives(REAL8Vector *rwave, REAL8Vector *dwave, REAL8Vector *ddwave, REAL8Vector *timeVec, REAL8Vector *wave, REAL8Vector *matchrange, REAL8 dt, REAL8 mass1, REAL8 mass2)
Function which calculates the value of the waveform, plus its first and second derivatives,...
static INT4 XLALSimFindIndexMaxAmpli(UINT4 *indAmax, REAL8Vector *timeVec, REAL8Vector *ampWave, REAL8 *valAmax, REAL8 tofAmax)
static REAL8 XLALCalculateRDAmplitudeCoefficient2(UINT4 modeL, UINT4 modeM, REAL8 eta, REAL8 chi)
static REAL8 XLALCalculateRDAmplitudeCoefficient1(UINT4 modeL, UINT4 modeM, REAL8 eta, REAL8 chi)
static INT4 get_major_approximant(Approximant approximant)
Translates the major approximant version into an unsigned integer to minimize if and or statements th...
static UNUSED INT4 XLALSimIMREOBHybridAttachRingdownPrec(REAL8Vector *signal1, REAL8Vector *signal2, const INT4 l, const INT4 m, const REAL8 dt, const REAL8 mass1, const REAL8 mass2, const REAL8 spin1x, const REAL8 spin1y, const REAL8 spin1z, const REAL8 spin2x, const REAL8 spin2y, const REAL8 spin2z, REAL8Vector *timeVec, REAL8Vector *matchrange, Approximant approximant, const REAL8 JLN)
The main workhorse function for performing the ringdown attachment for EOB models EOBNRv2 and SEOBNRv...
static UNUSED INT4 XLALSimIMREOBAttachFitRingdown(REAL8Vector *signal1, REAL8Vector *signal2, const INT4 l, const INT4 m, const REAL8 dt, const REAL8 mass1, const REAL8 mass2, const REAL8 spin1x, const REAL8 spin1y, const REAL8 spin1z, const REAL8 spin2x, const REAL8 spin2y, const REAL8 spin2z, const REAL8 finalM, const REAL8 finalS, REAL8Vector *timeVec, REAL8Vector *matchrange, Approximant approximant, UINT4 *indAmpMax)
The main function for performing the ringdown attachment for SEOBNRv4 (and beyond) This is the functi...
static UNUSED REAL8 XLALSimIMREOBGetNRSpinPeakOmega(INT4 UNUSED l, INT4 UNUSED m, REAL8 UNUSED eta, REAL8 a)
Peak frequency predicted by fitting NR results (currently only 2,2 available).
static UNUSED REAL8 XLALSimIMREOBGetNRSpinPeakOmegav2(INT4 UNUSED l, INT4 UNUSED m, REAL8 UNUSED eta, REAL8 a)
Peak frequency predicted by fitting NR results (currently only 2,2 available).
static UNUSED REAL8 XLALSimIMREOBGetNRSpinPeakOmegaV4(INT4 modeL, INT4 modeM, REAL8 UNUSED eta, REAL8 a)
Peak frequency predicted by fitting NR results The coefficients for the (2,2) are in Eq.
#define XLAL_CALLGSL(statement)
REAL8VectorSequence * XLALCreateREAL8VectorSequence(UINT4 length, UINT4 veclen)
void XLALDestroyREAL8VectorSequence(REAL8VectorSequence *vecseq)
#define EOB_RD_EFOLDS
The number of e-folds of ringdown which should be attached for EOBNR models.
Approximant
Enum that specifies the PN approximant to be used in computing the waveform.
@ SEOBNRv2
Spin-aligned EOBNR model v2.
@ SEOBNRv1
Spin-aligned EOBNR model.
@ SEOBNRv3
Spin precessing EOBNR model v3.
@ SEOBNRv3_opt
Optimized Spin precessing EOBNR model v3.
COMPLEX16Vector * XLALCreateCOMPLEX16Vector(UINT4 length)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
void XLALDestroyCOMPLEX16Vector(COMPLEX16Vector *vector)
#define XLAL_PRINT_INFO(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_PRINT_ERROR(...)