Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALSimulation 6.2.0.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALSimInspiralInjection.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2023 Jolien Creighton
3*
4* This program is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation; either version 2 of the License, or
7* (at your option) any later version.
8*
9* This program is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with with program; see the file COPYING. If not, write to the
16* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17* MA 02110-1301 USA
18*/
19
20#include <stdio.h>
21#include <string.h>
22#include <sys/types.h>
23#include <math.h>
24#include <lal/LALStdlib.h>
25#include <lal/LALConstants.h>
26#include <lal/LALDetectors.h>
27#include <lal/LALString.h>
28#include <lal/LALDict.h>
29#include <lal/LALDictSequence.h>
30#include <lal/Date.h>
31#include <lal/Sort.h>
32#include <lal/AVFactories.h>
33#include <lal/StringVector.h>
34#include <lal/LALSimulation.h>
35#include <lal/LALSimInspiral.h>
36#include <lal/H5FileIO.h>
37#include <lal/LALSimInspiralWaveformParams.h>
38#include <lal/LALSimInspiralInjection.h>
39
40#ifdef __GNUC__
41#define UNUSED __attribute__ ((unused))
42#else
43#define UNUSED
44#endif
45
46/* translates from the injection file parameter names
47 * https://git.ligo.org/waveforms/o4-injection-file/-/blob/main/ESSENTIAL_SPEC.md * to the waveform interface parameter names
48 * https://git.ligo.org/waveforms/new-waveforms-interface/-/blob/master/parameter-names.md
49 */
50static const char * translate_key(const char *key, int inverse)
51{
52 static const char *map[][2] = {
53 { "mass1_det", "mass1" },
54 { "mass2_det", "mass2" },
55 { "d_lum", "distance" },
56 { "f22_ref_spin", "f22_ref" },
57 { "coa_phase", "phi_ref" },
58 { "cbc_model", "approximant" },
59 };
60 int to = inverse ? 0 : 1;
61 int from = inverse ? 1 : 0;
62 for (size_t i = 0; i < XLAL_NUM_ELEM(map); ++i)
63 if (strcmp(key, map[i][from]) == 0)
64 return map[i][to];
65 return key;
66}
67
68static double si_scale_factor(const char *key)
69{
70 if (strcmp(key, "mass1") == 0)
71 return LAL_MSUN_SI;
72 else if (strcmp(key, "mass2") == 0)
73 return LAL_MSUN_SI;
74 else if (strcmp(key, "distance") == 0)
75 return 1e6 * LAL_PC_SI;
76 return 1.0;
77}
78
79static const char file_format_attr_key[] = "file_format";
80static const char file_format_attr_val[] = "lvk_o4_injection";
81static const char cbc_waveform_params_group[] = "cbc_waveform_params";
82
83LALDictSequence * XLALSimInspiralInjectionSequenceFromH5File(const char *fname)
84{
85 LALDictSequence *injseq = NULL;
86 LALStringVector *strvec = NULL;
87 INT4Vector *intvec = NULL;
88 REAL8Vector *dblvec = NULL;
89 LALH5File *file = NULL;
90 LALH5File *group = NULL;
91 LALH5Dataset *dset = NULL;
92 char *name = NULL;
93 size_t npar;
94
97
98 file = XLALH5FileOpen(fname, "r");
100
101 /* check file format attribute -- only produces warnings */
104 char *val;
105 if (len < 0)
107 val = XLALMalloc(len + 1);
110 if (len < 0) {
111 XLALFree(val);
113 }
114 if (strcmp(val, file_format_attr_val) != 0)
115 XLAL_PRINT_WARNING("File %s has incorrect value for attribute `%s' (expected: `%s', got: `%s')", fname, file_format_attr_key, file_format_attr_val, val);
116 XLALFree(val);
117 } else
118 XLAL_PRINT_WARNING("File %s has missing attribute `%s'", fname, file_format_attr_key);
119
122 npar = XLALH5FileQueryNDatasets(group);
123 XLAL_CHECK_FAIL((ssize_t)npar >= 0, XLAL_EFUNC);
124 XLAL_CHECK_FAIL(npar > 0, XLAL_ESIZE, "No datasets found");
125
126 for (size_t pos = 0; pos < npar; ++pos) {
127 const char *key;
128 int namelen;
129 LALTYPECODE type;
130 size_t ninj;
131 double scale;
132
133 namelen = XLALH5FileQueryDatasetName(NULL, 0, group, pos);
134 XLAL_CHECK_FAIL(namelen >= 0, XLAL_EFUNC);
135 XLAL_CHECK_FAIL(namelen > 0, XLAL_ENAME);
136 name = LALMalloc(namelen + 1);
138 XLAL_CHECK_FAIL(XLALH5FileQueryDatasetName(name, namelen + 1, group, pos) == namelen, XLAL_EFUNC);
139 dset = XLALH5DatasetRead(group, name);
141 type = XLALH5DatasetQueryType(dset);
142 XLAL_CHECK_FAIL((int)type >= 0, XLAL_EFUNC);
143 ninj = XLALH5DatasetQueryNPoints(dset);
144 XLAL_CHECK_FAIL((ssize_t)ninj >= 0, XLAL_EFUNC);
145 if (injseq == NULL) {
146 injseq = XLALCreateDictSequence(ninj);
148 } else if (ninj != injseq->length)
149 XLAL_ERROR_FAIL(XLAL_EBADLEN, "Datasets have different number of points");
150
151 key = strrchr(name, '/');
152 key = key ? key + 1: name;
153 key = translate_key(key, 0);
154
155 switch (type) {
157 strvec = XLALH5DatasetReadStringVector(dset);
159 for (size_t i = 0; i < strvec->length; ++i) {
160 int retval;
161 if (!strlen(strvec->data[i]))
162 continue;
163 if (strcmp(key, "ModeArray") == 0) {
164 /* handle mode array as a special case */
165 retval = XLALSimInspiralWaveformParamsInsertModeArrayFromModeString(injseq->data[i], strvec->data[i]);
166 } else {
167 retval = XLALDictInsertStringValue(injseq->data[i], key, strvec->data[i]);
168 }
169 XLAL_CHECK_FAIL(retval == 0, XLAL_EFUNC);
170 }
172 strvec = NULL;
173 break;
174 case LAL_I4_TYPE_CODE:
175 intvec = XLALH5DatasetReadINT4Vector(dset);
177 for (size_t i = 0; i < intvec->length; ++i) {
178 int retval;
179 retval = XLALDictInsertINT4Value(injseq->data[i], key, intvec->data[i]);
180 XLAL_CHECK_FAIL(retval == 0, XLAL_EFUNC);
181 }
182 XLALDestroyINT4Vector(intvec);
183 intvec = NULL;
184 break;
185 case LAL_D_TYPE_CODE:
186 scale = si_scale_factor(key);
187 dblvec = XLALH5DatasetReadREAL8Vector(dset);
189 for (size_t i = 0; i < dblvec->length; ++i) {
190 int retval;
191 if (!isfinite(dblvec->data[i]))
192 continue;
193 retval = XLALDictInsertREAL8Value(injseq->data[i], key, scale * dblvec->data[i]);
194 XLAL_CHECK_FAIL(retval == 0, XLAL_EFUNC);
195 }
197 dblvec = NULL;
198 break;
199 default:
200 XLAL_ERROR_FAIL(XLAL_ETYPE, "Unsupported data type for dataset \"%s\"", name);
201 break;
202 }
203
204 XLALH5DatasetFree(dset);
205 XLALFree(name);
206 dset = NULL;
207 name = NULL;
208 }
209
210 XLALH5FileClose(group);
212
213 return injseq;
214
215XLAL_FAIL:
216
217 XLALFree(name);
218 XLALH5DatasetFree(dset);
219 XLALH5FileClose(group);
222 XLALDestroyINT4Vector(intvec);
225 return NULL;
226}
227
228
229static void XLALSimInspiralDictInsertParameterType(char *key, LALValue *value, void *thunk)
230{
231 LALDict *types = (LALDict *)thunk;
232 XLALDictInsertINT4Value(types, key, XLALValueGetType(value));
233 return;
234}
235
236int XLALSimInspiralInjectionSequenceToH5File(const LALDictSequence *injseq, const char *fname)
237{
238 LALH5File *file = NULL;
239 LALH5File *group = NULL;
240 LALStringVector *strvec = NULL;
241 INT4Vector *intvec = NULL;
242 REAL8Vector *dblvec = NULL;
243 LALDict *types = NULL;
244 LALDictIter iter;
245 LALDictEntry *entry;
246
247 file = XLALH5FileOpen(fname, "w");
253
254 /* get the types of all parameter keys */
255 types = XLALCreateDict();
256 for (size_t i = 0; i < injseq->length; ++i)
258
259 /* loop over parameters */
260 XLALDictIterInit(&iter, types);
261 while ((entry = XLALDictIterNext(&iter))) {
262 const char *key = XLALDictEntryGetKey(entry);
263 const char *new = translate_key(key, 1);
264 const LALValue *value = XLALDictEntryGetValue(entry);
265 LALTYPECODE type = XLALValueGetINT4(value);
266 LALH5Dataset *dset;
267 double scale;
268 switch (type) {
270 strvec = XLALCreateEmptyStringVector(injseq->length);
271 for (size_t i = 0; i < injseq->length; ++i)
272 if (strcmp(key, "ModeArray") == 0) {
273 /* handle mode array as a special case */
274 if (XLALDictContains(injseq->data[i], key)) {
275 LALValue *modes = XLALValueDuplicate(XLALDictEntryGetValue(XLALDictLookup(injseq->data[i], key)));
277 XLALDestroyValue(modes);
278 } else {
279 strvec->data[i] = XLALStringDuplicate("");
280 }
281 } else {
282 strvec->data[i] = XLALStringDuplicate(XLALDictContains(injseq->data[i], key) ? XLALDictLookupStringValue(injseq->data[i], key) : "");
283 }
284 dset = XLALH5DatasetAllocStringVector(group, new, strvec);
287 strvec = NULL;
288 break;
289 case LAL_I4_TYPE_CODE:
290 intvec = XLALCreateINT4Vector(injseq->length);
291 for (size_t i = 0; i < injseq->length; ++i)
292 intvec->data[i] = XLALDictLookupINT4Value(injseq->data[i], key);
293 dset = XLALH5DatasetAllocINT4Vector(group, new, intvec);
295 XLALDestroyINT4Vector(intvec);
296 intvec = NULL;
297 break;
298 case LAL_D_TYPE_CODE:
299 dblvec = XLALCreateREAL8Vector(injseq->length);
300 scale = si_scale_factor(key);
301 for (size_t i = 0; i < injseq->length; ++i)
302 dblvec->data[i] = XLALDictContains(injseq->data[i], key) ? XLALDictLookupREAL8Value(injseq->data[i], key) / scale : NAN;
303 dset = XLALH5DatasetAllocREAL8Vector(group, new, dblvec);
306 dblvec = NULL;
307 break;
308 default:
309 XLAL_ERROR_FAIL(XLAL_ETYPE, "Unsupported data type for dataset \"%s\"", key);
310 break;
311 }
312 XLALH5DatasetFree(dset);
313 dset = NULL;
314 }
315
316 XLALDestroyDict(types);
317 XLALH5FileClose(group);
319 return XLAL_SUCCESS;
320
321XLAL_FAIL:
323 XLALDestroyINT4Vector(intvec);
325 XLALDestroyDict(types);
326 XLALH5FileClose(group);
328 return XLAL_FAILURE;
329}
330
332{
333 REAL8 mass1;
334 REAL8 mass2;
335 REAL8 spin1z;
336 REAL8 spin2z;
337 REAL8 spin_final;
338 REAL8 t_ring;
339 REAL8 t_co_gps;
340 REAL8 t_co_gps_add = 0.0;
341
343 XLAL_CHECK_NULL(injparams, XLAL_EFAULT);
344
345 t_co_gps = XLALDictLookupREAL8Value(injparams, "t_co_gps");
347
348 if (XLALDictContains(injparams, "t_co_gps_add")) {
349 t_co_gps_add = XLALDictLookupREAL8Value(injparams, "t_co_gps_add");
351 }
352
353 XLALGPSSetREAL8(epoch, t_co_gps);
354 XLALGPSAdd(epoch, t_co_gps_add);
355
356 mass1 = XLALDictLookupREAL8Value(injparams, "mass1");
358
359 mass2 = XLALDictLookupREAL8Value(injparams, "mass2");
361
362 spin1z = XLALDictLookupREAL8Value(injparams, "spin1z");
364
365 spin2z = XLALDictLookupREAL8Value(injparams, "spin2z");
367
368 spin_final = XLALSimInspiralFinalBlackHoleSpinBound(spin1z, spin2z);
370
371 t_ring = XLALSimInspiralRingdownTimeBound(mass1 + mass2, spin_final);
373
374 return XLALGPSAdd(epoch, t_ring);
375}
376
378{
379 REAL8 f22_start;
380 REAL8 mass1;
381 REAL8 mass2;
382 REAL8 spin1z;
383 REAL8 spin2z;
384 REAL8 t_chirp;
385 REAL8 t_merge;
386
389
390 f22_start = XLALDictLookupREAL8Value(injparams, "f22_start");
392
393 mass1 = XLALDictLookupREAL8Value(injparams, "mass1");
395
396 mass2 = XLALDictLookupREAL8Value(injparams, "mass2");
398
399 spin1z = XLALDictLookupREAL8Value(injparams, "spin1z");
401
402 spin2z = XLALDictLookupREAL8Value(injparams, "spin2z");
404
405 t_chirp = XLALSimInspiralChirpTimeBound(f22_start, mass1, mass2, spin1z, spin2z);
407
408 t_merge = XLALSimInspiralMergeTimeBound(mass1, mass2);
410
411 return XLALGPSAdd(epoch, -(t_chirp + t_merge));
412}
413
414static int XLALSimInspiralParamsCompareEndTime(void *thunk UNUSED, const void *a, const void *b)
415{
416 /* note: discarding const qualifier is safe in this context */
417 LALDict *dict1 = *(LALDict **)(uintptr_t)a;
418 LALDict *dict2 = *(LALDict **)(uintptr_t)b;
419 LIGOTimeGPS t1;
420 LIGOTimeGPS t2;
423 return XLALGPSCmp(&t1, &t2);
424}
425
426static int XLALSimInspiralParamsCompareEndTimeToGPSTime(void *thunk UNUSED, const void *a, const void *b)
427{
428 /* note: discarding const qualifier is safe in this context */
429 LALDict *dict = *(LALDict **)(uintptr_t)a;
430 LIGOTimeGPS *t2 = (LIGOTimeGPS *)(uintptr_t)b;
431 LIGOTimeGPS t1;
433 return XLALGPSCmp(&t1, t2);
434}
435
436static int XLALSimInspiralParamsCompareStartTime(void *thunk UNUSED, const void *a, const void *b)
437{
438 /* note: discarding const qualifier is safe in this context */
439 LALDict *dict1 = *(LALDict **)(uintptr_t)a;
440 LALDict *dict2 = *(LALDict **)(uintptr_t)b;
441 LIGOTimeGPS t1;
442 LIGOTimeGPS t2;
445 return XLALGPSCmp(&t1, &t2);
446}
447
448static int XLALSimInspiralParamsCompareStartTimeToGPSTime(void *thunk UNUSED, const void *a, const void *b)
449{
450 /* note: discarding const qualifier is safe in this context */
451 LALDict *dict = *(LALDict **)(uintptr_t)a;
452 LIGOTimeGPS *t2 = (LIGOTimeGPS *)(uintptr_t)b;
453 LIGOTimeGPS t1;
455 return XLALGPSCmp(&t1, t2);
456}
457
459{
460 int errnum;
461 int retval;
462 XLAL_CHECK(injseq, XLAL_EFAULT);
463 errnum = XLALClearErrno(); /* clear xlalErrno and preserve value */
464 retval = XLALIsSorted(injseq->data, injseq->length, sizeof(*injseq->data), NULL, XLALSimInspiralParamsCompareEndTime);
465 if (retval < 0 || XLALGetBaseErrno()) /* something failed */
467 XLALSetErrno(errnum); /* restore previous value of xlalErrno */
468 return retval;
469}
470
472{
473 int errnum;
474 int retval;
475 XLAL_CHECK(injseq, XLAL_EFAULT);
476 errnum = XLALClearErrno(); /* clear xlalErrno and preserve value */
477 retval = XLALIsSorted(injseq->data, injseq->length, sizeof(*injseq->data), NULL, XLALSimInspiralParamsCompareStartTime);
478 if (retval < 0 || XLALGetBaseErrno()) /* something failed */
480 XLALSetErrno(errnum); /* restore previous value of xlalErrno */
481 return retval;
482}
483
485{
486 int retval;
487 /* it is likely that it is already time ordered, so check first */
489 XLAL_CHECK(retval >= 0, XLAL_EFUNC);
490 if (!retval) { /* sort it */
491 int errnum;
492 errnum = XLALClearErrno(); /* clear xlalErrno and preserve value */
493 retval = XLALMergeSort(injseq->data, injseq->length, sizeof(*injseq->data), NULL, XLALSimInspiralParamsCompareEndTime);
494 if (retval < 0 || XLALGetBaseErrno()) /* something failed */
496 XLALSetErrno(errnum); /* restore previous value of xlalErrno */
497 }
498 return 0;
499}
500
502{
503 int retval;
504 /* it is likely that it is already time ordered, so check first */
506 XLAL_CHECK(retval >= 0, XLAL_EFUNC);
507 if (!retval) { /* sort it */
508 int errnum;
509 errnum = XLALClearErrno(); /* clear xlalErrno and preserve value */
510 retval = XLALMergeSort(injseq->data, injseq->length, sizeof(*injseq->data), NULL, XLALSimInspiralParamsCompareStartTime);
511 if (retval < 0 || XLALGetBaseErrno()) /* something failed */
513 XLALSetErrno(errnum); /* restore previous value of xlalErrno */
514 }
515 return 0;
516}
517
518LALDictSequence * XLALSimInspiralInjectionSequenceInInterval(const LALDictSequence *injseq, const LIGOTimeGPS *start, const LIGOTimeGPS *end)
519{
520 LALDictSequence *new = NULL;
521 LALDictSequence *tmp;
522 ssize_t i;
523 int retval;
524
526
527 /* copy sequence */
528 new = XLALCopyDictSequence(injseq);
530
531 /* keep only injections where injection end time > start time */
532
533 /* sort by injection end time */
536
537 /* find index of first injection ending after start of interval */
538 i = XLALSearchSorted(start, new->data, new->length, sizeof(*new->data), NULL, XLALSimInspiralParamsCompareEndTimeToGPSTime, +1);
540 tmp = XLALResizeDictSequence(new, i, new->length - i);
542 new = tmp;
543
544 /* sort by injection start time */
547
548 /* find index of last injection starting before end of interval */
549 i = XLALSearchSorted(end, new->data, new->length, sizeof(*new->data), NULL, XLALSimInspiralParamsCompareStartTimeToGPSTime, -1);
551 tmp = XLALResizeDictSequence(new, 0, i);
553 new = tmp;
554
555 /* note: returned injection sequence is ordered by injection start time */
556 return new;
557
558XLAL_FAIL:
560 return NULL;
561}
562
564{
565 LALSimInspiralGenerator *generator = NULL;
566 LALDict *wfmparams;
567 Approximant approx;
568 char *approximant;
569 int err;
570 int ret = XLAL_FAILURE;
571
572 XLAL_CHECK(hplus, XLAL_EFAULT);
573 XLAL_CHECK(hcross, XLAL_EFAULT);
574 XLAL_CHECK(injparams, XLAL_EFAULT);
575 XLAL_CHECK(*hplus == NULL, XLAL_EINVAL);
576 XLAL_CHECK(*hcross == NULL, XLAL_EINVAL);
577
578 wfmparams = XLALDictDuplicate(injparams);
579 XLAL_CHECK(wfmparams, XLAL_EFUNC);
580
581 /* remove non-waveform parameters */
582 err = XLALDictContains(wfmparams, "ra") ? XLALDictRemove(wfmparams, "ra"): 0;
583 XLAL_CHECK(err == 0, XLAL_EFUNC);
584 err = XLALDictContains(wfmparams, "dec") ? XLALDictRemove(wfmparams, "dec"): 0;
585 XLAL_CHECK(err == 0, XLAL_EFUNC);
586 err = XLALDictContains(wfmparams, "polarization") ? XLALDictRemove(wfmparams, "polarization"): 0;
587 XLAL_CHECK(err == 0, XLAL_EFUNC);
588 err = XLALDictContains(wfmparams, "t_co_gps") ? XLALDictRemove(wfmparams, "t_co_gps"): 0;
589 XLAL_CHECK(err == 0, XLAL_EFUNC);
590 err = XLALDictContains(wfmparams, "t_co_gps_add") ? XLALDictRemove(wfmparams, "t_co_gps_add"): 0;
591 XLAL_CHECK(err == 0, XLAL_EFUNC);
592
593 /* pop approximant string and convert to Approximant */
594 approximant = XLALDictPopStringValue(wfmparams, "approximant");
598
599 /* insert deltaT */
601 XLAL_CHECK_FAIL(!(ret < 0), XLAL_EFUNC);
602
603 /* create generator FIXME? allow parameters to be added here? */
604 generator = XLALSimInspiralChooseGenerator(approx, NULL);
605 XLAL_CHECK_FAIL(generator, XLAL_EFUNC);
606
607 /* add conditioning for approximant */
609 XLAL_CHECK_FAIL(!(ret < 0), XLAL_EFUNC);
610
611 /* generate the waveform */
612 ret = XLALSimInspiralGenerateTDWaveform(hplus, hcross, wfmparams, generator);
613 XLAL_CHECK_FAIL(!(ret < 0), XLAL_EFUNC);
614
615XLAL_FAIL:
617 XLALDestroyDict(wfmparams);
618 return ret;
619}
620
622{
623 REAL8TimeSeries *hplus = NULL;
624 REAL8TimeSeries *hcross = NULL;
625 REAL8TimeSeries *strain = NULL;
626 REAL8 t_co_gps_add = 0.0;
627 REAL8 t_co_gps;
628 REAL8 ra;
629 REAL8 dec;
630 REAL8 polarization;
631 int ret;
632
633 t_co_gps = XLALDictLookupREAL8Value(injparams, "t_co_gps");
635
636 if (XLALDictContains(injparams, "t_co_gps_add")) {
637 t_co_gps = XLALDictLookupREAL8Value(injparams, "t_co_gps_add");
639 }
640
641 ra = XLALDictLookupREAL8Value(injparams, "ra");
643
644 dec = XLALDictLookupREAL8Value(injparams, "dec");
646
647 polarization = XLALDictLookupREAL8Value(injparams, "polarization");
649
650 ret = XLALSimInspiralInjectionTDWaveform(&hplus, &hcross, injparams, deltaT);
651 XLAL_CHECK_FAIL(!(ret < 0), XLAL_EFUNC);
652
653 XLALGPSAdd(&hplus->epoch, t_co_gps);
654 XLALGPSAdd(&hplus->epoch, t_co_gps_add);
655 XLALGPSAdd(&hcross->epoch, t_co_gps);
656 XLALGPSAdd(&hcross->epoch, t_co_gps_add);
657
658 strain = XLALSimDetectorStrainREAL8TimeSeries(hplus, hcross, ra, dec, polarization, detector);
660
661XLAL_FAIL:
664 return strain;
665}
struct tagLALH5File LALH5File
struct tagLALH5Dataset LALH5Dataset
int XLALDictContains(const LALDict *dict, const char *key)
LALDictEntry * XLALDictIterNext(LALDictIter *iter)
LALDictEntry * XLALDictLookup(const LALDict *dict, const char *key)
char * XLALDictPopStringValue(LALDict *dict, const char *key)
const char * XLALDictLookupStringValue(const LALDict *dict, const char *key)
int XLALDictRemove(LALDict *dict, const char *key)
void XLALDestroyDict(LALDict *dict)
LALDict * XLALDictDuplicate(const LALDict *orig)
LALDict * XLALCreateDict(void)
void XLALDictIterInit(LALDictIter *iter, LALDict *dict)
const char * XLALDictEntryGetKey(const LALDictEntry *entry)
int XLALDictInsertStringValue(LALDict *dict, const char *key, const char *string)
const LALValue * XLALDictEntryGetValue(const LALDictEntry *entry)
void XLALDictForeach(LALDict *dict, void(*func)(char *, LALValue *, void *), void *thunk)
REAL8 XLALDictLookupREAL8Value(const LALDict *dict, const char *key)
int XLALDictInsertINT4Value(LALDict *dict, const char *key, INT4 value)
int XLALDictInsertREAL8Value(LALDict *dict, const char *key, REAL8 value)
INT4 XLALDictLookupINT4Value(const LALDict *dict, const char *key)
void XLALDestroyDictSequence(LALDictSequence *sequence)
LALDictSequence * XLALCopyDictSequence(const LALDictSequence *sequence)
LALDictSequence * XLALResizeDictSequence(LALDictSequence *sequence, int first, size_t length)
LALDictSequence * XLALCreateDictSequence(size_t length)
#define LALMalloc(n)
#define LALFree(p)
REAL8 XLALSimInspiralChirpTimeBound(REAL8 fstart, REAL8 m1, REAL8 m2, REAL8 s1, REAL8 s2)
Routine to compute an overestimate of the inspiral time from a given frequency.
REAL8 XLALSimInspiralMergeTimeBound(REAL8 m1, REAL8 m2)
Routine to compute an overestimate of the merger time.
REAL8 XLALSimInspiralRingdownTimeBound(REAL8 M, REAL8 s)
Routine to compute an overestimate of the ringdown time.
REAL8 XLALSimInspiralFinalBlackHoleSpinBound(REAL8 S1z, REAL8 S2z)
Routine to compute an overestimate of a final black hole dimensionless spin.
int XLALSimInspiralGetApproximantFromString(const char *waveform)
Parses a waveform string to determine approximant.
int XLALSimInspiralGeneratorAddConditioningForApproximant(LALSimInspiralGenerator *generator, int approximant)
LIGOTimeGPS * XLALSimInspiralInjectionEndTime(LIGOTimeGPS *epoch, LALDict *injparams)
static int XLALSimInspiralParamsCompareStartTimeToGPSTime(void *thunk UNUSED, const void *a, const void *b)
static const char file_format_attr_val[]
static void XLALSimInspiralDictInsertParameterType(char *key, LALValue *value, void *thunk)
static const char cbc_waveform_params_group[]
LALDictSequence * XLALSimInspiralInjectionSequenceFromH5File(const char *fname)
int XLALSimInspiralInjectionSequenceToH5File(const LALDictSequence *injseq, const char *fname)
int XLALSimInspiralInjectionTDWaveform(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, LALDict *injparams, REAL8 deltaT)
static const char file_format_attr_key[]
static int XLALSimInspiralParamsCompareStartTime(void *thunk UNUSED, const void *a, const void *b)
static int XLALSimInspiralParamsCompareEndTimeToGPSTime(void *thunk UNUSED, const void *a, const void *b)
static int XLALSimInspiralParamsCompareEndTime(void *thunk UNUSED, const void *a, const void *b)
int XLALSimInspiralInjectionSequenceIsStartTimeOrdered(LALDictSequence *injseq)
int XLALSimInspiralInjectionSequenceOrderByStartTime(LALDictSequence *injseq)
static const char * translate_key(const char *key, int inverse)
LIGOTimeGPS * XLALSimInspiralInjectionStartTime(LIGOTimeGPS *epoch, LALDict *injparams)
LALDictSequence * XLALSimInspiralInjectionSequenceInInterval(const LALDictSequence *injseq, const LIGOTimeGPS *start, const LIGOTimeGPS *end)
int XLALSimInspiralInjectionSequenceOrderByEndTime(LALDictSequence *injseq)
REAL8TimeSeries * XLALSimInspiralInjectionStrain(LALDict *injparams, REAL8 deltaT, const LALDetector *detector)
static double si_scale_factor(const char *key)
int XLALSimInspiralInjectionSequenceIsEndTimeOrdered(LALDictSequence *injseq)
int XLALSimInspiralWaveformParamsInsertModeArrayFromModeString(LALDict *params, const char *modestr)
int XLALSimInspiralWaveformParamsInsertDeltaT(LALDict *params, REAL8 value)
const char * name
void XLALDestroyValue(LALValue *value)
LALValue * XLALValueDuplicate(const LALValue *value)
LALTYPECODE XLALValueGetType(const LALValue *value)
INT4 XLALValueGetINT4(const LALValue *value)
double i
Definition: bh_ringdown.c:118
const char * detector
void XLALH5FileClose(LALH5File UNUSED *file)
size_t XLALH5DatasetQueryNPoints(LALH5Dataset UNUSED *dset)
void XLALH5DatasetFree(LALH5Dataset UNUSED *dset)
size_t XLALH5FileQueryNDatasets(const LALH5File UNUSED *file)
int XLALH5AttributeAddString(LALH5Generic UNUSED object, const char UNUSED *key, const char UNUSED *value)
LALH5File * XLALH5GroupOpen(LALH5File UNUSED *file, const char UNUSED *name)
int XLALH5AttributeQueryStringValue(char UNUSED *value, size_t UNUSED size, const LALH5Generic UNUSED object, const char UNUSED *key)
int XLALH5FileQueryDatasetName(char UNUSED *name, size_t UNUSED size, const LALH5File UNUSED *file, int UNUSED pos)
LALTYPECODE XLALH5DatasetQueryType(LALH5Dataset UNUSED *dset)
LALH5File * XLALH5FileOpen(const char UNUSED *path, const char UNUSED *mode)
size_t XLALH5AttributeCheckExists(const LALH5Generic UNUSED object, const char UNUSED *name)
LALH5Dataset * XLALH5DatasetRead(LALH5File UNUSED *file, const char UNUSED *name)
LALH5Dataset * XLALH5DatasetAllocREAL8Vector(LALH5File *file, const char *name, REAL8Vector *vector)
INT4Vector * XLALH5DatasetReadINT4Vector(LALH5Dataset *dset)
LALStringVector * XLALH5DatasetReadStringVector(LALH5Dataset *dset)
LALH5Dataset * XLALH5DatasetAllocINT4Vector(LALH5File *file, const char *name, INT4Vector *vector)
REAL8Vector * XLALH5DatasetReadREAL8Vector(LALH5Dataset *dset)
LALH5Dataset * XLALH5DatasetAllocStringVector(LALH5File *file, const char *name, LALStringVector *vector)
#define LAL_MSUN_SI
#define LAL_PC_SI
LALTYPECODE
#define XLAL_NUM_ELEM(x)
double REAL8
LAL_CHAR_TYPE_CODE
LAL_D_TYPE_CODE
LAL_I4_TYPE_CODE
void * XLALMalloc(size_t n)
void XLALFree(void *p)
int XLALSimInspiralGenerateTDWaveform(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, LALDict *params, LALSimInspiralGenerator *generator)
Returns time-domain polarizations for a specific approximant.
LALSimInspiralGenerator * XLALSimInspiralChooseGenerator(Approximant approx, LALDict *params)
Returns LALSimInspiralGenerator object from approximant.
void XLALDestroySimInspiralGenerator(LALSimInspiralGenerator *generator)
Destroy LALSimInspiralGenerator object.
Approximant
Enum that specifies the PN approximant to be used in computing the waveform.
char * XLALSimInspiralModeArrayToModeString(LALValue *modes)
REAL8TimeSeries * XLALSimDetectorStrainREAL8TimeSeries(const REAL8TimeSeries *hplus, const REAL8TimeSeries *hcross, REAL8 right_ascension, REAL8 declination, REAL8 psi, const LALDetector *detector)
Transforms the waveform polarizations into a detector strain.
char char * XLALStringDuplicate(const char *s)
static const INT4 a
int XLALMergeSort(void *base, size_t nobj, size_t size, void *params, int(*compar)(void *, const void *, const void *))
int XLALIsSorted(void *base, size_t nobj, size_t size, void *params, int(*compar)(void *, const void *, const void *))
ssize_t XLALSearchSorted(const void *key, const void *base, size_t nobj, size_t size, void *params, int(*compar)(void *, const void *, const void *), int side)
void XLALDestroyStringVector(LALStringVector *vect)
LALStringVector * XLALCreateEmptyStringVector(UINT4 length)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
INT4Vector * XLALCreateINT4Vector(UINT4 length)
void XLALDestroyINT4Vector(INT4Vector *vector)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
int XLALGetBaseErrno(void)
#define XLAL_ERROR(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_VAL(val, assertion,...)
int XLALSetErrno(int errnum)
#define XLAL_PRINT_WARNING(...)
#define XLAL_CHECK_FAIL(assertion,...)
#define XLAL_CHECK_NULL(assertion,...)
int XLALClearErrno(void)
#define XLAL_ERROR_FAIL(...)
#define XLAL_IS_REAL8_FAIL_NAN(val)
XLAL_EBADLEN
XLAL_ENOMEM
XLAL_SUCCESS
XLAL_EFAULT
XLAL_ENAME
XLAL_EFUNC
XLAL_ETYPE
XLAL_ESIZE
XLAL_EINVAL
XLAL_FAILURE
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
int XLALGPSCmp(const LIGOTimeGPS *t0, const LIGOTimeGPS *t1)
end
string approximant
INT4 * data
UINT4 length
LIGOTimeGPS epoch
REAL8 * data
LIGOTimeGPS epoch
Definition: unicorn.c:20
double deltaT
Definition: unicorn.c:24