LALFrame 3.0.7.1-eeff03c
LALFrameC.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2013 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#define _GNU_SOURCE /* for mkstemp() */
21
22#include <stdlib.h>
23#include <math.h>
24#include <stdio.h>
25#include <string.h>
26#include <unistd.h>
27#include <lal/LALStdlib.h>
28#include <lal/LALString.h>
29#include <lal/Date.h>
30
31#ifndef P_tmpdir
32#define P_tmpdir "/tmp"
33#endif
34
35/* suppress warnings from FrameC headers; remove this when headers are fixed */
36#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
37#define GCC_DIAG_STR(s) #s
38#define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y)
39# define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
40# define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
41# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
42# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \
43 GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x))
44# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
45# else
46# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x))
47# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x))
48# endif
49#else
50# define GCC_DIAG_OFF(x)
51# define GCC_DIAG_ON(x)
52#endif
53
54GCC_DIAG_OFF(strict-prototypes)
55
56#ifdef CHAR
57#undef CHAR
58#endif
59#define CHAR FRAMEC_CHAR
60#include <framecppc/FrameC.h>
61#include <framecppc/FrameH.h>
62#include <framecppc/Stream.h>
63#include <framecppc/FrTOC.h>
64#undef CHAR
65#define CHAR CHAR
66
67GCC_DIAG_ON(strict-prototypes)
68
69/* resolve incomplete types with FrameC structs and custom structs */
70#define tagLALFrameUFrameH frame_h
71#define tagLALFrameUFrChan fr_chan
72#define tagLALFrameUFrTOC fr_toc_t_
73#define tagLALFrameUFrHistory fr_history
74
75#ifndef FRAMEC_HANDLES_STDIO_STDOUT
77 fr_file_t *handle;
78 fr_file_mode_t mode;
79 FILE *tmpfp;
80};
81#define FRFILE(stream) ((stream)->handle)
82#else
83#define tagLALFrameUFrFile fr_file
84#define FRFILE(stream) (stream)
85#endif
86
87#include <lal/LALFrameU.h>
88#include "LALFrameUFrameC.h"
89
90/* for safety, have a string prefix that is nul-terminated as well */
92 fr_detector_t *handle;
93 char prefix[3];
94};
95
96/* calls a FrameC function and assigns the return value to retval */
97#define CALL_FRAMEC_FUNCTION_RETVAL(retval, err, f, ...) \
98 do { \
99 FrameCError *error = NULL; \
100 retval = f(&error, __VA_ARGS__); \
101 if (error) { \
102 XLAL_PRINT_ERROR("FrameC function %s() failed with code %d: %s", #f, (error)->s_errno, (error)->s_message); \
103 free(error); \
104 err = 1; \
105 } \
106 else \
107 err = 0; \
108 } while (0)
109
110/* calls a FrameC function having no return value */
111#define CALL_FRAMEC_FUNCTION(err, f, ...) \
112 do { \
113 FrameCError *error = NULL; \
114 f(&error, __VA_ARGS__); \
115 if (error) { \
116 XLAL_PRINT_ERROR("FrameC function %s() failed with code %d: %s", #f, (error)->s_errno, (error)->s_message); \
117 free(error); \
118 err = 1; \
119 } \
120 else \
121 err = 0; \
122 } while (0)
123
124/* calls a FrameC and returns with 0 on success or -1 on failure */
125#define TRY_FRAMEC_FUNCTION(f, ...) \
126 do { \
127 int err; \
128 CALL_FRAMEC_FUNCTION(err, f, __VA_ARGS__); \
129 if (err) { \
130 XLAL_ERROR(XLAL_EFUNC); \
131 } \
132 return 0; \
133 } while (0)
134
135/* calls a FrameC and returns a specified retval or errval on failure */
136#define TRY_FRAMEC_FUNCTION_VAL(retval, errval, f, ...) \
137 do { \
138 int err; \
139 CALL_FRAMEC_FUNCTION(err, f, __VA_ARGS__); \
140 if (err) { \
141 XLAL_ERROR_VAL(errval, XLAL_EFUNC); \
142 } \
143 return retval; \
144 } while (0)
145
146/* calls a FrameC and returns its integer return value or -1 on failure */
147#define TRY_FRAMEC_FUNCTION_INT(f, ...) \
148 do { \
149 int retval; \
150 int err; \
151 CALL_FRAMEC_FUNCTION_RETVAL(retval, err, f, __VA_ARGS__); \
152 if (err) { \
153 XLAL_ERROR(XLAL_EFUNC); \
154 } \
155 return retval; \
156 } while (0)
157
158/* calls a FrameC and returns its pointer return value or NULL on failure */
159#define TRY_FRAMEC_FUNCTION_PTR(f, ...) \
160 do { \
161 void *retval; \
162 int err; \
163 CALL_FRAMEC_FUNCTION_RETVAL(retval, err, f, __VA_ARGS__); \
164 if (err) { \
165 XLAL_ERROR_NULL(XLAL_EFUNC); \
166 } \
167 return retval; \
168 } while (0)
169
170/* calls a FrameC and returns */
171#define TRY_FRAMEC_FUNCTION_VOID(f, ...) \
172 do { \
173 int err; \
174 CALL_FRAMEC_FUNCTION(err, f, __VA_ARGS__); \
175 if (err) { \
176 XLAL_ERROR_VOID(XLAL_EFUNC); \
177 } \
178 return; \
179 } while (0)
180
181/*
182 * FrFile functions
183 */
184
185#ifndef FRAMEC_HANDLES_STDIO_STDOUT
186
187#define BUFSZ 16384
188
189void XLALFrameUFrFileClose_FrameC_(LALFrameUFrFile * stream)
190{
191 int err;
192 if (stream) {
193 CALL_FRAMEC_FUNCTION(err, FrameCFileClose, FRFILE(stream));
194 if (stream->tmpfp) {
195 /* must dump temporary file contents to stdout */
196 char buf[BUFSZ];
197 while (fwrite(buf, 1, fread(buf, 1, sizeof(buf), stream->tmpfp), stdout) == sizeof(buf)) ;
198 fclose(stream->tmpfp);
199 }
200 LALFree(stream);
201 if (err)
203 }
204 return;
205}
206
207LALFrameUFrFile *XLALFrameUFrFileOpen_FrameC_(const char *filename, const char *mode)
208{
209 char tmpfname[L_tmpnam + 1] = "";
210 LALFrameUFrFile *stream;
211 int err;
212 stream = LALCalloc(1, sizeof(*stream));
213 if (*mode == 'r')
214 stream->mode = FRAMEC_FILE_MODE_INPUT;
215 else if (*mode == 'w')
216 stream->mode = FRAMEC_FILE_MODE_OUTPUT;
217 else {
218 LALFree(stream);
220 }
221 if (filename == NULL || strcmp(filename, "-") == 0) {
222 /* hack to allow reading from stdin */
223 filename = tmpfname;
224 snprintf(tmpfname, L_tmpnam, "%s/tmp.lal.XXXXXX", P_tmpdir);
225 if (stream->mode == FRAMEC_FILE_MODE_INPUT) {
226 /* dump stdin to a temporary file */
227 char buf[BUFSZ];
228 stream->tmpfp = fdopen(mkstemp(tmpfname), "w");
229 while (fwrite(buf, 1, fread(buf, 1, sizeof(buf), stdin), stream->tmpfp) == sizeof(buf)) ;
230 fclose(stream->tmpfp);
231 stream->tmpfp = NULL;
232 } else {
233 stream->tmpfp = fdopen(mkstemp(tmpfname), "r");
234 }
235 }
236 CALL_FRAMEC_FUNCTION_RETVAL(stream->handle, err, FrameCFileOpen, filename, stream->mode);
237 if (*tmpfname) {
238 unlink(tmpfname); /* remove temporary file when closed */
239 }
240 if (err) {
241 LALFree(stream);
243 }
244 return stream;
245}
246
247int XLALFrameUFileCksumValid_FrameC_(LALFrameUFrFile * stream)
248{
249 TRY_FRAMEC_FUNCTION_INT(FrameCFileCksumValid, FRFILE(stream));
250}
251
252#undef BUFSZ
253
254#else /* defined FRAMEC_HANDLES_STDIN_STDOUT */
255
256void XLALFrameUFrFileClose_FrameC_(LALFrameUFrFile * stream)
257{
258 TRY_FRAMEC_FUNCTION_VOID(FrameCFileClose, stream);
259}
260
261LALFrameUFrFile *XLALFrameUFrFileOpen_FrameC_(const char *filename, const char *mode)
262{
263 fr_file_mode_t m;
264 if (*mode == 'r')
265 m = FRAMEC_FILE_MODE_INPUT;
266 else if (*mode == 'w')
267 m = FRAMEC_FILE_MODE_OUTPUT;
268 else
269 return NULL;
270 /* FIXME: does this work? */
271 if (filename == NULL)
272 filename = "-"; /* indicates we should use stdin or stdout */
273 TRY_FRAMEC_FUNCTION_PTR(FrameCFileOpen, filename, m);
274}
275
276int XLALFrameUFileCksumValid_FrameC_(LALFrameUFrFile * stream)
277{
278 TRY_FRAMEC_FUNCTION_INT(FrameCFileCksumValid, stream);
279}
280
281#endif /* defined FRAMEC_HANDLES_STDIN_STDOUT */
282
283/*
284 * FrTOC functions
285 */
286
288{
289 TRY_FRAMEC_FUNCTION_VOID(FrameCFrTOCFree, toc);
290}
291
293{
294 TRY_FRAMEC_FUNCTION_PTR(FrameCFrTOCRead, FRFILE(stream));
295}
296
298{
299 fr_toc_nframe_t nframe;
300 TRY_FRAMEC_FUNCTION_VAL(nframe, -1, FrameCFrTOCQuery, toc, FR_TOC_FIELD_NFRAME, &nframe, FR_TOC_FIELD_LAST);
301}
302
303double XLALFrameUFrTOCQueryGTimeModf_FrameC_(double *iptr, const LALFrameUFrTOC * toc, size_t pos)
304{
305 fr_toc_nframe_t nframe;
306 fr_toc_t0_t *gtime;
308 int err;
309 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_NFRAME, &nframe, FR_TOC_FIELD_LAST);
310 if (err || nframe <= pos)
312 gtime = LALCalloc(nframe, sizeof(*gtime));
313 if (!gtime)
315 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_GTIME, gtime, nframe, FR_TOC_FIELD_LAST);
316 if (err) {
317 LALFree(gtime);
319 }
320 XLALGPSSet(&epoch, gtime[pos].sec, gtime[pos].nan);
321 LALFree(gtime);
322 return XLALGPSModf(iptr, &epoch);
323}
324
325double XLALFrameUFrTOCQueryDt_FrameC_(const LALFrameUFrTOC * toc, size_t pos)
326{
327 fr_toc_nframe_t nframe;
328 fr_toc_dt_t dt;
329 double retval;
330 int err;
331 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_NFRAME, &nframe, FR_TOC_FIELD_LAST);
332 if (err || nframe <= pos)
333 return -1.0;
334 dt = LALCalloc(nframe, sizeof(*dt));
335 if (!dt)
336 return -1.0;
337 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_DT, dt, nframe, FR_TOC_FIELD_LAST);
338 retval = err ? -1.0 : dt[pos];
339 LALFree(dt);
340 return retval;
341}
342
344{
345 fr_toc_adc_n_t n;
346 TRY_FRAMEC_FUNCTION_VAL(n, -1, FrameCFrTOCQuery, toc, FR_TOC_FIELD_ADC_N, &n, FR_TOC_FIELD_LAST);
347}
348
349/* WARNING: returns pointer to memory that is lost when frame is freed */
350const char *XLALFrameUFrTOCQueryAdcName_FrameC_(const LALFrameUFrTOC * toc, size_t adc)
351{
352 fr_toc_adc_name_t *names;
353 fr_toc_adc_n_t n;
354 const char *name;
355 int err;
356 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_ADC_N, &n, FR_TOC_FIELD_LAST);
357 if (err || n <= adc)
358 return NULL;
359 names = LALCalloc(n, sizeof(*names));
360 if (!names)
361 return NULL;
362 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_ADC_NAMES, names, n, FR_TOC_FIELD_LAST);
363 name = err ? NULL : names[adc];
364 LALFree(names);
365 return name;
366}
367
369{
370 fr_toc_sim_n_t n;
371 TRY_FRAMEC_FUNCTION_VAL(n, -1, FrameCFrTOCQuery, toc, FR_TOC_FIELD_SIM_N, &n, FR_TOC_FIELD_LAST);
372}
373
374/* WARNING: returns pointer to memory that is lost when frame is freed */
375const char *XLALFrameUFrTOCQuerySimName_FrameC_(const LALFrameUFrTOC * toc, size_t sim)
376{
377 fr_toc_sim_name_t *names;
378 fr_toc_sim_n_t n;
379 const char *name;
380 int err;
381 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_SIM_N, &n, FR_TOC_FIELD_LAST);
382 if (err || n <= sim)
383 return NULL;
384 names = LALCalloc(n, sizeof(*names));
385 if (!names)
386 return NULL;
387 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_SIM_NAMES, names, n, FR_TOC_FIELD_LAST);
388 name = err ? NULL : names[sim];
389 LALFree(names);
390 return name;
391}
392
394{
395 fr_toc_proc_n_t n;
396 TRY_FRAMEC_FUNCTION_VAL(n, -1, FrameCFrTOCQuery, toc, FR_TOC_FIELD_PROC_N, &n, FR_TOC_FIELD_LAST);
397}
398
399/* WARNING: returns pointer to memory that is lost when frame is freed */
400const char *XLALFrameUFrTOCQueryProcName_FrameC_(const LALFrameUFrTOC * toc, size_t proc)
401{
402 fr_toc_proc_name_t *names;
403 fr_toc_proc_n_t n;
404 const char *name;
405 int err;
406 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_PROC_N, &n, FR_TOC_FIELD_LAST);
407 if (err || n <= proc)
408 return NULL;
409 names = LALCalloc(n, sizeof(*names));
410 if (!names)
411 return NULL;
412 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_PROC_NAMES, names, n, FR_TOC_FIELD_LAST);
413 name = err ? NULL : names[proc];
414 LALFree(names);
415 return name;
416}
417
419{
420 fr_toc_detector_n_t n;
421 TRY_FRAMEC_FUNCTION_VAL(n, -1, FrameCFrTOCQuery, toc, FR_TOC_FIELD_DETECTOR_N, &n, FR_TOC_FIELD_LAST);
422}
423
424/* WARNING: returns pointer to memory that is lost when frame is freed */
426{
427 fr_toc_detector_name_t *names;
428 fr_toc_detector_n_t n;
429 const char *name;
430 int err;
431 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_DETECTOR_N, &n, FR_TOC_FIELD_LAST);
432 if (err || n <= det)
433 return NULL;
434 names = LALCalloc(n, sizeof(*names));
435 if (!names)
436 return NULL;
437 CALL_FRAMEC_FUNCTION(err, FrameCFrTOCQuery, toc, FR_TOC_FIELD_DETECTOR_NAMES, names, n, FR_TOC_FIELD_LAST);
438 name = err ? NULL : names[det];
439 LALFree(names);
440 return name;
441}
442
443/*
444 * FrameH functions
445 */
446
448{
449 TRY_FRAMEC_FUNCTION_VOID(FrameCFrameHFree, frame);
450}
451
452LALFrameUFrameH *XLALFrameUFrameHAlloc_FrameC_(const char *name, double start1, double start2, double dt, int frnum)
453{
454 double fp, fp1, fp2;
455 double ip, ip1, ip2;
456 frame_h_gtime_t gtime;
457
458 /* break start time into integer and fractional parts */
459 fp1 = modf(start1, &ip1);
460 fp2 = modf(start2, &ip2);
461 fp = modf(fp1 + fp2, &ip);
462 ip += ip1 + ip2;
463 if (fp < 0.0) { /* make sure fractional part is positive */
464 fp += 1.0;
465 ip -= 1.0;
466 }
467
468 gtime.sec = ip;
469 gtime.nan = floor(0.5 + 1e9 * fp);
470 if (gtime.nan >= 1000000000) { /* handle round-up corner case */
471 gtime.nan -= 1000000000;
472 gtime.sec += 1;
473 }
474
475 TRY_FRAMEC_FUNCTION_PTR(FrameCFrameHAlloc, name, gtime, dt, frnum);
476}
477
478LALFrameUFrameH *XLALFrameUFrameHRead_FrameC_(LALFrameUFrFile * stream, int pos)
479{
480 TRY_FRAMEC_FUNCTION_PTR(FrameCFrameHRead, FRFILE(stream), pos);
481}
482
483int XLALFrameUFrameHWrite_FrameC_(LALFrameUFrFile * stream, LALFrameUFrameH * frame)
484{
485 TRY_FRAMEC_FUNCTION(FrameCFrameHWrite, FRFILE(stream), frame);
486}
487
488/* function to add a channel to a frame */
489
491{
492 TRY_FRAMEC_FUNCTION(FrameCFrameHFrChanAdd, frame, channel);
493}
494
495/* function to add a detector to a frame */
496
497int XLALFrameUFrameHFrDetectorAdd_FrameC_(LALFrameUFrameH * frame, LALFrameUFrDetector * detector)
498{
499 TRY_FRAMEC_FUNCTION(FrameCFrameHFrDetectorAdd, frame, detector->handle);
500}
501
502/* function to add a detector to a frame */
503
505{
506 TRY_FRAMEC_FUNCTION(FrameCFrameHFrHistoryAdd, frame, history);
507}
508
509/* functions to query frame metadata */
510
511/* WARNING: returns pointer to memory that is lost when frame is freed */
513{
514 frame_h_name_t name;
515 TRY_FRAMEC_FUNCTION_VAL(name, NULL, FrameCFrameHQuery, frame, FRAME_H_FIELD_NAME, &name, FRAME_H_FIELD_LAST);
516}
517
519{
520 frame_h_run_t run;
521 TRY_FRAMEC_FUNCTION_VAL(run, -1, FrameCFrameHQuery, frame, FRAME_H_FIELD_RUN, &run, FRAME_H_FIELD_LAST);
522}
523
525{
526 frame_h_frame_t frnum;
527 TRY_FRAMEC_FUNCTION_VAL(frnum, -1, FrameCFrameHQuery, frame, FRAME_H_FIELD_FRAME, &frnum, FRAME_H_FIELD_LAST);
528}
529
531{
532 frame_h_data_quality_t dq;
533 TRY_FRAMEC_FUNCTION_VAL(dq, -1, FrameCFrameHQuery, frame, FRAME_H_FIELD_DATA_QUALITY, &dq, FRAME_H_FIELD_LAST);
534}
535
537{
538 frame_h_gtime_t start;
541 start.nan)), XLAL_REAL8_FAIL_NAN, FrameCFrameHQuery, frame, FRAME_H_FIELD_GTIME, &start, FRAME_H_FIELD_LAST);
542}
543
545{
546 frame_h_uleaps_t uleaps;
547 TRY_FRAMEC_FUNCTION_VAL(uleaps, -1, FrameCFrameHQuery, frame, FRAME_H_FIELD_ULEAPS, &uleaps, FRAME_H_FIELD_LAST);
548}
549
551{
552 frame_h_dt_t dt;
553 TRY_FRAMEC_FUNCTION_VAL(dt, -1, FrameCFrameHQuery, frame, FRAME_H_FIELD_DT, &dt, FRAME_H_FIELD_LAST);
554}
555
556/* functions to set frame metadata */
557
559{
560 frame_h_run_t run_ = run;
561 TRY_FRAMEC_FUNCTION(FrameCFrameHSet, frame, FRAME_H_FIELD_RUN, run_, FRAME_H_FIELD_LAST);
562}
563
564/*
565 * FrChan functions
566 */
567
569{
570 TRY_FRAMEC_FUNCTION_VOID(FrameCFrChanFree, channel);
571}
572
573LALFrameUFrChan *XLALFrameUFrChanRead_FrameC_(LALFrameUFrFile * stream, const char *name, size_t pos)
574{
575 TRY_FRAMEC_FUNCTION_PTR(FrameCFrChanRead, FRFILE(stream), name, pos);
576}
577
578LALFrameUFrChan *XLALFrameUFrAdcChanAlloc_FrameC_(const char *name, int dtype, size_t ndata)
579{
580 TRY_FRAMEC_FUNCTION_PTR(FrameCFrChanAlloc, name, FR_ADC_CHAN_TYPE, dtype, ndata);
581}
582
583LALFrameUFrChan *XLALFrameUFrSimChanAlloc_FrameC_(const char *name, int dtype, size_t ndata)
584{
585 TRY_FRAMEC_FUNCTION_PTR(FrameCFrChanAlloc, name, FR_SIM_CHAN_TYPE, dtype, ndata);
586}
587
588static fr_proc_type_t XLALFrProcType(int type)
589{
590 switch (type) {
591 case 0:
592 return FR_PROC_TYPE_UNKNOWN;
593 case 1:
594 return FR_PROC_TYPE_TIME_SERIES;
595 case 2:
596 return FR_PROC_TYPE_FREQUENCY_SERIES;
597 case 3:
598 return FR_PROC_TYPE_OTHER_1D_SERIES;
599 case 4:
600 return FR_PROC_TYPE_TIME_FREQUENCY;
601 case 5:
602 return FR_PROC_TYPE_WAVELET;
603 case 6:
604 /* NOTE: lower case r in Fr */
605 return Fr_PROC_TYPE_MULTI_DIMENSIONAL;
606 default:
607 return -1;
608 }
609}
610
611static fr_proc_sub_type_t XLALFrProcSubType(int subtype)
612{
613 switch (subtype) {
614 case 0:
615 return FR_PROC_SUB_TYPE_UNKNOWN;
616 case 1:
617 return FR_PROC_SUB_TYPE_DFT;
618 case 2:
619 return FR_PROC_SUB_TYPE_AMPLITUDE_SPECTRAL_DENSITY;
620 case 3:
621 return FR_PROC_SUB_TYPE_POWER_SPECTRAL_DENSITY;
622 case 4:
623 return FR_PROC_SUB_TYPE_CROSS_SPECTRAL_DENSITY;
624 case 5:
625 return FR_PROC_SUB_TYPE_COHERENCE;
626 case 6:
627 return FR_PROC_SUB_TYPE_TRANSFER_FUNCTION;
628 default:
629 return -1;
630 }
631}
632
633LALFrameUFrChan *XLALFrameUFrProcChanAlloc_FrameC_(const char *name, int type, int subtype, int dtype, size_t ndata)
634{
635 TRY_FRAMEC_FUNCTION_PTR(FrameCFrProcChanAlloc, name, XLALFrProcType(type), XLALFrProcSubType(subtype), dtype, ndata);
636}
637
638/* channel query functions */
639
640/* WARNING: returns pointer to memory that is lost when frame is freed */
641const char *XLALFrameUFrChanQueryName_FrameC_(const LALFrameUFrChan * channel)
642{
643 fr_chan_name_t name;
644 TRY_FRAMEC_FUNCTION_VAL(name, NULL, FrameCFrChanQuery, channel, FR_CHAN_FIELD_NAME, &name, FR_CHAN_FIELD_LAST);
645}
646
648{
649 fr_chan_time_offset_t offset;
650 TRY_FRAMEC_FUNCTION_VAL(offset, 0, FrameCFrChanQuery, channel, FR_CHAN_FIELD_TIME_OFFSET, &offset, FR_CHAN_FIELD_LAST);
651}
652
653/* channel set functions */
654
655int XLALFrameUFrChanSetSampleRate_FrameC_(LALFrameUFrChan * channel, double sampleRate)
656{
657 fr_chan_sample_rate_t srate = sampleRate;
658 TRY_FRAMEC_FUNCTION(FrameCFrChanSet, channel, FR_CHAN_FIELD_SAMPLE_RATE, srate, FR_CHAN_FIELD_LAST);
659}
660
661int XLALFrameUFrChanSetTimeOffset_FrameC_(LALFrameUFrChan * channel, double timeOffset)
662{
663 fr_chan_time_offset_t offset = timeOffset;
664 TRY_FRAMEC_FUNCTION(FrameCFrChanSet, channel, FR_CHAN_FIELD_TIME_OFFSET, offset, FR_CHAN_FIELD_LAST);
665}
666
667int XLALFrameUFrChanSetTRange_FrameC_(LALFrameUFrChan * channel, double tRange)
668{
669 fr_chan_t_range_t dt = tRange;
670 TRY_FRAMEC_FUNCTION(FrameCFrChanSet, channel, FR_CHAN_FIELD_T_RANGE, dt, FR_CHAN_FIELD_LAST);
671}
672
673/*
674 * FrVect functions
675 */
676
677int XLALFrameUFrChanVectorAlloc_FrameC_(LALFrameUFrChan * channel, int dtype, size_t ndata)
678{
679 TRY_FRAMEC_FUNCTION(FrameCFrChanVectorAlloc, channel, dtype, ndata);
680}
681
682/* get the FrameC compression scheme for a particular compressLevel */
683/* UNUSED */
684/*
685static fr_vect_compression_schemes_t XLALFrVectCompressionScheme(int compressLevel)
686{
687 switch (compressLevel) {
688 case 0:
689 case 256:
690 return FR_VECT_COMPRESS_RAW;
691 case 1:
692 case 257:
693 return FR_VECT_COMPRESS_GZIP;
694 case 3:
695 case 259:
696 return FR_VECT_COMPRESS_DIFF_GZIP;
697 case 5:
698 case 261:
699 return FR_VECT_COMPRESS_ZERO_SUPPRESS_WORD_2;
700 case 8:
701 case 264:
702 return FR_VECT_COMPRESS_ZERO_SUPPRESS_WORD_4;
703 default:
704 return FR_VECT_COMPRESS_UNKNOWN;
705 }
706}
707*/
708
709/* functions to compress and expand FrVect structures within a channel */
710
711int XLALFrameUFrChanVectorCompress_FrameC_(LALFrameUFrChan * channel, int compressLevel)
712{
713 /* Work around bug in FrameC FrameCFrChanVectorCompress() by disabling
714 * compression. Revert this once FrameCFrChanVectorCompress() works. */
715 (void)channel;
716 (void)compressLevel;
717 XLAL_PRINT_WARNING("Compression not currently implemented with FrameC");
718 return 0;
719 /*
720 TRY_FRAMEC_FUNCTION(FrameCFrChanVectorCompress, channel, XLALFrVectCompressionScheme(compressLevel));
721 */
722}
723
725{
726 TRY_FRAMEC_FUNCTION(FrameCFrChanVectorExpand, channel);
727}
728
729/* functions to query FrVect structures within a channel */
730
731/* WARNING: returns pointer to memory that is lost when frame is freed */
732const char *XLALFrameUFrChanVectorQueryName_FrameC_(const LALFrameUFrChan * channel)
733{
734 fr_vect_name_t name;
735 TRY_FRAMEC_FUNCTION_VAL(name, NULL, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_NAME, &name, FR_VECT_FIELD_LAST);
736}
737
739{
740 fr_vect_compress_t compress;
741 TRY_FRAMEC_FUNCTION_VAL(compress, -1, FrameCFrChanVectorQuery, channel,
742 FR_VECT_FIELD_COMPRESS, &compress, FR_VECT_FIELD_LAST);
743}
744
746{
747 fr_vect_type_t type;
748 TRY_FRAMEC_FUNCTION_VAL(type, -1, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_TYPE, &type, FR_VECT_FIELD_LAST);
749}
750
751/* retrieves a handle to the data vector in the FrVect structure */
753{
754 fr_vect_data_t data;
755 TRY_FRAMEC_FUNCTION_VAL(data, NULL, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_DATA, &data, FR_VECT_FIELD_LAST);
756}
757
759{
760 fr_vect_nbytes_t nbytes;
761 TRY_FRAMEC_FUNCTION_VAL(nbytes, -1, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_NBYTES, &nbytes, FR_VECT_FIELD_LAST);
762}
763
765{
766 fr_vect_ndata_t ndata;
767 TRY_FRAMEC_FUNCTION_VAL(ndata, -1, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_NDATA, &ndata, FR_VECT_FIELD_LAST);
768}
769
771{
772 fr_vect_ndim_t ndim;
773 TRY_FRAMEC_FUNCTION_VAL(ndim, -1, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_NDIM, &ndim, FR_VECT_FIELD_LAST);
774}
775
776size_t XLALFrameUFrChanVectorQueryNx_FrameC_(const LALFrameUFrChan * channel, size_t dim)
777{
778 fr_vect_ndim_t ndim;
779 fr_vect_nx_t *nx;
780 int err;
781 size_t retval;
782 CALL_FRAMEC_FUNCTION(err, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_NDIM, &ndim, FR_VECT_FIELD_LAST);
783 if (err || ndim <= dim)
784 return -1;
785 nx = LALCalloc(ndim, sizeof(*nx));
786 if (!nx)
787 return -1;
788 CALL_FRAMEC_FUNCTION(err, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_NX, nx, ndim, FR_VECT_FIELD_LAST);
789 retval = err ? (size_t) (-1) : nx[dim];
790 LALFree(nx);
791 return retval;
792}
793
794double XLALFrameUFrChanVectorQueryDx_FrameC_(const LALFrameUFrChan * channel, size_t dim)
795{
796 fr_vect_ndim_t ndim;
797 fr_vect_dx_t *dx;
798 int err;
799 double retval;
800 CALL_FRAMEC_FUNCTION(err, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_NDIM, &ndim, FR_VECT_FIELD_LAST);
801 if (err || ndim <= dim)
802 return -1.0;
803 dx = LALCalloc(ndim, sizeof(*dx));
804 if (!dx)
805 return -1.0;
806 CALL_FRAMEC_FUNCTION(err, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_DX, dx, ndim, FR_VECT_FIELD_LAST);
807 retval = err ? -1.0 : dx[dim];
808 LALFree(dx);
809 return retval;
810}
811
812double XLALFrameUFrChanVectorQueryStartX_FrameC_(const LALFrameUFrChan * channel, size_t dim)
813{
814 fr_vect_ndim_t ndim;
815 fr_vect_startx_t *startX;
816 int err;
817 double retval;
818 CALL_FRAMEC_FUNCTION(err, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_NDIM, &ndim, FR_VECT_FIELD_LAST);
819 if (err || ndim <= dim)
820 return -1.0;
821 startX = LALCalloc(ndim, sizeof(*startX));
822 if (!startX)
823 return -1.0;
824 CALL_FRAMEC_FUNCTION(err, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_START_X, startX, ndim, FR_VECT_FIELD_LAST);
825 retval = err ? -1.0 : startX[dim];
826 LALFree(startX);
827 return retval;
828}
829
830/* WARNING: returns pointer to memory that is lost when frame is freed */
831const char *XLALFrameUFrChanVectorQueryUnitX_FrameC_(const LALFrameUFrChan * channel, size_t dim)
832{
833 fr_vect_ndim_t ndim;
834 fr_vect_unit_x_t *unitX;
835 int err;
836 const char *retval;
837 CALL_FRAMEC_FUNCTION(err, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_NDIM, &ndim, FR_VECT_FIELD_LAST);
838 if (err || ndim <= dim)
839 return NULL;
840 unitX = LALCalloc(ndim, sizeof(*unitX));
841 if (!unitX)
842 return NULL;
843 CALL_FRAMEC_FUNCTION(err, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_UNIT_X, unitX, ndim, FR_VECT_FIELD_LAST);
844 retval = err ? NULL : unitX[dim];
845 LALFree(unitX);
846 return retval;
847}
848
849/* WARNING: returns pointer to memory that is lost when frame is freed */
850const char *XLALFrameUFrChanVectorQueryUnitY_FrameC_(const LALFrameUFrChan * channel)
851{
852 fr_vect_unit_y_t unitY;
853 TRY_FRAMEC_FUNCTION_VAL(unitY, NULL, FrameCFrChanVectorQuery, channel, FR_VECT_FIELD_UNIT_Y, &unitY, FR_VECT_FIELD_LAST);
854}
855
856/* functions to set FrVect structures within a channel */
857
858int XLALFrameUFrChanVectorSetName_FrameC_(LALFrameUFrChan * channel, const char *name)
859{
860 TRY_FRAMEC_FUNCTION(FrameCFrChanVectorSet, channel, FR_VECT_FIELD_NAME, (fr_vect_name_t) (name), FR_VECT_FIELD_LAST);
861}
862
863int XLALFrameUFrChanVectorSetUnitY_FrameC_(LALFrameUFrChan * channel, const char *unit)
864{
865 TRY_FRAMEC_FUNCTION(FrameCFrChanVectorSet, channel, FR_VECT_FIELD_UNIT_Y,
866 (fr_vect_unit_y_t) (unit), 1, FR_VECT_FIELD_LAST);
867}
868
869/* NOTE: only support 1-dimensional vectors */
870
871int XLALFrameUFrChanVectorSetDx_FrameC_(LALFrameUFrChan * channel, double dx)
872{
873 fr_vect_dx_t dx_ = dx;
874 TRY_FRAMEC_FUNCTION(FrameCFrChanVectorSet, channel, FR_VECT_FIELD_DX, &dx_, 1, FR_VECT_FIELD_LAST);
875}
876
877int XLALFrameUFrChanVectorSetStartX_FrameC_(LALFrameUFrChan * channel, double x0)
878{
879 fr_vect_startx_t x0_ = x0;
880 TRY_FRAMEC_FUNCTION(FrameCFrChanVectorSet, channel, FR_VECT_FIELD_START_X, &x0_, 1, FR_VECT_FIELD_LAST);
881}
882
883int XLALFrameUFrChanVectorSetUnitX_FrameC_(LALFrameUFrChan * channel, const char *unit)
884{
885 fr_vect_unit_x_t unit_ = unit;
886 TRY_FRAMEC_FUNCTION(FrameCFrChanVectorSet, channel, FR_VECT_FIELD_UNIT_X, &unit_, 1, FR_VECT_FIELD_LAST);
887}
888
889/*
890 * FrDetector functions
891 */
892
893void XLALFrameUFrDetectorFree_FrameC_(LALFrameUFrDetector * detector)
894{
895 if (detector) {
896 int err;
897 CALL_FRAMEC_FUNCTION(err, FrameCFrDetectorFree, detector->handle);
898 LALFree(detector);
899 if (err)
901 }
902 return;
903}
904
905LALFrameUFrDetector *XLALFrameUFrDetectorRead_FrameC_(LALFrameUFrFile * stream, const char *name)
906{
907 fr_detector_prefix_t prefix;
908 LALFrameUFrDetector *detector;
909 int err;
910 detector = LALCalloc(1, sizeof(*detector));
911 if (!detector)
912 return NULL;
913 CALL_FRAMEC_FUNCTION(err, detector->handle = FrameCFrDetectorRead, FRFILE(stream), name);
914 if (err || !detector->handle) {
916 return NULL;
917 }
918 /* read the prefix and use it to set the detector's prefix */
919 CALL_FRAMEC_FUNCTION(err, FrameCFrDetectorQuery, detector->handle,
920 FR_DETECTOR_FIELD_PREFIX, &prefix, FR_DETECTOR_FIELD_LAST);
921 if (err) {
923 return NULL;
924 }
925 memcpy(detector->prefix, prefix.prefix, 2);
926 return detector;
927}
928
929LALFrameUFrDetector *XLALFrameUFrDetectorAlloc_FrameC_(const char *name,
930 const char *prefix, double latitude, double longitude, double elevation,
931 double azimuthX, double azimuthY, double altitudeX, double altitudeY, double midpointX, double midpointY, int localTime)
932{
933 LALFrameUFrDetector *detector;
934 int err;
935 detector = LALCalloc(1, sizeof(*detector));
936 if (!detector)
937 return NULL;
938 if (prefix)
939 memcpy(detector->prefix, prefix, 2);
940 CALL_FRAMEC_FUNCTION_RETVAL(detector->handle, err, FrameCFrDetectorAlloc,
941 name, prefix, latitude, longitude, elevation, azimuthX, azimuthY,
942 altitudeX, altitudeY, midpointX, midpointY, localTime);
943 if (err || !detector->handle) {
945 return NULL;
946 }
947 return detector;
948}
949
950/* WARNING: returns pointer to memory that is lost when frame is freed */
951const char *XLALFrameUFrDetectorQueryName_FrameC_(const LALFrameUFrDetector * detector)
952{
953 fr_detector_name_t name;
954 TRY_FRAMEC_FUNCTION_VAL(name, NULL, FrameCFrDetectorQuery,
955 detector->handle, FR_DETECTOR_FIELD_NAME, &name, FR_DETECTOR_FIELD_LAST);
956}
957
958/* WARNING: returns pointer to memory that is lost when frame is freed */
959const char *XLALFrameUFrDetectorQueryPrefix_FrameC_(const LALFrameUFrDetector * detector)
960{
961 return detector->prefix;
962}
963
964double XLALFrameUFrDetectorQueryLongitude_FrameC_(const LALFrameUFrDetector * detector)
965{
966 fr_detector_longitude_t longitude;
967 TRY_FRAMEC_FUNCTION_VAL(longitude, -1.0, FrameCFrDetectorQuery,
968 detector->handle, FR_DETECTOR_FIELD_LONGITUDE, &longitude, FR_DETECTOR_FIELD_LAST);
969}
970
971double XLALFrameUFrDetectorQueryLatitude_FrameC_(const LALFrameUFrDetector * detector)
972{
973 fr_detector_latitude_t latitude;
974 TRY_FRAMEC_FUNCTION_VAL(latitude, -1.0, FrameCFrDetectorQuery,
975 detector->handle, FR_DETECTOR_FIELD_LATITUDE, &latitude, FR_DETECTOR_FIELD_LAST);
976}
977
978double XLALFrameUFrDetectorQueryElevation_FrameC_(const LALFrameUFrDetector * detector)
979{
980 fr_detector_elevation_t elevation;
981 TRY_FRAMEC_FUNCTION_VAL(elevation, -1.0, FrameCFrDetectorQuery,
982 detector->handle, FR_DETECTOR_FIELD_ELEVATION, &elevation, FR_DETECTOR_FIELD_LAST);
983}
984
985double XLALFrameUFrDetectorQueryArmXAzimuth_FrameC_(const LALFrameUFrDetector * detector)
986{
987 fr_detector_arm_x_azimuth_t armXazimuth;
988 TRY_FRAMEC_FUNCTION_VAL(armXazimuth, -1.0, FrameCFrDetectorQuery,
989 detector->handle, FR_DETECTOR_FIELD_ARM_X_AZIMUTH, &armXazimuth, FR_DETECTOR_FIELD_LAST);
990}
991
992double XLALFrameUFrDetectorQueryArmYAzimuth_FrameC_(const LALFrameUFrDetector * detector)
993{
994 fr_detector_arm_y_azimuth_t armYazimuth;
995 TRY_FRAMEC_FUNCTION_VAL(armYazimuth, -1.0, FrameCFrDetectorQuery,
996 detector->handle, FR_DETECTOR_FIELD_ARM_Y_AZIMUTH, &armYazimuth, FR_DETECTOR_FIELD_LAST);
997}
998
999double XLALFrameUFrDetectorQueryArmXAltitude_FrameC_(const LALFrameUFrDetector * detector)
1000{
1001 fr_detector_arm_x_altitude_t armXaltitude;
1002 TRY_FRAMEC_FUNCTION_VAL(armXaltitude, -1.0, FrameCFrDetectorQuery,
1003 detector->handle, FR_DETECTOR_FIELD_ARM_X_ALTITUDE, &armXaltitude, FR_DETECTOR_FIELD_LAST);
1004}
1005
1006double XLALFrameUFrDetectorQueryArmYAltitude_FrameC_(const LALFrameUFrDetector * detector)
1007{
1008 fr_detector_arm_y_altitude_t armYaltitude;
1009 TRY_FRAMEC_FUNCTION_VAL(armYaltitude, -1.0, FrameCFrDetectorQuery,
1010 detector->handle, FR_DETECTOR_FIELD_ARM_Y_ALTITUDE, &armYaltitude, FR_DETECTOR_FIELD_LAST);
1011}
1012
1013double XLALFrameUFrDetectorQueryArmXMidpoint_FrameC_(const LALFrameUFrDetector * detector)
1014{
1015 fr_detector_arm_x_midpoint_t armXmidpoint;
1016 TRY_FRAMEC_FUNCTION_VAL(armXmidpoint, -1.0, FrameCFrDetectorQuery,
1017 detector->handle, FR_DETECTOR_FIELD_ARM_X_MIDPOINT, &armXmidpoint, FR_DETECTOR_FIELD_LAST);
1018}
1019
1020double XLALFrameUFrDetectorQueryArmYMidpoint_FrameC_(const LALFrameUFrDetector * detector)
1021{
1022 fr_detector_arm_y_midpoint_t armYmidpoint;
1023 TRY_FRAMEC_FUNCTION_VAL(armYmidpoint, -1.0, FrameCFrDetectorQuery,
1024 detector->handle, FR_DETECTOR_FIELD_ARM_Y_MIDPOINT, &armYmidpoint, FR_DETECTOR_FIELD_LAST);
1025}
1026
1027int XLALFrameUFrDetectorQueryLocalTime_FrameC_(const LALFrameUFrDetector * detector)
1028{
1029 fr_detector_localtime_t localTime;
1030 TRY_FRAMEC_FUNCTION_VAL(localTime, -1.0, FrameCFrDetectorQuery,
1031 detector->handle, FR_DETECTOR_FIELD_LOCAL_TIME, &localTime, FR_DETECTOR_FIELD_LAST);
1032}
1033
1034/*
1035 * FrHistory routines
1036 */
1037
1039{
1040 TRY_FRAMEC_FUNCTION_VOID(FrameCFrHistoryFree, history);
1041}
1042
1043LALFrameUFrHistory *XLALFrameUFrHistoryAlloc_FrameC_(const char *name, double gpssec, const char *comment)
1044{
1045 TRY_FRAMEC_FUNCTION_PTR(FrameCFrHistoryAlloc, name, (fr_history_time_t) floor(gpssec), comment);
1046}
const char * XLALFrameUFrChanVectorQueryName_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:732
double XLALFrameUFrDetectorQueryArmXAzimuth_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:985
const char * XLALFrameUFrTOCQuerySimName_FrameC_(const LALFrameUFrTOC *toc, size_t sim)
Definition: LALFrameC.c:375
#define P_tmpdir
Definition: LALFrameC.c:32
int XLALFrameUFrChanSetTimeOffset_FrameC_(LALFrameUFrChan *channel, double timeOffset)
Definition: LALFrameC.c:661
LALFrameUFrChan * XLALFrameUFrProcChanAlloc_FrameC_(const char *name, int type, int subtype, int dtype, size_t ndata)
Definition: LALFrameC.c:633
#define FRFILE(stream)
Definition: LALFrameC.c:81
LALFrameUFrTOC * XLALFrameUFrTOCRead_FrameC_(LALFrameUFrFile *stream)
Definition: LALFrameC.c:292
int XLALFrameUFrameHQueryRun_FrameC_(const LALFrameUFrameH *frame)
Definition: LALFrameC.c:518
int XLALFrameUFrameHWrite_FrameC_(LALFrameUFrFile *stream, LALFrameUFrameH *frame)
Definition: LALFrameC.c:483
size_t XLALFrameUFrChanVectorQueryNBytes_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:758
int XLALFrameUFrChanVectorSetName_FrameC_(LALFrameUFrChan *channel, const char *name)
Definition: LALFrameC.c:858
int XLALFrameUFrameHFrDetectorAdd_FrameC_(LALFrameUFrameH *frame, LALFrameUFrDetector *detector)
Definition: LALFrameC.c:497
const char * XLALFrameUFrChanVectorQueryUnitY_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:850
LALFrameUFrameH * XLALFrameUFrameHAlloc_FrameC_(const char *name, double start1, double start2, double dt, int frnum)
Definition: LALFrameC.c:452
const char * XLALFrameUFrDetectorQueryPrefix_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:959
int XLALFrameUFrChanSetSampleRate_FrameC_(LALFrameUFrChan *channel, double sampleRate)
Definition: LALFrameC.c:655
LALFrameUFrChan * XLALFrameUFrSimChanAlloc_FrameC_(const char *name, int dtype, size_t ndata)
Definition: LALFrameC.c:583
void XLALFrameUFrHistoryFree_FrameC_(LALFrameUFrHistory *history)
Definition: LALFrameC.c:1038
double XLALFrameUFrDetectorQueryElevation_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:978
#define TRY_FRAMEC_FUNCTION_PTR(f,...)
Definition: LALFrameC.c:159
int XLALFrameUFrameHQueryFrame_FrameC_(const LALFrameUFrameH *frame)
Definition: LALFrameC.c:524
#define GCC_DIAG_ON(x)
Definition: LALFrameC.c:51
#define TRY_FRAMEC_FUNCTION_VOID(f,...)
Definition: LALFrameC.c:171
int XLALFrameUFrChanVectorExpand_FrameC_(LALFrameUFrChan *channel)
Definition: LALFrameC.c:724
void XLALFrameUFrameHFree_FrameC_(LALFrameUFrameH *frame)
Definition: LALFrameC.c:447
size_t XLALFrameUFrTOCQueryAdcN_FrameC_(const LALFrameUFrTOC *toc)
Definition: LALFrameC.c:343
const char * XLALFrameUFrTOCQueryAdcName_FrameC_(const LALFrameUFrTOC *toc, size_t adc)
Definition: LALFrameC.c:350
double XLALFrameUFrDetectorQueryArmYAzimuth_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:992
void XLALFrameUFrDetectorFree_FrameC_(LALFrameUFrDetector *detector)
Definition: LALFrameC.c:893
size_t XLALFrameUFrTOCQueryDetectorN_FrameC_(const LALFrameUFrTOC *toc)
Definition: LALFrameC.c:418
double XLALFrameUFrDetectorQueryLatitude_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:971
int XLALFrameUFrChanSetTRange_FrameC_(LALFrameUFrChan *channel, double tRange)
Definition: LALFrameC.c:667
int XLALFrameUFrChanVectorSetUnitY_FrameC_(LALFrameUFrChan *channel, const char *unit)
Definition: LALFrameC.c:863
const char * XLALFrameUFrTOCQueryDetectorName_FrameC_(const LALFrameUFrTOC *toc, size_t det)
Definition: LALFrameC.c:425
double XLALFrameUFrDetectorQueryArmXMidpoint_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:1013
#define CALL_FRAMEC_FUNCTION_RETVAL(retval, err, f,...)
Definition: LALFrameC.c:97
LALFrameUFrChan * XLALFrameUFrAdcChanAlloc_FrameC_(const char *name, int dtype, size_t ndata)
Definition: LALFrameC.c:578
#define GCC_DIAG_OFF(x)
Definition: LALFrameC.c:50
double XLALFrameUFrameHQueryGTimeModf_FrameC_(double *iptr, const LALFrameUFrameH *frame)
Definition: LALFrameC.c:536
size_t XLALFrameUFrTOCQuerySimN_FrameC_(const LALFrameUFrTOC *toc)
Definition: LALFrameC.c:368
const char * XLALFrameUFrChanVectorQueryUnitX_FrameC_(const LALFrameUFrChan *channel, size_t dim)
Definition: LALFrameC.c:831
double XLALFrameUFrameHQueryDt_FrameC_(const LALFrameUFrameH *frame)
Definition: LALFrameC.c:550
const char * XLALFrameUFrChanQueryName_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:641
size_t XLALFrameUFrChanVectorQueryNx_FrameC_(const LALFrameUFrChan *channel, size_t dim)
Definition: LALFrameC.c:776
size_t XLALFrameUFrTOCQueryNFrame_FrameC_(const LALFrameUFrTOC *toc)
Definition: LALFrameC.c:297
void XLALFrameUFrFileClose_FrameC_(LALFrameUFrFile *stream)
Definition: LALFrameC.c:189
#define TRY_FRAMEC_FUNCTION_VAL(retval, errval, f,...)
Definition: LALFrameC.c:136
const char * XLALFrameUFrDetectorQueryName_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:951
double XLALFrameUFrChanVectorQueryStartX_FrameC_(const LALFrameUFrChan *channel, size_t dim)
Definition: LALFrameC.c:812
LALFrameUFrFile * XLALFrameUFrFileOpen_FrameC_(const char *filename, const char *mode)
Definition: LALFrameC.c:207
int XLALFrameUFileCksumValid_FrameC_(LALFrameUFrFile *stream)
Definition: LALFrameC.c:247
size_t XLALFrameUFrTOCQueryProcN_FrameC_(const LALFrameUFrTOC *toc)
Definition: LALFrameC.c:393
double XLALFrameUFrDetectorQueryLongitude_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:964
#define TRY_FRAMEC_FUNCTION_INT(f,...)
Definition: LALFrameC.c:147
int XLALFrameUFrChanVectorSetUnitX_FrameC_(LALFrameUFrChan *channel, const char *unit)
Definition: LALFrameC.c:883
static fr_proc_type_t XLALFrProcType(int type)
Definition: LALFrameC.c:588
size_t XLALFrameUFrChanVectorQueryNDim_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:770
static fr_proc_sub_type_t XLALFrProcSubType(int subtype)
Definition: LALFrameC.c:611
int XLALFrameUFrameHQueryULeapS_FrameC_(const LALFrameUFrameH *frame)
Definition: LALFrameC.c:544
#define BUFSZ
Definition: LALFrameC.c:187
int XLALFrameUFrChanVectorSetStartX_FrameC_(LALFrameUFrChan *channel, double x0)
Definition: LALFrameC.c:877
double XLALFrameUFrTOCQueryGTimeModf_FrameC_(double *iptr, const LALFrameUFrTOC *toc, size_t pos)
Definition: LALFrameC.c:303
int XLALFrameUFrChanVectorCompress_FrameC_(LALFrameUFrChan *channel, int compressLevel)
Definition: LALFrameC.c:711
void XLALFrameUFrChanFree_FrameC_(LALFrameUFrChan *channel)
Definition: LALFrameC.c:568
double XLALFrameUFrDetectorQueryArmXAltitude_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:999
int XLALFrameUFrChanVectorAlloc_FrameC_(LALFrameUFrChan *channel, int dtype, size_t ndata)
Definition: LALFrameC.c:677
LALFrameUFrameH * XLALFrameUFrameHRead_FrameC_(LALFrameUFrFile *stream, int pos)
Definition: LALFrameC.c:478
int XLALFrameUFrChanVectorQueryType_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:745
LALFrameUFrChan * XLALFrameUFrChanRead_FrameC_(LALFrameUFrFile *stream, const char *name, size_t pos)
Definition: LALFrameC.c:573
int XLALFrameUFrameHQueryDataQuality_FrameC_(const LALFrameUFrameH *frame)
Definition: LALFrameC.c:530
double XLALFrameUFrDetectorQueryArmYMidpoint_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:1020
#define TRY_FRAMEC_FUNCTION(f,...)
Definition: LALFrameC.c:125
LALFrameUFrHistory * XLALFrameUFrHistoryAlloc_FrameC_(const char *name, double gpssec, const char *comment)
Definition: LALFrameC.c:1043
#define CALL_FRAMEC_FUNCTION(err, f,...)
Definition: LALFrameC.c:111
int XLALFrameUFrChanVectorQueryCompress_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:738
double XLALFrameUFrChanVectorQueryDx_FrameC_(const LALFrameUFrChan *channel, size_t dim)
Definition: LALFrameC.c:794
void XLALFrameUFrTOCFree_FrameC_(LALFrameUFrTOC *toc)
Definition: LALFrameC.c:287
double XLALFrameUFrChanQueryTimeOffset_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:647
void * XLALFrameUFrChanVectorQueryData_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:752
const char * XLALFrameUFrameHQueryName_FrameC_(const LALFrameUFrameH *frame)
Definition: LALFrameC.c:512
LALFrameUFrDetector * XLALFrameUFrDetectorAlloc_FrameC_(const char *name, const char *prefix, double latitude, double longitude, double elevation, double azimuthX, double azimuthY, double altitudeX, double altitudeY, double midpointX, double midpointY, int localTime)
Definition: LALFrameC.c:929
int XLALFrameUFrDetectorQueryLocalTime_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:1027
double XLALFrameUFrDetectorQueryArmYAltitude_FrameC_(const LALFrameUFrDetector *detector)
Definition: LALFrameC.c:1006
int XLALFrameUFrameHSetRun_FrameC_(LALFrameUFrameH *frame, int run)
Definition: LALFrameC.c:558
int XLALFrameUFrChanVectorSetDx_FrameC_(LALFrameUFrChan *channel, double dx)
Definition: LALFrameC.c:871
size_t XLALFrameUFrChanVectorQueryNData_FrameC_(const LALFrameUFrChan *channel)
Definition: LALFrameC.c:764
int XLALFrameUFrameHFrHistoryAdd_FrameC_(LALFrameUFrameH *frame, LALFrameUFrHistory *history)
Definition: LALFrameC.c:504
double XLALFrameUFrTOCQueryDt_FrameC_(const LALFrameUFrTOC *toc, size_t pos)
Definition: LALFrameC.c:325
const char * XLALFrameUFrTOCQueryProcName_FrameC_(const LALFrameUFrTOC *toc, size_t proc)
Definition: LALFrameC.c:400
LALFrameUFrDetector * XLALFrameUFrDetectorRead_FrameC_(LALFrameUFrFile *stream, const char *name)
Definition: LALFrameC.c:905
int XLALFrameUFrameHFrChanAdd_FrameC_(LALFrameUFrameH *frame, LALFrameUFrChan *channel)
Definition: LALFrameC.c:490
#define LALCalloc(m, n)
#define LALFree(p)
const char *const name
const char * names[]
struct tagLALFrameUFrameH LALFrameUFrameH
Incomplete type for a frame header FrameH structure.
Definition: LALFrameU.h:64
struct tagLALFrameUFrHistory LALFrameUFrHistory
Incomplete type for a history data FrHistory structure.
Definition: LALFrameU.h:105
struct tagLALFrameUFrTOC LALFrameUFrTOC
Incomplete type for a table of contents FrTOC structure.
Definition: LALFrameU.h:78
static const INT4 m
#define XLAL_ERROR_VOID(...)
#define XLAL_ERROR_REAL8(...)
#define XLAL_ERROR_NULL(...)
#define XLAL_REAL8_FAIL_NAN
#define XLAL_PRINT_WARNING(...)
XLAL_EFUNC
XLAL_EINVAL
LIGOTimeGPS * XLALGPSSet(LIGOTimeGPS *epoch, INT4 gpssec, INT8 gpsnan)
REAL8 XLALGPSModf(REAL8 *iptr, const LIGOTimeGPS *epoch)
filename
double dt
Definition: stream.c:110
char * channel
Definition: stream.c:108
Incomplete type for a detector data FrDetector structure.
Definition: LALFrameC.c:91
fr_detector_t * handle
Definition: LALFrameC.c:92
Incomplete type for a frame file FrFile stream.
Definition: LALFrameC.c:76
fr_file_mode_t mode
Definition: LALFrameC.c:78
fr_file_t * handle
Definition: LALFrameC.c:77
FILE * fp
enum @1 epoch
double srate
Definition: vis.c:237