Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInference 4.1.8.1-02cf16d
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALInferenceBurstRoutines.c
Go to the documentation of this file.
1/*
2 * LALInferenceBurst.c:
3 * Contains burst specific routines (used by LIB)
4 * They are here rather than in lalsimulation or lalburst so that they won't inferfeere with other people work
5 * They may be migrated once proven to be fully reliable.
6 * I (salvo) will open redmine tickets for all this changes and move the relative functions from here to there
7 * once each is accepted.
8 *
9 * Copyright (C) 2015 Salvatore Vitale
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with with program; see the file COPYING. If not, write to the
23 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 * MA 02110-1301 USA
25 */
26
27#include <config.h>
28#include <string.h>
29#include <math.h>
30#include <gsl/gsl_rng.h>
31#include <gsl/gsl_randist.h>
32#include <lal/LALSimBurst.h>
33#include <lal/LALConstants.h>
34#include <lal/FrequencySeries.h>
35#include <lal/Sequence.h>
36#include <lal/TimeFreqFFT.h>
37#include <lal/TimeSeries.h>
38#include <lal/RealFFT.h>
39#include <lal/Units.h>
40#include <lal/Date.h>
41#include <lal/LALInferenceBurstRoutines.h>
42
43#define LAL_PI_1_2 1.7724538509055160272981674833411451 /* sqrt of PI */
44#define LAL_PI_1_4 1.3313353638003897127975349179502808 /* PI^1/4 */
45#define LAL_4RT2 1.1892071150027210667174999705604759 /* 2^(1/4) */
46#define FRTH_2_Pi 0.8932438417380023314010427521746490 /* (2/Pi)^(1/4)*/
47#define FRTH_2_times_PI 1.5832334870861595385799030344545584 /* (2*Pi)^(1/4)*/
48#define LAL_SQRT_PI 1.7724538509055160272981674833411451 /* sqrt of PI */
49
50/*
51 * * * compute semimajor and semiminor axes lengths from eccentricity assuming
52 * * * that a^2 + b^2 = 1. eccentricity is e = \sqrt{1 - (b / a)^2}. from
53 * * * those two constraints the following expressions are obtained.
54 * * */
55
56
57static void semi_major_minor_from_e(double e, double *a, double *b)
58{
59 double e2 = e * e;
60
61 *a = 1.0 / sqrt(2.0 - e2);
62 *b = *a * sqrt(1.0 - e2);
63}
64
66{
67 if ( !inString )
69 if ( strstr(inString, "SineGaussianF" ) )
70 {
71 return SineGaussianF;
72 }
73 else if ( strstr(inString, "SineGaussian" ) )
74 {
75 return SineGaussian;
76 }
77 else if ( strstr(inString, "GaussianF" ) )
78 {
79 return GaussianF;
80 }
81 else if ( strstr(inString, "Gaussian" ) )
82 {
83 return Gaussian;
84 }
85 else if ( strstr(inString, "DampedSinusoidF" ) )
86 {
87 return DampedSinusoidF;
88 }
89 else if ( strstr(inString, "DampedSinusoid" ) )
90 {
91 return DampedSinusoid;
92 }
93 else
94 {
95 XLALPrintError( "Cannot parse burst approximant from string: %s \n", inString );
97 }
98}
99
100/* FIXME ORDER*/
102{
103 if ( !inString )
105 if ( strstr(inString, "Gaussian" ) )
106 return 1;
107 else if ( strstr(inString, "GaussianF" ) )
108 return 1;
109 else if ( strstr(inString, "SineGaussian" ) )
110 return 1;
111 else if ( strstr(inString, "SineGaussianF" ) )
112 return 1;
113 else if ( strstr(inString, "DampedSinusoid" ) )
114 return 1;
115 else if ( strstr(inString, "DampedSinusoidF" ) )
116 return 1;
117 else if (strstr(inString,"RingdownF") )
118 return 1;
119 else
120 return 0;
121}
122
124 BurstApproximant approximant /**< Burst approximant (see enum in LALSimBurst.h) */
125 )
126{
127 switch (approximant)
128 {
129 case SineGaussian:
130 case Gaussian:
131 case DampedSinusoid:
132 return 1;
133
134 default:
135 return 0;
136 }
137}
138
139/**
140 * Checks whether the given approximant is implemented in lalsimulation's XLALSimInspiralChooseFDWaveform().
141 *
142 * returns 1 if the approximant is implemented, 0 otherwise.
143 */
145 BurstApproximant approximant /**< Burst approximant (see enum in LALSimBurst.h) */
146 )
147{
148 switch (approximant)
149 {
150 case SineGaussianF:
151 case RingdownF:
152 case DampedSinusoidF:
153 case GaussianF:
154 return 1;
155 default:
156 return 0;
157 }
158}
159
160/* Tentative common interface to burst FD WF. Pass all standard burst parameters (as in sim_burst table).
161 * Parameters which are not defined for the WF of interest will be ignored.
162 * Unconventional parameters can be passed through extraParams
163 *
164 * Returned waveforms are centered at t=0, thus must be time shifted to wanted time.
165 * No taper, windowing, etc, is applied. The caller must take care of that.
166 *
167 * */
169 COMPLEX16FrequencySeries **hptilde, /**< FD plus polarization */
170 COMPLEX16FrequencySeries **hctilde, /**< FD cross polarization */
171 REAL8 deltaF, /**< sampling interval (Hz) */
172 REAL8 deltaT, /**< time step corresponding to consec */
173 REAL8 f0, /**< central frequency (Hz) */
174 REAL8 q, /**< Q (==sqrt(2) \f$\pi\f$ f0 tau ) [dless]*/
175 REAL8 tau, /**< Duration [s] */
176 REAL8 f_min, /**< starting GW frequency (Hz) */
177 REAL8 f_max, /**< ending GW frequency (Hz) (0 for Nyquist) */
178 REAL8 hrss, /**< hrss [strain] */
179 REAL8 polar_angle, /**< Polar_ellipse_angle as defined in the burst table. Together with polar_ellipse_eccentricity below will fix the ratio of + vs x amplitude. */
180 REAL8 polar_ecc, /**< See above */
181 LALSimBurstExtraParam *extraParams, /**< Linked list of extra burst parameters. Pass in NULL (or None in python) to neglect these */
182 BurstApproximant approximant /**< Burst approximant */
183 )
184{
185 /* General sanity check the input parameters - only give warnings! */
186 if( deltaF > 1. )
187 XLALPrintWarning("XLAL Warning - %s: Large value of deltaF = %e requested...This corresponds to a very short TD signal (with padding). Consider a smaller value.\n", __func__, deltaF);
188 if( deltaF < 1./4096. )
189 XLALPrintWarning("XLAL Warning - %s: Small value of deltaF = %e requested...This corresponds to a very long TD signal. Consider a larger value.\n", __func__, deltaF);
190 if( f_min < 1. )
191 XLALPrintWarning("XLAL Warning - %s: Small value of fmin = %e requested...Check for errors, this could create a very long waveform.\n", __func__, f_min);
192 if( f_min > 40.000001 )
193 XLALPrintWarning("XLAL Warning - %s: Large value of fmin = %e requested...Check for errors, the signal will start in band.\n", __func__, f_min);
194 int ret;
195 (void) extraParams;
196 switch (approximant)
197 {
198 case SineGaussianF:
199 /* Waveform-specific sanity checks */
200 /* None so far */
201 (void) f_max;
202 (void) tau;
203 /* Call the waveform driver routine */
204 ret = XLALInferenceBurstSineGaussianF(hptilde,hctilde,q,f0,hrss,polar_ecc, polar_angle,deltaF,deltaT);
206 break;
207 case GaussianF:
208 /* Waveform-specific sanity checks */
209 /* None so far */
210 (void) f_max;
211 (void) polar_ecc;
212 (void) f0;
213 (void) q;
214 /* Call the waveform driver routine */
215 ret = XLALInferenceBurstGaussianF(hptilde,hctilde,tau,hrss, polar_angle,deltaF,deltaT);
217 break;
218 case DampedSinusoidF:
219 /* Waveform-specific sanity checks */
220 /* None so far */
221 (void) f_max;
222 (void) tau;
223 /* Call the waveform driver routine */
224 ret = XLALInferenceBurstDampedSinusoidF(hptilde,hctilde,q,f0,hrss,polar_ecc, polar_angle,deltaF,deltaT);
226 break;
227 default:
228 XLALPrintError("FD version of burst approximant not implemented in lalsimulation\n");
230 }
231
233
234 return ret;
235}
236
237/* Tentative common interface to burst FD WF. Pass all standard burst parameters (as in sim_burst table).
238 * Parameters which are not defined for the WF of interest can be passe as NULL.
239 * Unconventional parameters can be passed through extraParams
240 *
241 * Returned waveforms are centered at t=0, thus must be time shifted to wanted time.
242 * No taper, windowing, etc, is applied. The caller must take care of that.
243 *
244 * */
246 REAL8TimeSeries **hplus, /**< +-polarization waveform */
247 REAL8TimeSeries **hcross, /**< x-polarization waveform */
248 REAL8 deltaT, /**< time step corresponding to consec */
249 REAL8 f0, /**< central frequency (Hz) */
250 REAL8 q, /**< Q (==sqrt(2) \f$\pi\f$ f0 tau ) [dless]*/
251 REAL8 tau, /**< Duration [s] */
252 REAL8 f_min, /**< starting GW frequency (Hz) */
253 REAL8 f_max, /**< ending GW frequency (Hz) (0 for Nyquist) */
254 REAL8 hrss, /**< hrss [strain] */
255 REAL8 polar_angle, /**< Polar_ellipse_angle as defined in the burst table. Together with polar_ellipse_eccentricity below will fix the ratio of + vs x amplitude.*/
256 REAL8 polar_ecc, /**< See above */
257 LALSimBurstExtraParam *extraParams, /**< Linked list of non-GR parameters. Pass in NULL (or None in python) to neglect these */
258 BurstApproximant approximant /**< Burst approximant */
259 )
260{
261 /* General sanity check the input parameters - only give warnings! */
262 if( f_min < 1. )
263 XLALPrintWarning("XLAL Warning - %s: Small value of fmin = %e requested...Check for errors, this could create a very long waveform.\n", __func__, f_min);
264 if( f_min > 40.000001 )
265 XLALPrintWarning("XLAL Warning - %s: Large value of fmin = %e requested...Check for errors, the signal will start in band.\n", __func__, f_min);
266 int ret;
267 (void) extraParams;
268 switch (approximant)
269 {
270 case SineGaussian:
271 /* Waveform-specific sanity checks */
272 /* None so far */
273
274 (void) f_max;
275 (void) tau;
276 /* Call the waveform driver routine */
277 ret = XLALInferenceBurstSineGaussian(hplus,hcross,q,f0,hrss,polar_ecc ,polar_angle,deltaT);
279 break;
280 case Gaussian:
281 /* Waveform-specific sanity checks */
282 /* None so far */
283 (void) f_max;
284 (void) f0;
285 (void) q;
286
287 /* Call the waveform driver routine */
288 ret = XLALInferenceBurstGaussian(hplus,hcross,tau,hrss,polar_ecc ,polar_angle,deltaT);
290 break;
291 case DampedSinusoid:
292 /* Waveform-specific sanity checks */
293 /* None so far */
294 (void) f_max;
295 (void) tau;
296
297 /* Call the waveform driver routine */
298 ret = XLALInferenceBurstDampedSinusoid(hplus,hcross,q,f0,hrss,polar_ecc ,polar_angle,deltaT);
300 break;
301 default:
302 XLALPrintError("TD version of burst approximant not implemented in lalsimulation\n");
304 }
305
307
308 return ret;
309}
310
311/**
312 * XLAL function to determine string from approximant enum.
313 * This function needs to be updated when new approximants are added.
314 */
316{
317 switch (bapproximant)
318 {
319 case SineGaussianF:
320 return strdup("SineGaussianF");
321 case SineGaussian:
322 return strdup("SineGaussian");
323 case GaussianF:
324 return strdup("GaussianF");
325 case Gaussian:
326 return strdup("Gaussian");
327 case DampedSinusoidF:
328 return strdup("DampedSinusoidF");
329 case DampedSinusoid:
330 return strdup("DampedSinusoid");
331 default:
332 XLALPrintError("Not a valid approximant\n");
334 }
335}
336
337/* ================================ WAVEFORMS ==================================*/
338
339
340/*
341 * ============================================================================
342 *
343 * (Sine)-Gaussian and Friends
344 *
345 * ============================================================================
346 */
347
348
349
350/**
351 * Input:
352 *
353 * Q: the "Q" of the waveform. The Gaussian envelope is \f$exp(-1/2 t^{2} /
354 * \sigma_{t}^{2})\f$ where \f$\sigma_{t} = Q / (2 \pi f)\f$. High Q --> long
355 * duration.
356 *
357 * centre_frequency: the frequency of the sinusoidal oscillations that
358 * get multiplied by the Gaussian envelope.
359 *
360 * hrss: the root-sum-squares strain of the waveform (summed over both
361 * polarizations). See K. Riles, LIGO-T040055-00.pdf.
362 *
363 * eccentricity: 0 --> circularly polarized, 1 --> linearly polarized.
364 *
365 * polarization: the angle from the + axis to the major axis of the
366 * waveform ellipsoid. with the eccentricity set to 1 (output is linearly
367 * polarized): 0 --> output contains + polarization only; pi/2 --> output
368 * contains x polarization only. with the eccentricity set to 0 (output is
369 * circularly polarized), the polarization parameter is irrelevant.
370 *
371 * Output:
372 *
373 * h+ and hx time series containing a cosine-Gaussian in the + polarization
374 * and a sine-Gaussian in the x polarization. The Gaussian envelope peaks
375 * in both at t = 0 as defined by epoch and deltaT. Note that a Tukey
376 * window with tapers covering 50% of the time series is applied to make
377 * the waveform go to 0 smoothly at the start and end.
378 */
379
380
382 REAL8TimeSeries **hplus,
383 REAL8TimeSeries **hcross,
384 REAL8 Q,
385 REAL8 centre_frequency,
386 REAL8 hrss,
387 REAL8 eccentricity,
388 REAL8 phase,
389 REAL8 delta_t // 1 over srate
390)
391{
392
393 REAL8 cp=cos(phase);
394 REAL8 sp=sin(phase);
395 /* rss of plus and cross polarizations */
396
397 REAL8 a,b;
398 semi_major_minor_from_e(eccentricity, &a, &b);
399 REAL8 eqq=exp(-Q*Q);
400 const double cgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 + eqq);
401 const double sgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 - eqq);
402 /* "peak" amplitudes of plus and cross */
403 double h0plus = hrss * a / sqrt(cgsq * cp*cp + sgsq * sp*sp);
404 double h0cross = hrss * b / sqrt(cgsq * sp*sp + sgsq * cp*cp);
405
407 int length;
408 unsigned i;
409 const REAL8 max_sigmas=6.0;
410 /* length of the injection time series is 3 * the width of the
411 * Gaussian envelope (sigma_t in the comments above), rounded to
412 * the nearest odd integer */
413
414 length = (int) floor(max_sigmas * Q / (LAL_TWOPI * centre_frequency) / delta_t / 2.0); // This is 21 tau
415 length = 2 * length + 1; // length is 6taus +1 bin
416 /* the middle sample is t = 0 */
417
418 XLALGPSSetREAL8(&epoch, -(length - 1) / 2 * delta_t); // epoch is set to minus (30 taus) in secs
419
420 /* allocate the time series */
421
422 *hplus = XLALCreateREAL8TimeSeries("sine-Gaussian +", &epoch, 0.0, delta_t, &lalStrainUnit, length); // hplus epoch=-21tau length = 6tau+1
423 *hcross = XLALCreateREAL8TimeSeries("sine-Gaussian x", &epoch, 0.0, delta_t, &lalStrainUnit, length); // hplus epoch=-21tau length = 6tau+1
424 if(!*hplus || !*hcross) {
427 *hplus = *hcross = NULL;
429 }
430
431 /* populate */
432 double t=0.0;
433 double phi=0.0;
434 double fac=0.0;
435 REAL8 twopif=LAL_TWOPI * centre_frequency;
436
437 for(i = 0; i < (*hplus)->data->length; i++) {
438 t = ((REAL8) i - ((REAL8)length - 1.) / 2.) * delta_t; // t in [-21 tau, ??]
439 phi = twopif * t; // this is the actual time, not t0
440 fac = exp(-0.5 * phi * phi / (Q * Q));
441 (*hplus)->data->data[i] = h0plus * fac*cos(phi-phase);
442 (*hcross)->data->data[i] = h0cross * fac*sin(phi-phase) ;
443 }
444
445 return 0;
446}
447
448/* Frequency domain SineGaussians (these are the exact analytic Fourier Transform of the LIB time domain SG.
449 *
450 * See https://dcc.ligo.org/LIGO-T1400734
451 * SALVO: fix documentation
452 * */
453
457 REAL8 Q,
458 REAL8 centre_frequency,
459 REAL8 hrss,
460 REAL8 eccentricity,
461 REAL8 phase,
464)
465{
466 REAL8 cp=cos(phase);
467 REAL8 sp=sin(phase);
468 /* rss of plus and cross polarizations */
469
470 REAL8 a,b;
471 semi_major_minor_from_e(eccentricity, &a, &b);
472 REAL8 eqq=exp(-Q*Q);
473 const double cgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 + eqq);
474 const double sgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 - eqq);
475 /* "peak" amplitudes of plus and cross */
476 double h0plus = hrss * a / sqrt(cgsq * cp*cp + sgsq * sp*sp);
477 double h0cross = hrss * b / sqrt(cgsq * sp*sp + sgsq * cp*cp);
478
480 int length;
481 unsigned i;
482 const REAL8 max_sigmas=6.0;
483 /* length of the injection time series is max_sigmas * the width of the
484 * time domain Gaussian envelope rounded to the nearest odd integer */
485 length = (int) floor(max_sigmas * Q / (LAL_TWOPI * centre_frequency) / deltaT / 2.0); // This is 3 tau_t
486 length = 2 * length + 1; // length is 6 taus +1 bin
487 XLALGPSSetREAL8(&epoch, -(length - 1) / 2 * deltaT); // epoch is set to minus (30 taus_t) in secs
488
489
490 REAL8 tau=Q/LAL_PI/LAL_SQRT2/centre_frequency;
491 REAL8 tau2pi2=tau*tau*LAL_PI*LAL_PI;
492
493 /* sigma is the width of the gaussian envelope in the freq domain WF ~ exp(-1/2 X^2/sigma^2)*/
494 REAL8 sigma= centre_frequency/Q; // This is also equal to 1/(sqrt(2) Pi tau)
495
496 /* set fmax to be f0 + 3sigmas*/
497 REAL8 Fmax=centre_frequency +max_sigmas*sigma;
498 /* if fmax > nyquist use nyquist */
499 if (Fmax>(1.0/(2.0*deltaT)))
500 Fmax=1.0/(2.0*deltaT);
501
502 REAL8 Fmin= centre_frequency -max_sigmas*sigma;
503 /* if fmin <0 use 0 */
504 if (Fmin<0.0 || Fmin >=Fmax)
505 Fmin=0.0;
506
507 size_t lower =(size_t) ( Fmin/deltaF);
508 size_t upper= (size_t) ( Fmax/deltaF+1);
509
512
513 /* the middle sample is t = 0 */
515 hctilde=XLALCreateCOMPLEX16FrequencySeries("hcross",&epoch,0.0,deltaF,&lalStrainUnit,upper);
516
517 if(!hptilde || !hctilde) {
520 hctilde=hptilde = NULL;
522 }
523 /* Set to zero below flow */
524 for(i = 0; i < hptilde->data->length; i++) {
525 hptilde->data->data[i] = 0.0;
526 hctilde->data->data[i] = 0.0;
527 }
528
529 /* populate */
530 REAL8 f=0.0;
531 REAL8 phi2minus=0.0;
532 REAL8 ephimin=0.0;
533 h0plus*=tau/LAL_2_SQRTPI;
534 h0cross*=-tau/LAL_2_SQRTPI;
535 for(i = lower; i < upper; i++) {
536 f=((REAL8 ) i )*deltaF;
537 phi2minus= (f-centre_frequency )*(f-centre_frequency );
538 ephimin=exp(-phi2minus*tau2pi2);
539 hptilde->data->data[i] = crect(cp*h0plus*ephimin,-h0plus*ephimin*sp);
540 // exp(-I phi) gives a -I sin(phi), which gets multiplied by the -I already there, giving a - sign, which is already take care of in h0cross a couple of lines above
541 hctilde->data->data[i] = crect(h0cross*ephimin*sp,h0cross*ephimin*cp);
542
543 }
544
545 *hplus=hptilde;
546 *hcross=hctilde;
547
548 return XLAL_SUCCESS;
549}
550
551
552/* Frequency domain SineGaussians (these are the exact analytic Fourier Transform of the LIB time domain SG.
553 *
554 * See https://dcc.ligo.org/LIGO-T1400734
555 * SALVO: fix documentation
556 * */
557
561 REAL8 Q,
562 REAL8 centre_frequency,
563 REAL8 hrss,
564 REAL8 eccentricity,
565 REAL8 phase,
568)
569{
570 REAL8 cp=cos(phase);
571 REAL8 sp=sin(phase);
572 /* rss of plus and cross polarizations */
573
574 REAL8 a,b;
575 semi_major_minor_from_e(eccentricity, &a, &b);
576 REAL8 eqq=exp(-Q*Q);
577 const double cgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 + eqq);
578 const double sgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 - eqq);
579 /* "peak" amplitudes of plus and cross */
580 double h0plus = hrss * a / sqrt(cgsq * cp*cp + sgsq * sp*sp);
581 double h0cross = hrss * b / sqrt(cgsq * sp*sp + sgsq * cp*cp);
582
584 int length;
585 unsigned i;
586 const REAL8 max_sigmas=3.0;
587 /* length of the injection time series is max_sigmas * the width of the
588 * time domain Gaussian envelope rounded to the nearest odd integer */
589 length = (int) floor(max_sigmas * Q / (LAL_TWOPI * centre_frequency) / deltaT / 2.0); // This is 3 tau_t
590 length = 2 * length + 1; // length is 6 taus +1 bin
591 XLALGPSSetREAL8(&epoch, -(length - 1) / 2 * deltaT); // epoch is set to minus (30 taus_t) in secs
592
593
594 REAL8 tau=Q/LAL_PI/LAL_SQRT2/centre_frequency;
595 REAL8 tau2pi2=tau*tau*LAL_PI*LAL_PI;
596
597 /* sigma is the width of the gaussian envelope in the freq domain WF ~ exp(-1/2 X^2/sigma^2)*/
598 REAL8 sigma= centre_frequency/Q; // This is also equal to 1/(sqrt(2) Pi tau)
599
600 /* set fmax to be f0 + 3sigmas*/
601 REAL8 Fmax=centre_frequency +max_sigmas*sigma;
602 /* if fmax > nyquist use nyquist */
603 if (Fmax>(1.0/(2.0*deltaT)))
604 Fmax=1.0/(2.0*deltaT);
605
606 REAL8 Fmin= centre_frequency -max_sigmas*sigma;
607 /* if fmin <0 use 0 */
608 if (Fmin<0.0 || Fmin >=Fmax)
609 Fmin=0.0;
610
611 size_t lower =(size_t) ( Fmin/deltaF);
612 size_t upper= (size_t) ( Fmax/deltaF+1);
613
616
617 /* the middle sample is t = 0 */
618 hptilde=XLALCreateCOMPLEX16FrequencySeries("hplus",&epoch,Fmin,deltaF,&lalStrainUnit,upper);
619 hctilde=XLALCreateCOMPLEX16FrequencySeries("hcross",&epoch,Fmin,deltaF,&lalStrainUnit,upper);
620
621 if(!hptilde || !hctilde) {
624 hctilde=hptilde = NULL;
626 }
627 /* Set to zero below flow */
628 for(i = 0; i < hptilde->data->length; i++) {
629 hptilde->data->data[i] = 0.0;
630 hctilde->data->data[i] = 0.0;
631 }
632
633 /* populate */
634 REAL8 f=0.0;
635 REAL8 phi2minus=0.0;
636 REAL8 ephimin=0.0;
637 h0plus*=tau/LAL_2_SQRTPI;
638 h0cross*=-tau/LAL_2_SQRTPI;
639 for(i = 0; i < upper; i++) {
640 f=((REAL8 ) i +lower )*deltaF;
641 phi2minus= (f-centre_frequency )*(f-centre_frequency );
642 ephimin=exp(-phi2minus*tau2pi2);
643 hptilde->data->data[i] = crect(cp*h0plus*ephimin,-h0plus*ephimin*sp);
644 // exp(-I phi) gives a -I sin(phi), which gets multiplied by the -I already there, giving a - sign, which is already take care of in h0cross a couple of lines above
645 hctilde->data->data[i] = crect(h0cross*ephimin*sp,h0cross*ephimin*cp);
646
647 }
648
649 *hplus=hptilde;
650 *hcross=hctilde;
651
652 return XLAL_SUCCESS;
653}
654
655/*
656 * We produce time domain gaussian WFs having the form:
657 *
658 * h_x=C (hrss /sqrt(tau)) (2/Pi)^1/4 exp(-t^2/tau^2)
659 * h_x=P (hrss /sqrt(tau)) (2/Pi)^1/4 exp(-t^2/tau^2)
660 *
661 * See https://dcc.ligo.org/LIGO-T1400734
662 * */
664 REAL8TimeSeries **hplus,
665 REAL8TimeSeries **hcross,
666 REAL8 duration,
667 REAL8 hrss,
668 REAL8 eccentricity,
669 REAL8 polarization,
670 REAL8 delta_t // 1 over srate
671)
672{
673 (void) eccentricity;
674 /* semimajor and semiminor axes of waveform ellipsoid */
675 /* rss of plus and cross polarizations */
676 const double hplusrss = hrss * cos(polarization);
677 const double hcrossrss = hrss * sin(polarization);
678 REAL8 sdur=sqrt(duration);
679 /* "peak" amplitudes of plus and cross */
680 const double h0plus = hplusrss /sdur*FRTH_2_Pi ;
681 const double h0cross = hcrossrss/sdur*FRTH_2_Pi;
682
684 int length;
685 unsigned i;
686
687 /* length of the injection time series is 6 * the width of the
688 * Gaussian envelope (sigma_t in the comments above), rounded to
689 * the nearest odd integer */
690
691 length = (int) floor(6.0 *duration/delta_t);// This is 6 tau
692 length = 2 * length + 1; // length is 12 taus +1 bin
693 /* the middle sample is t = 0 */
694
695 XLALGPSSetREAL8(&epoch, -(length - 1) / 2 * delta_t); // epoch is set to minus (12 taus) in secs
696
697 /* allocate the time series */
698
699 *hplus = XLALCreateREAL8TimeSeries("Gaussian +", &epoch, 0.0, delta_t, &lalStrainUnit, length); // hplus epoch=-30tau length = 60tau+1
700 *hcross = XLALCreateREAL8TimeSeries("Gaussian x", &epoch, 0.0, delta_t, &lalStrainUnit, length); // hplus epoch=-30tau length = 60tau+1
701 if(!*hplus || !*hcross) {
704 *hplus = *hcross = NULL;
706 }
707
708 /* populate */
709 double t=0.0;
710 double fac=0.0;
711 for(i = 0; i < (*hplus)->data->length; i++) {
712 t = ((int) i - (length - 1) / 2) * delta_t; // t in [-6 tau, ??]
713 fac = exp(-t*t/duration/duration); // centered around zero. Time shift will be applied later by the caller
714 (*hplus)->data->data[i] = h0plus *fac;
715 (*hcross)->data->data[i] = h0cross*fac;
716 }
717
718 return 0;
719}
720
721/* Frequency domain Gaussians (these are the exact analytic Fourier Transform of the time domain Gaussians.
722 *
723 * See https://dcc.ligo.org/LIGO-T1400734
724 *
725 * */
729 REAL8 duration,
730 REAL8 hrss,
731 REAL8 phase,
734)
735{
736 /* semimajor and semiminor axes of waveform ellipsoid */
737 /* rss of plus and cross polarizations */
738 const double hplusrss = hrss * cos(phase);
739 const double hcrossrss = hrss * sin(phase);
740
741 REAL8 sdur=sqrt(duration);
742 /* "peak" amplitudes of plus and cross */
743 const double h0plus = hplusrss *sdur*FRTH_2_times_PI;
744 const double h0cross = hcrossrss *sdur*FRTH_2_times_PI;
746 int length;
747 unsigned i;
748
749 /* length of the injection time series is 30 * the width of the
750 * Gaussian envelope rounded to the nearest odd integer */
751
752 length = (int) floor(6.0 *duration/deltaT); // This is 6 tau
753 length = 2 * length + 1; // length is 12 taus +1 bin
754 XLALGPSSetREAL8(&epoch, -(length - 1) / 2 * deltaT); // epoch is set to minus (6 taus_t) in secs
755
756 /* sigma is the width of the gaussian envelope in the freq domain */
758
759 REAL8 Fmax=1.0/(2.0*deltaT);
760 size_t upper= (size_t) ( Fmax/deltaF+1);
761
764
765 /* the middle sample is t = 0 */
767 hctilde=XLALCreateCOMPLEX16FrequencySeries("hcross",&epoch,0.0,deltaF,&lalStrainUnit,upper);
768
769 if(!hptilde || !hctilde) {
772 hctilde=hptilde = NULL;
774 }
775
776 /* populate */
777 REAL8 f=0.0;
778 REAL8 phi=0.0;
779 REAL8 ephi=0.0;
780 for(i = 0; i < upper; i++) {
781 f=((REAL8 ) i )*deltaF;
782 phi=f*f/sigma2;
783 ephi=exp(-0.5*phi);
784 hptilde->data->data[i] = h0plus *ephi;
785 hctilde->data->data[i] = h0cross*ephi;
786 }
787
788 *hplus=hptilde;
789 *hcross=hctilde;
790 return XLAL_SUCCESS;
791}
792
793
794
795/*
796 * ============================================================================
797 *
798 * Construct a Damped Sinusoid waveform
799 *
800 * ============================================================================
801 */
802
804 REAL8TimeSeries **hplus,
805 REAL8TimeSeries **hcross,
806 REAL8 Q,
807 REAL8 centre_frequency,
808 REAL8 hrss,
809 REAL8 eccentricity,
810 REAL8 phase,
811 REAL8 delta_t // 1 over srate
812)
813{
814
815 REAL8 cp=cos(phase);
816 REAL8 sp=sin(phase);
817 /* rss of plus and cross polarizations */
818
819 REAL8 a,b;
820 semi_major_minor_from_e(eccentricity, &a, &b);
821 REAL8 eqq=exp(-Q*Q);
822 const double cgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 + eqq);
823 const double sgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 - eqq);
824 /* "peak" amplitudes of plus and cross */
825 double h0plus = hrss * a / sqrt(cgsq * cp*cp + sgsq * sp*sp);
826 double h0cross = hrss * b / sqrt(cgsq * sp*sp + sgsq * cp*cp);
827
829 int length;
830 unsigned i;
831 const REAL8 max_sigmas=12.0;
832 /* length of the injection time series is 3 * the width of the
833 * Gaussian envelope (sigma_t in the comments above), rounded to
834 * the nearest odd integer */
835
836 length = (int) floor(max_sigmas * Q / (LAL_TWOPI * centre_frequency) / delta_t / 2.0); // This is 21 tau
837 length = 2 * length + 1; // length is 6taus +1 bin
838 /* the middle sample is t = 0 */
839
840 XLALGPSSetREAL8(&epoch, -(length - 1) / 2 * delta_t); // epoch is set to minus (30 taus) in secs
841
842 /* allocate the time series */
843
844 *hplus = XLALCreateREAL8TimeSeries("DS-Gaussian +", &epoch, 0.0, delta_t, &lalStrainUnit, length); // hplus epoch=-21tau length = 6tau+1
845 *hcross = XLALCreateREAL8TimeSeries("DS-Gaussian x", &epoch, 0.0, delta_t, &lalStrainUnit, length); // hplus epoch=-21tau length = 6tau+1
846 if(!*hplus || !*hcross) {
849 *hplus = *hcross = NULL;
851 }
852
853 /* populate */
854 double t=0.0;
855 double phi=0.0;
856 double fac=0.0;
857 REAL8 twopif=LAL_TWOPI * centre_frequency;
858
859 for(i = 0; i < (*hplus)->data->length; i++) {
860 t = ((REAL8) i - ((REAL8)length - 1.) / 2.) * delta_t; // t in [-21 tau, ??]
861 phi = twopif * t; // this is the actual time, not t0
862 fac = exp(-0.5 *phi /Q);
863 (*hplus)->data->data[i] = h0plus * fac*cos(phi-phase);
864 (*hcross)->data->data[i] = h0cross * fac*sin(phi-phase) ;
865 }
866
867 return 0;
868}
869
870
874 REAL8 Q,
875 REAL8 centre_frequency,
876 REAL8 hrss,
877 REAL8 eccentricity,
878 REAL8 phase,
881)
882{
883
884 REAL8 cp=cos(phase);
885 REAL8 sp=sin(phase);
886 /* rss of plus and cross polarizations */
887
888 REAL8 a,b;
889 semi_major_minor_from_e(eccentricity, &a, &b);
890 REAL8 eqq=exp(-Q*Q);
891 const double cgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 + eqq);
892 const double sgsq = Q / (4.0 * centre_frequency * LAL_SQRT_PI) * (1.0 - eqq);
893 /* "peak" amplitudes of plus and cross */
894 double h0plus = hrss * a / sqrt(cgsq * cp*cp + sgsq * sp*sp);
895 double h0cross = hrss * b / sqrt(cgsq * sp*sp + sgsq * cp*cp);
896
898int length;
899unsigned i;
900const REAL8 max_sigmas=12.0;
901/* length of the injection time series is 3 * the width of the
902 * Gaussian envelope (sigma_t in the comments above), rounded to
903 * the nearest odd integer */
904
905length = (int) floor(max_sigmas * Q / (LAL_TWOPI * centre_frequency) / deltaT / 2.0); // This is 21 tau
906length = 2 * length + 1; // length is 6taus +1 bin
907/* the middle sample is t = 0 */
908
909XLALGPSSetREAL8(&epoch, -(length - 1) / 2 * deltaT); // epoch is set to minus (30 taus) in secs
910/* sigma is the width of the gaussian envelope in the freq domain WF ~ exp(-1/2 X^2/sigma^2)*/
911 REAL8 sigma= centre_frequency/Q; // This is also equal to 1/(sqrt(2) Pi tau)
912
913 /* set fmax to be f0 + 3sigmas*/
914 REAL8 Fmax=centre_frequency +max_sigmas*sigma;
915 /* if fmax > nyquist use nyquist */
916 if (Fmax>(1.0/(2.0*deltaT)))
917 Fmax=1.0/(2.0*deltaT);
918
919 REAL8 Fmin= centre_frequency -max_sigmas*sigma;
920 /* if fmin <0 use 0 */
921 if (Fmin<0.0 || Fmin >=Fmax)
922 Fmin=0.0;
923
924 size_t lower =(size_t) ( Fmin/deltaF);
925 size_t upper= (size_t) ( Fmax/deltaF+1);
926
929
930 /* the middle sample is t = 0 */
932 hctilde=XLALCreateCOMPLEX16FrequencySeries("hcross",&epoch,0.0,deltaF,&lalStrainUnit,upper);
933
934 if(!hptilde || !hctilde) {
937 hctilde=hptilde = NULL;
939 }
940 /* Set to zero below flow */
941 for(i = 0; i < hptilde->data->length; i++) {
942 hptilde->data->data[i] = 0.0;
943 hctilde->data->data[i] = 0.0;
944 }
945
946 /* populate */
947 double f=0.0;
948
949 double lambda=LAL_PI*centre_frequency/Q;
950 REAL8 twopif=LAL_TWOPI * centre_frequency;
951 double lambda2=lambda*lambda;
952 double omega2=twopif*twopif;
953 for(i = lower; i < upper; i++) {
954 f=((REAL8 ) i )*deltaF;
955 hptilde->data->data[i] = -h0plus * (lambda*cp+ twopif*sp+LAL_TWOPI*1.0j*cp*f)/(4.*LAL_PI*LAL_PI*f*f - 4.*LAL_PI*1.0j*f*lambda-lambda2-omega2);
956 hctilde->data->data[i] = -h0cross * (-lambda*sp + twopif*cp - LAL_TWOPI*1.0j*sp*f)/(4.*LAL_PI*LAL_PI*f*f - 4.*LAL_PI*1.0j*f*lambda-lambda2-omega2);
957 }
958
959 *hplus=hptilde;
960 *hcross=hctilde;
961
962 return XLAL_SUCCESS;
963}
964
965/* ============ BELOW IS WHAT WAS LALSIMBURSTWAVEFORMFROMCACHE */
966
967/*
968 * Copyright (C) 2013 Evan Ochsner and Will M. Farr,
969 * 2014 Salvatore Vitale
970 *
971 * This program is free software; you can redistribute it and/or modify
972 * it under the terms of the GNU General Public License as published by
973 * the Free Software Foundation; either version 2 of the License, or
974 * (at your option) any later version.
975 *
976 * This program is distributed in the hope that it will be useful,
977 * but WITHOUT ANY WARRANTY; without even the implied warranty of
978 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
979 * GNU General Public License for more details.
980 *
981 * You should have received a copy of the GNU General Public License
982 * along with with program; see the file COPYING. If not, write to the
983 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
984 * MA 02110-1301 USA
985 */
986
987#include <math.h>
988#include <lal/FrequencySeries.h>
989#include <lal/TimeSeries.h>
990/**
991 * Bitmask enumerating which parameters have changed, to determine
992 * if the requested waveform can be transformed from a cached waveform
993 * or if it must be generated from scratch.
994 */
995typedef enum {
998 HRSS = 2,
1000
1003 REAL8 deltaT,
1004 REAL8 deltaF,
1005 REAL8 f0,
1006 REAL8 q,
1007 REAL8 tau,
1008 REAL8 f_min,
1009 REAL8 f_max,
1010 REAL8 hrss,
1011 REAL8 polar_angle,
1012 REAL8 polar_ecc,
1013 LALSimBurstExtraParam *extraParams,
1015);
1016
1017static int StoreTDHCache(
1019 REAL8TimeSeries *hplus,
1020 REAL8TimeSeries *hcross,
1021 REAL8 deltaT,
1022 REAL8 f0,
1023 REAL8 q, REAL8 tau,
1024 REAL8 f_min, REAL8 f_max,
1025 REAL8 hrss,
1026 REAL8 polar_angle,
1027 REAL8 polar_ecc,
1028 LALSimBurstExtraParam *extraParams,
1030
1031static int StoreFDHCache(
1033 COMPLEX16FrequencySeries *hptilde,
1034 COMPLEX16FrequencySeries *hctilde,
1035 REAL8 deltaF,
1036 REAL8 deltaT,
1037 REAL8 f0,
1038 REAL8 q, REAL8 tau,
1039 REAL8 f_min, REAL8 f_max,
1040 REAL8 hrss,
1041 REAL8 polar_angle,
1042 REAL8 polar_ecc,
1043 LALSimBurstExtraParam *extraParams,
1045
1046/**
1047 * Chooses between different approximants when requesting a waveform to be generated
1048 * Returns the waveform in the time domain.
1049 * The parameters passed must be in SI units.
1050 *
1051 * This version allows caching of waveforms. The most recently generated
1052 * waveform and its parameters are stored. If the next call requests a waveform
1053 * that can be obtained by a simple transformation, then it is done.
1054 * This bypasses the waveform generation and speeds up the code.
1055 */
1057 REAL8TimeSeries **hplus, /**< +-polarization waveform */
1058 REAL8TimeSeries **hcross, /**< x-polarization waveform */
1059 REAL8 deltaT, /**< sampling interval (s) */
1060 REAL8 f0, /**< central frequency [Hz] */
1061 REAL8 q, /**< quality */
1062 REAL8 tau, /**< duration */
1063 REAL8 f_min, /**< starting GW frequency (Hz) */
1064 REAL8 f_max, /**< max GW frequency (Hz) */
1065 REAL8 hrss, /**< hrss */
1066 REAL8 polar_angle, /**< Together with polar_ecc, controls ratio plus/cross polarization (rad) */
1067 REAL8 polar_ecc, /**< (tidal deformability of mass 1) / m1^5 (dimensionless) */
1068 LALSimBurstExtraParam *extraParams, /**< Linked list of extra Parameters. Pass in NULL (or None in python) to neglect */
1069 BurstApproximant approximant, /**< Burst approximant to use for waveform production */
1070 LALSimBurstWaveformCache *cache /**< waveform cache structure; use NULL for no caching */
1071 )
1072{
1073 int status;
1074 size_t j;
1075 REAL8 hrss_ratio;
1076 CacheVariableDiffersBitmask changedParams;
1077 REAL8 deltaF=0.0; // UNUSED
1078 if ( (!cache) )
1079 return XLALSimBurstChooseTDWaveform(hplus, hcross,deltaT,f0,q,tau,f_min,f_max,hrss,polar_angle,polar_ecc,extraParams,approximant);
1080
1081 // Check which parameters have changed
1082 changedParams = CacheArgsDifferenceBitmask(cache, deltaT,deltaF,f0,q, tau,f_min,f_max, hrss,polar_angle, polar_ecc,extraParams,approximant);
1083
1084 // No parameters have changed! Copy the cached polarizations
1085 if( changedParams == NO_DIFFERENCE ) {
1086 *hplus = XLALCutREAL8TimeSeries(cache->hplus, 0,
1087 cache->hplus->data->length);
1088 if (*hplus == NULL) return XLAL_ENOMEM;
1089 *hcross = XLALCutREAL8TimeSeries(cache->hcross, 0,
1090 cache->hcross->data->length);
1091 if (*hcross == NULL) {
1093 *hplus = NULL;
1094 return XLAL_ENOMEM;
1095 }
1096
1097 return XLAL_SUCCESS;
1098 }
1099
1100 // Intrinsic parameters have changed. We must generate a new waveform
1101 if( (changedParams & INTRINSIC) != 0 ) {
1102 status = XLALSimBurstChooseTDWaveform(hplus, hcross,deltaT,f0,q,tau,f_min,f_max,hrss,polar_angle,polar_ecc,extraParams,approximant);
1103 if (status == XLAL_FAILURE) return status;
1104
1105 // FIXME: Need to add hlms, dynamic variables, etc. in cache
1106 return StoreTDHCache(cache, *hplus, *hcross, deltaT,f0,q, tau,f_min,f_max, hrss,polar_angle, polar_ecc,extraParams,approximant);
1107 }
1108
1109 // If polarizations are not cached we must generate a fresh waveform
1110 if( cache->hplus == NULL || cache->hcross == NULL) {
1111 status = XLALSimBurstChooseTDWaveform(hplus, hcross,deltaT,f0,q,tau,f_min,f_max,hrss,polar_angle,polar_ecc,extraParams,approximant);
1112 if (status == XLAL_FAILURE) return status;
1113 return StoreTDHCache(cache, *hplus, *hcross, deltaT,f0,q, tau,f_min,f_max, hrss,polar_angle, polar_ecc,extraParams,approximant);
1114 }
1115
1116 // Set transformation coefficients for identity transformation.
1117 // We'll adjust them depending on which extrinsic parameters changed.
1118 hrss_ratio =1.0;
1119
1120 if( changedParams & HRSS ) {
1121 // Rescale h+, hx by ratio of new_hrss/old_hrss
1122 hrss_ratio = hrss/cache->hrss;
1123 }
1124
1125 // Create the output polarizations
1126 *hplus = XLALCreateREAL8TimeSeries(cache->hplus->name,
1127 &(cache->hplus->epoch), cache->hplus->f0,
1128 cache->hplus->deltaT, &(cache->hplus->sampleUnits),
1129 cache->hplus->data->length);
1130 if (*hplus == NULL) return XLAL_ENOMEM;
1131 *hcross = XLALCreateREAL8TimeSeries(cache->hcross->name,
1132 &(cache->hcross->epoch), cache->hcross->f0,
1133 cache->hcross->deltaT, &(cache->hcross->sampleUnits),
1134 cache->hcross->data->length);
1135 if (*hcross == NULL) {
1137 *hplus = NULL;
1138 return XLAL_ENOMEM;
1139 }
1140 for (j = 0; j < cache->hplus->data->length; j++) {
1141 (*hplus)->data->data[j] = hrss_ratio
1142 * (cache->hplus->data->data[j]);
1143 (*hcross)->data->data[j] = hrss_ratio
1144 *cache->hcross->data->data[j];
1145 }
1146
1147 return XLAL_SUCCESS;
1148
1149}
1150
1151/**
1152 * Chooses between different approximants when requesting a waveform to be generated
1153 * Returns the waveform in the frequency domain.
1154 * The parameters passed must be in SI units.
1155 *
1156 * This version allows caching of waveforms. The most recently generated
1157 * waveform and its parameters are stored. If the next call requests a waveform
1158 * that can be obtained by a simple transformation, then it is done.
1159 * This bypasses the waveform generation and speeds up the code.
1160 */
1162 COMPLEX16FrequencySeries **hptilde, /**< +-polarization waveform */
1163 COMPLEX16FrequencySeries **hctilde, /**< x-polarization waveform */
1164 REAL8 deltaF, /**< sampling interval (Hz) */
1165 REAL8 deltaT, /**< time step corresponding to consec */
1166 REAL8 f0, /**< central frequency (Hz) */
1167 REAL8 q, /**< Q (==sqrt(2) \f$\pi\f$ f0 tau ) [dless]*/
1168 REAL8 tau, /**< Duration [s] */
1169 REAL8 f_min, /**< starting GW frequency (Hz) */
1170 REAL8 f_max, /**< ending GW frequency (Hz) (0 for Nyquist) */
1171 REAL8 hrss, /**< hrss [strain] */
1172 REAL8 polar_angle, /**< Polar_ellipse_angle as defined in the burst table. Together with polar_ellipse_eccentricity below will fix the ratio of + vs x amplitude. */
1173 REAL8 polar_ecc, /**< See above */
1174 LALSimBurstExtraParam *extraParams, /**< Linked list of extra burst parameters. Pass in NULL (or None in python) to neglect these */
1175 BurstApproximant approximant, /**< Burst approximant */
1176 LALSimBurstWaveformCache *cache /**< waveform cache structure; use NULL for no caching */
1177 )
1178{
1179 int status;
1180 size_t j;
1181 REAL8 hrss_ratio;
1182 CacheVariableDiffersBitmask changedParams;
1183 if ((!cache) ){
1184
1185 return XLALSimBurstChooseFDWaveform(hptilde, hctilde,deltaF,deltaT,f0,q, tau,f_min,f_max, hrss,polar_angle, polar_ecc,extraParams,approximant);
1186 }
1187
1188 // Check which parameters have changed
1189 changedParams = CacheArgsDifferenceBitmask(cache, deltaT,deltaF,f0,q, tau,f_min,f_max, hrss,polar_angle, polar_ecc,extraParams,approximant);
1190
1191 // No parameters have changed! Copy the cached polarizations
1192 if( changedParams == NO_DIFFERENCE ) {
1193 *hptilde = XLALCutCOMPLEX16FrequencySeries(cache->hptilde, 0,
1194 cache->hptilde->data->length);
1195 if (*hptilde == NULL) return XLAL_ENOMEM;
1196 *hctilde = XLALCutCOMPLEX16FrequencySeries(cache->hctilde, 0,
1197 cache->hctilde->data->length);
1198 if (*hctilde == NULL) {
1200 *hptilde = NULL;
1201 return XLAL_ENOMEM;
1202 }
1203
1204 return XLAL_SUCCESS;
1205 }
1206
1207 // Intrinsic parameters have changed. We must generate a new waveform
1208 if( (changedParams & INTRINSIC) != 0 ) {
1209 status = XLALSimBurstChooseFDWaveform(hptilde, hctilde, deltaF,deltaT,f0,q, tau,f_min,f_max, hrss,polar_angle, polar_ecc,extraParams,approximant);
1210 if (status == XLAL_FAILURE) return status;
1211
1212 return StoreFDHCache(cache, *hptilde, *hctilde, deltaF,deltaT,f0,q, tau,f_min,f_max, hrss,polar_angle, polar_ecc,extraParams,approximant);
1213 }
1214
1215 if( cache->hptilde == NULL || cache->hctilde == NULL) {
1216 status = XLALSimBurstChooseFDWaveform(hptilde, hctilde, deltaF,deltaT,f0,q, tau,f_min,f_max, hrss,polar_angle, polar_ecc,extraParams,approximant);
1217 if (status == XLAL_FAILURE) return status;
1218
1219 return StoreFDHCache(cache, *hptilde, *hctilde, deltaF,deltaT,f0,q, tau,f_min,f_max, hrss,polar_angle, polar_ecc,extraParams,approximant);
1220 }
1221
1222 // Set transformation coefficients for identity transformation.
1223 // We'll adjust them depending on which extrinsic parameters changed.
1224 hrss_ratio = 1.;
1225
1226 if( changedParams & HRSS ) {
1227 // Rescale h+, hx by ratio of new_hrss/old_hrss
1228 hrss_ratio = hrss/cache->hrss;
1229 }
1230
1231 // Create the output polarizations
1232 *hptilde = XLALCreateCOMPLEX16FrequencySeries(cache->hptilde->name,
1233 &(cache->hptilde->epoch), cache->hptilde->f0,
1234 cache->hptilde->deltaF, &(cache->hptilde->sampleUnits),
1235 cache->hptilde->data->length);
1236 if (*hptilde == NULL) return XLAL_ENOMEM;
1237
1238 *hctilde = XLALCreateCOMPLEX16FrequencySeries(cache->hctilde->name,
1239 &(cache->hctilde->epoch), cache->hctilde->f0,
1240 cache->hctilde->deltaF, &(cache->hctilde->sampleUnits),
1241 cache->hctilde->data->length);
1242 if (*hctilde == NULL) {
1244 *hptilde = NULL;
1245 return XLAL_ENOMEM;
1246 }
1247
1248 for (j = 0; j < cache->hptilde->data->length; j++) {
1249 (*hptilde)->data->data[j] = hrss_ratio
1250 * cache->hptilde->data->data[j];
1251 (*hctilde)->data->data[j] = hrss_ratio
1252 * cache->hctilde->data->data[j];
1253 }
1254
1255 return XLAL_SUCCESS;
1256
1257}
1258
1259/**
1260 * Construct and initialize a waveform cache. Caches are used to
1261 * avoid re-computation of waveforms that differ only by simple
1262 * scaling relations in extrinsic parameters.
1263 */
1265{
1267 sizeof(LALSimBurstWaveformCache));
1268
1269 return cache;
1270}
1271
1272/**
1273 * Destroy a waveform cache.
1274 */
1276{
1277 if (cache != NULL) {
1282
1283 XLALFree(cache);
1284 }
1285}
1286
1287/**
1288 * Function to compare the requested arguments to those stored in the cache,
1289 * returns a bitmask which determines if a cached waveform can be recycled.
1290 */
1292 LALSimBurstWaveformCache *cache , /**< waveform cache structure; use NULL for no caching */
1293 REAL8 deltaT, /**< time steps */
1294 REAL8 deltaF, /**< frequency steps */
1295 REAL8 f0, /**< central frequency (Hz) */
1296 REAL8 q, /**< Q (==sqrt(2) \f$\pi\f$ f0 tau ) [dless]*/
1297 REAL8 tau, /**< Duration [s] */
1298 REAL8 f_min, /**< starting GW frequency (Hz) */
1299 REAL8 f_max, /**< ending GW frequency (Hz) (0 for Nyquist) */
1300 REAL8 hrss, /**< hrss [strain] */
1301 REAL8 polar_angle, /**< Polar_ellipse_angle as defined in the burst table. Together with polar_ellipse_eccentricity below will fix the ratio of + vs x amplitude */
1302 REAL8 polar_ecc, /**< See above */
1303 LALSimBurstExtraParam *extraParams, /**< Linked list of non-GR parameters. Pass in NULL (or None in python) to neglect these */
1304 BurstApproximant approximant /**< Burst approximant */
1305 )
1306{
1308 (void) extraParams;
1309 if (cache == NULL) return INTRINSIC;
1310
1311 if ( deltaT != cache->deltaT) return INTRINSIC;
1312 if ( deltaF != cache->deltaF) return INTRINSIC;
1313 if ( f0 != cache->f0) return INTRINSIC;
1314 if ( q != cache->q) return INTRINSIC;
1315 if ( tau != cache->tau) return INTRINSIC;
1316 if ( f_min != cache->f_min) return INTRINSIC;
1317 if ( f_max != cache->f_max) return INTRINSIC;
1318 if ( polar_angle != cache->polar_angle) return INTRINSIC;
1319 if ( polar_ecc != cache->polar_ecc) return INTRINSIC;
1320 if ( approximant != cache->approximant) return INTRINSIC;
1321 if ( polar_angle != cache->polar_angle) return INTRINSIC;
1322 if ( polar_ecc != cache->polar_ecc) return INTRINSIC;
1323
1324 if (hrss != cache->hrss) difference = difference | HRSS;
1325 return difference;
1326}
1327
1328/** Store the output TD hplus and hcross in the cache. */
1329static int StoreTDHCache(
1330 LALSimBurstWaveformCache *cache, /**< the cache */
1331 REAL8TimeSeries *hplus, /**< the plus polarisation time series */
1332 REAL8TimeSeries *hcross, /**< the cross polarisation time series */
1333 REAL8 deltaT, /**< time step corresponding to consec */
1334 REAL8 f0, /**< central frequency (Hz) */
1335 REAL8 q, /**< Q (==sqrt(2) \f$\pi\f$ f0 tau ) [dless]*/
1336 REAL8 tau, /**< Duration [s] */
1337 REAL8 f_min, /**< starting GW frequency (Hz) */
1338 REAL8 f_max, /**< ending GW frequency (Hz) (0 for Nyquist) */
1339 REAL8 hrss, /**< hrss [strain] */
1340 REAL8 polar_angle, /**< Polar_ellipse_angle as defined in the burst table. Together with polar_ellipse_eccentricity below will fix the ratio of + vs x amplitude.*/
1341 REAL8 polar_ecc, /**< See above */
1342 LALSimBurstExtraParam *extraParams, /**< Linked list of non-GR parameters. Pass in NULL (or None in python) to neglect these */
1343 BurstApproximant approximant /**< Burst approximant */
1344 )
1345{
1346 /* Clear any frequency-domain data. */
1347 if (cache->hptilde != NULL) {
1349 cache->hptilde = NULL;
1350 }
1351
1352 if (cache->hctilde != NULL) {
1354 cache->hctilde = NULL;
1355 }
1356
1357 /* Store params in cache */
1358 cache->deltaT = deltaT;
1359 cache->f0 = f0;
1360 cache->q = q;
1361 cache->tau = tau;
1362 cache->f_min = f_min;
1363 cache->f_max = f_max;
1364 cache->hrss = hrss;
1365 cache->polar_angle =polar_angle;
1366 cache->polar_ecc = polar_ecc;
1367 if (extraParams==NULL)
1368 cache->extraParams=NULL;
1369 /*else if (cache->extraParams==NULL){
1370 // Initialize to something that won't make the ratio of sin alphas to blow up
1371 cache->extraParams=XLALSimBurstCreateExtraParam("alpha",1.0);
1372 }
1373 else{
1374 XLALSimBurstSetExtraParam(cache->extraParams,"alpha",XLALSimBurstGetExtraParam(extraParams,"alpha"));
1375 }*/
1376 cache->approximant = approximant;
1377
1378 // Copy over the waveforms
1379 // NB: XLALCut... creates a new Series object and copies data and metadata
1382 cache->hplus = XLALCutREAL8TimeSeries(hplus, 0, hplus->data->length);
1383 if (cache->hplus == NULL) return XLAL_ENOMEM;
1384 cache->hcross = XLALCutREAL8TimeSeries(hcross, 0, hcross->data->length);
1385 if (cache->hcross == NULL) {
1387 cache->hplus = NULL;
1388 return XLAL_ENOMEM;
1389 }
1390
1391 return XLAL_SUCCESS;
1392}
1393
1394/** Store the output FD hptilde and hctilde in cache. */
1395static int StoreFDHCache(LALSimBurstWaveformCache *cache, /**< the cache */
1396 COMPLEX16FrequencySeries *hptilde, /**< the plus polarisation frequency series */
1397 COMPLEX16FrequencySeries *hctilde, /**< the cross polarisation frequency series */
1398 REAL8 deltaF, /**< sampling interval (Hz) */
1399 REAL8 deltaT, /**< time step corresponding to consec */
1400 REAL8 f0, /**< central frequency (Hz) */
1401 REAL8 q, /**< Q (==sqrt(2) \f$\pi\f$ f0 tau ) [dless]*/
1402 REAL8 tau, /**< Duration [s] */
1403 REAL8 f_min, /**< starting GW frequency (Hz) */
1404 REAL8 f_max, /**< ending GW frequency (Hz) (0 for Nyquist) */
1405 REAL8 hrss, /**< hrss [strain] */
1406 REAL8 polar_angle, /**< Polar_ellipse_angle as defined in the burst table. Together with polar_ellipse_eccentricity below will fix the ratio of + vs x aplitude. */
1407 REAL8 polar_ecc, /**< See above */
1408 LALSimBurstExtraParam *extraParams, /**< Linked list of extra burst parameters. Pass in NULL (or None in python) to neglect these */
1409 BurstApproximant approximant /**< Burst approximant */
1410 )
1411{
1412 /* Clear any time-domain data. */
1413 if (cache->hplus != NULL) {
1415 cache->hplus = NULL;
1416 }
1417
1418 if (cache->hcross != NULL) {
1420 cache->hcross = NULL;
1421 }
1422
1423 /* Store params in cache */
1424 cache->deltaT = deltaT;
1425 cache->deltaF = deltaF;
1426 cache->f0 = f0;
1427 cache->q = q;
1428 cache->tau = tau;
1429 cache->f_min = f_min;
1430 cache->f_max = f_max;
1431 cache->hrss = hrss;
1432 cache->polar_angle =polar_angle;
1433 cache->polar_ecc = polar_ecc;
1434 if (extraParams==NULL)
1435 cache->extraParams=NULL;
1436 /*else if (cache->extraParams==NULL){
1437 // Initialize to something that won't make the ratio of sin alphas to blow up
1438 cache->extraParams=XLALSimBurstCreateExtraParam("alpha",1.0);
1439 }
1440 else{
1441 XLALSimBurstSetExtraParam(cache->extraParams,"alpha",XLALSimBurstGetExtraParam(extraParams,"alpha"));
1442 }*/
1443
1444 cache->approximant = approximant;
1445
1446 // Copy over the waveforms
1447 // NB: XLALCut... creates a new Series object and copies data and metadata
1450 cache->hptilde = XLALCutCOMPLEX16FrequencySeries(hptilde, 0,
1451 hptilde->data->length);
1452 if (cache->hptilde == NULL) return XLAL_ENOMEM;
1453 cache->hctilde = XLALCutCOMPLEX16FrequencySeries(hctilde, 0,
1454 hctilde->data->length);
1455 if (cache->hctilde == NULL) {
1457 cache->hptilde = NULL;
1458 return XLAL_ENOMEM;
1459 }
1460
1461 return XLAL_SUCCESS;
1462}
1463
1464/* =============== BELOW IS WHAT WAS XLALSIMBURSTEXTRAPARAMS */
1465
1466/* Copyright (C) 2014 Salvatore Vitale
1467 * Based on LALSimBurstExtraParams of Del Pozzo, Ochser and Vitale
1468 *
1469 * This program is free software; you can redistribute it and/or modify
1470 * it under the terms of the GNU General Public License as published by
1471 * the Free Software Foundation; either version 2 of the License, or
1472 * (at your option) any later version.
1473 *
1474 * This program is distributed in the hope that it will be useful,
1475 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1476 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1477 * GNU General Public License for more details.
1478 *
1479 * You should have received a copy of the GNU General Public License
1480 * along with with program; see the file COPYING. If not, write to the
1481 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
1482 * MA 02110-1301 USA
1483 */
1484
1485/**
1486 * Function that creates the head node of the test GR parameters linked list.
1487 * It is initialized with a single parameter with given name and value
1488 */
1490 const char *name, /**< Name of first parameter in new linked list */
1491 double value /**< Value of first parameter in new linked list */
1492 )
1493{
1495 if (parameter)
1496 {
1498 memcpy(parameter->data->name, name, 32);
1499 parameter->data->value = value;
1500 }
1501 parameter->next=NULL;
1502 return parameter;
1503}
1504
1505/**
1506 * Function that adds a parameter to the test GR parameters linked list. If the
1507 * parameter already exists, it throws an error.
1508 */
1510 LALSimBurstExtraParam **parameter, /**< Pointer to the head node of the linked list of parameters */
1511 const char *name, /**< Parameter name */
1512 double value /**< Parameter value */
1513 )
1514{
1516 temp = *parameter;
1517 if (*parameter==NULL)
1518 {
1520 //temp->next=NULL;
1521 *parameter=temp;
1522 }
1523 else
1524 {
1525
1526 if (!XLALSimBurstExtraParamExists(*parameter, name))
1527 {
1528 temp = *parameter;
1529 while(temp->next!=NULL) {temp=temp->next;}
1531 temp->next = newParam;
1532 }
1533 else
1534 {
1535 XLALPrintError("XLAL Error - %s: parameter '%s' exists already! Not added to the structure\n",
1536 __func__, name);
1538 }
1539 }
1540 return XLAL_SUCCESS;
1541}
1542
1543/**
1544 * Function that sets the value of the desired parameter in the extra burst
1545 * parameters linked list to 'value'. Throws an error if the parameter
1546 * is not found
1547 */
1549 LALSimBurstExtraParam *parameter, /**< Linked list to be modified */
1550 const char *name, /**< Name of parameter to be modified */
1551 const double value /**< New value for parameter */
1552 )
1553{
1554 if (XLALSimBurstExtraParamExists(parameter, name))
1555 {
1556 while(parameter)
1557 {
1558 if(!strcmp(parameter->data->name, name)) parameter->data->value = value;
1559 parameter=parameter->next;
1560 }
1561 return XLAL_SUCCESS;
1562 }
1563 else
1564 {
1565 XLALPrintError("XLAL Error - %s: parameter '%s' unknown!\n",
1566 __func__, name);
1568 }
1569}
1570
1571/**
1572 * Function that returns the value of the desired parameters in the
1573 * extra burst parameters linked list. Aborts if the parameter is not found
1574 */
1576 const LALSimBurstExtraParam *parameter, /**< Linked list to retrieve from */
1577 const char *name /**< Name of parameter to be retrieved */
1578 )
1579{
1580 if (XLALSimBurstExtraParamExists(parameter, name))
1581 {
1582 while(parameter)
1583 {
1584 if(!strcmp(parameter->data->name, name)) return parameter->data->value;
1585 parameter=parameter->next;
1586 }
1587 }
1588 else
1589 {
1590 XLALPrintError("XLAL Error - %s: parameter '%s' unknown!\n",
1591 __func__, name);
1593 }
1594 return 0.0; // Should not actually get here!
1595}
1596
1597/**
1598 * Function that checks whether the requested parameter exists within the
1599 * burst extra parameters linked list. Returns true (1) or false (0) accordingly
1600 */
1602 const LALSimBurstExtraParam *parameter, /**< Linked list to check */
1603 const char *name /**< Parameter name to check for */
1604 )
1605{
1606 if(!parameter) return 0;
1607 while(parameter) {if(!strcmp(parameter->data->name, name)) return 1; else parameter=parameter->next;}
1608 return 0;
1609}
1610
1611/** Function that prints the whole test burst extra parameters linked list */
1613 FILE *fp, /**< FILE pointer to write to */
1614 LALSimBurstExtraParam *parameter /**< Linked list to print */
1615 )
1616{
1617 if (parameter!=NULL)
1618 {
1619 while(parameter)
1620 {
1621 fprintf(fp,"%s %10.5f\n",parameter->data->name,parameter->data->value);
1622 parameter=parameter->next;
1623 }
1624 return XLAL_SUCCESS;
1625 }
1626 else
1627 {
1628 XLALPrintError("XLAL Error - %s: parameter not allocated!\n", __func__);
1630 }
1631}
1632
1633/** Function that destroys the whole burst extra params linked list */
1635 LALSimBurstExtraParam *parameter /**< Linked list to destroy */
1636 )
1637{
1639 while(parameter){
1640 tmp=parameter->next;
1641 XLALFree(parameter->data);
1642 XLALFree(parameter);
1643 parameter=tmp;
1644 }
1645}
#define LAL_SQRT_PI
int XLALSimBurstImplementedTDApproximants(BurstApproximant approximant)
char * XLALGetStringFromBurstApproximant(BurstApproximant bapproximant)
XLAL function to determine string from approximant enum.
int XLALInferenceBurstSineGaussianF(COMPLEX16FrequencySeries **hplus, COMPLEX16FrequencySeries **hcross, REAL8 Q, REAL8 centre_frequency, REAL8 hrss, REAL8 eccentricity, REAL8 phase, REAL8 deltaF, REAL8 deltaT)
double XLALSimBurstGetExtraParam(const LALSimBurstExtraParam *parameter, const char *name)
Function that returns the value of the desired parameters in the extra burst parameters linked list.
static CacheVariableDiffersBitmask CacheArgsDifferenceBitmask(LALSimBurstWaveformCache *cache, REAL8 deltaT, REAL8 deltaF, REAL8 f0, REAL8 q, REAL8 tau, REAL8 f_min, REAL8 f_max, REAL8 hrss, REAL8 polar_angle, REAL8 polar_ecc, LALSimBurstExtraParam *extraParams, BurstApproximant approximant)
Function to compare the requested arguments to those stored in the cache, returns a bitmask which det...
int XLALInferenceBurstGaussianF(COMPLEX16FrequencySeries **hplus, COMPLEX16FrequencySeries **hcross, REAL8 duration, REAL8 hrss, REAL8 phase, REAL8 deltaF, REAL8 deltaT)
CacheVariableDiffersBitmask
Bitmask enumerating which parameters have changed, to determine if the requested waveform can be tran...
#define FRTH_2_times_PI
int XLALSimBurstChooseFDWaveform(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 deltaF, REAL8 deltaT, REAL8 f0, REAL8 q, REAL8 tau, REAL8 f_min, REAL8 f_max, REAL8 hrss, REAL8 polar_angle, REAL8 polar_ecc, LALSimBurstExtraParam *extraParams, BurstApproximant approximant)
int XLALGetBurstApproximantFromString(const CHAR *inString)
XLAL function to determine burst approximant from a string.
static int StoreTDHCache(LALSimBurstWaveformCache *cache, REAL8TimeSeries *hplus, REAL8TimeSeries *hcross, REAL8 deltaT, REAL8 f0, REAL8 q, REAL8 tau, REAL8 f_min, REAL8 f_max, REAL8 hrss, REAL8 polar_angle, REAL8 polar_ecc, LALSimBurstExtraParam *extraParams, BurstApproximant approximant)
Store the output TD hplus and hcross in the cache.
LALSimBurstWaveformCache * XLALCreateSimBurstWaveformCache(void)
Construct and initialize a waveform cache.
static void semi_major_minor_from_e(double e, double *a, double *b)
int XLALSimBurstChooseTDWaveform(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 deltaT, REAL8 f0, REAL8 q, REAL8 tau, REAL8 f_min, REAL8 f_max, REAL8 hrss, REAL8 polar_angle, REAL8 polar_ecc, LALSimBurstExtraParam *extraParams, BurstApproximant approximant)
int XLALSimBurstChooseFDWaveformFromCache(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 deltaF, REAL8 deltaT, REAL8 f0, REAL8 q, REAL8 tau, REAL8 f_min, REAL8 f_max, REAL8 hrss, REAL8 polar_angle, REAL8 polar_ecc, LALSimBurstExtraParam *extraParams, BurstApproximant approximant, LALSimBurstWaveformCache *cache)
Chooses between different approximants when requesting a waveform to be generated Returns the wavefor...
void XLALSimBurstDestroyExtraParam(LALSimBurstExtraParam *parameter)
Function that destroys the whole burst extra params linked list.
void XLALDestroySimBurstWaveformCache(LALSimBurstWaveformCache *cache)
Destroy a waveform cache.
int XLALInferenceBurstGaussian(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 duration, REAL8 hrss, REAL8 eccentricity, REAL8 polarization, REAL8 delta_t)
int XLALInferenceBurstDampedSinusoid(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 Q, REAL8 centre_frequency, REAL8 hrss, REAL8 eccentricity, REAL8 phase, REAL8 delta_t)
int XLALInferenceBurstSineGaussianFFast(COMPLEX16FrequencySeries **hplus, COMPLEX16FrequencySeries **hcross, REAL8 Q, REAL8 centre_frequency, REAL8 hrss, REAL8 eccentricity, REAL8 phase, REAL8 deltaF, REAL8 deltaT)
int XLALSimBurstPrintExtraParam(FILE *fp, LALSimBurstExtraParam *parameter)
Function that prints the whole test burst extra parameters linked list.
int XLALSimBurstSetExtraParam(LALSimBurstExtraParam *parameter, const char *name, const double value)
Function that sets the value of the desired parameter in the extra burst parameters linked list to 'v...
int XLALSimBurstChooseTDWaveformFromCache(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 deltaT, REAL8 f0, REAL8 q, REAL8 tau, REAL8 f_min, REAL8 f_max, REAL8 hrss, REAL8 polar_angle, REAL8 polar_ecc, LALSimBurstExtraParam *extraParams, BurstApproximant approximant, LALSimBurstWaveformCache *cache)
Chooses between different approximants when requesting a waveform to be generated Returns the wavefor...
int XLALInferenceBurstDampedSinusoidF(COMPLEX16FrequencySeries **hplus, COMPLEX16FrequencySeries **hcross, REAL8 Q, REAL8 centre_frequency, REAL8 hrss, REAL8 eccentricity, REAL8 phase, REAL8 deltaF, REAL8 deltaT)
int XLALSimBurstAddExtraParam(LALSimBurstExtraParam **parameter, const char *name, double value)
Function that adds a parameter to the test GR parameters linked list.
#define FRTH_2_Pi
int XLALSimBurstImplementedFDApproximants(BurstApproximant approximant)
Checks whether the given approximant is implemented in lalsimulation's XLALSimInspiralChooseFDWavefor...
LALSimBurstExtraParam * XLALSimBurstCreateExtraParam(const char *name, double value)
Function that creates the head node of the test GR parameters linked list.
static int StoreFDHCache(LALSimBurstWaveformCache *cache, COMPLEX16FrequencySeries *hptilde, COMPLEX16FrequencySeries *hctilde, REAL8 deltaF, REAL8 deltaT, REAL8 f0, REAL8 q, REAL8 tau, REAL8 f_min, REAL8 f_max, REAL8 hrss, REAL8 polar_angle, REAL8 polar_ecc, LALSimBurstExtraParam *extraParams, BurstApproximant approximant)
Store the output FD hptilde and hctilde in cache.
int XLALSimBurstExtraParamExists(const LALSimBurstExtraParam *parameter, const char *name)
Function that checks whether the requested parameter exists within the burst extra parameters linked ...
int XLALCheckBurstApproximantFromString(const CHAR *inString)
int XLALInferenceBurstSineGaussian(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 Q, REAL8 centre_frequency, REAL8 hrss, REAL8 eccentricity, REAL8 phase, REAL8 delta_t)
Input:
BurstApproximant
Enum that specifies the PN approximant to be used in computing the waveform.
int j
CacheVariableDiffersBitmask
#define fprintf
const char *const name
double e
double duration
const double Q
COMPLEX16FrequencySeries * XLALCreateCOMPLEX16FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
COMPLEX16FrequencySeries * XLALCutCOMPLEX16FrequencySeries(const COMPLEX16FrequencySeries *series, size_t first, size_t length)
void XLALDestroyCOMPLEX16FrequencySeries(COMPLEX16FrequencySeries *series)
#define LAL_2_SQRTPI
#define LAL_PI
#define LAL_TWOPI
#define LAL_SQRT2
#define crect(re, im)
#define LIGOTIMEGPSZERO
double REAL8
char CHAR
void * XLALMalloc(size_t n)
void * XLALCalloc(size_t m, size_t n)
void XLALFree(void *p)
static const INT4 q
static const INT4 a
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
REAL8TimeSeries * XLALCutREAL8TimeSeries(const REAL8TimeSeries *series, size_t first, size_t length)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalStrainUnit
#define XLAL_ERROR_NULL(...)
#define XLAL_ERROR(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
XLAL_ENOMEM
XLAL_SUCCESS
XLAL_EFAULT
XLAL_EFUNC
XLAL_EINVAL
XLAL_FAILURE
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
delta_t
LALCache * cache
COMPLEX16Sequence * data
COMPLEX16 * data
UINT4 length
Linked list node for the testing GR parameters.
Linked list of any number of parameters for testing GR.
struct tagLALSimBurstExtraParam * next
The next variable in linked list.
struct tagLALSimBurstExtraParamData * data
Current variable.
Stores previously-computed waveforms and parameters to take advantage of approximant- and parameter-s...
REAL8Sequence * data
FILE * fp
enum @1 epoch
double hrss
double f_min
double f_max