54#include <lal/LALFrameU.h>
56#define FAILURE(...) do { fprintf(stderr, __VA_ARGS__); exit(1); } while (0)
60#define indent indent(quotelvl)
63int dumpframe(LALFrameUFrFile * frfile,
size_t pos);
68int main(
int argc,
char *argv[])
71 char *defaultfilev[1] = { stdio };
72 int filec = (argc == 1 ? 1 : argc - 1);
73 char **filev = (argc == 1 ? defaultfilev : &argv[1]);
76 for (f = 0; f < filec; ++f) {
77 char *fname = filev[f];
78 LALFrameUFrFile *frfile = NULL;
87 FAILURE(
"file %s not found\n", fname);
92 printf(
"==> %s <==\n", fname);
100 for (det = 0; det < ndet; ++det)
105 if ((
int)(nframe) <= 0)
107 for (pos = 0; pos < nframe; ++pos)
120 LALFrameUFrDetector *detector;
163 printf(
"FrDetector %zu %s (%s): local time = %d\n", det,
name, prefix,
196 FAILURE(
"unable to open frame %zu\n", pos);
209 printf(
"FrameH %zu", pos);
212 printf(
" run %d, frame %d", run, frnum);
213 printf(
": dq = %d, ", dq);
215 printf(
"t0 = %d s, ", (
int)tip);
217 printf(
"t0 = %f s, ", tip + tfp);
218 printf(
"dt = %g s, ",
dt);
219 printf(
"TAI-UTC = %d\n", leaps);
228 for (adc = 0; adc < nadc; ++adc) {
237 for (sim = 0; sim < nsim; ++sim) {
246 for (proc = 0; proc < nproc; ++proc) {
261 const char *channame;
263 const char *vectname;
290 printf(
"Fr%sData %zu %s", chantype, chan, channame);
292 printf(
", offset = %g s", toffset);
293 if (strcmp(channame, vectname))
294 printf(
", FrVect %s", vectname);
296 if (nbytes / 1073741824)
297 printf(
"%2gGi", floor(0.5 + nbytes / 1073741824.0));
298 else if (nbytes / 1048576)
299 printf(
"%2gMi", floor(0.5 + nbytes / 1048576.0));
300 else if (nbytes / 1024)
301 printf(
"%2gKi", floor(0.5 + nbytes / 1024.0));
303 printf(
"%zuB", nbytes);
305 printf(
", %zu %s pts", ndata,
typestr(type));
307 printf(
", yunits = %s", unity);
315 printf(
", x0 = %g, dx = %g", x0, dx);
317 printf(
", xunits = %s", unitx);
320 printf(
", %zu dim\n", ndim);
322 for (dim = 0; dim < ndim; ++dim) {
333 printf(
"nx[%zu] = %zu", dim, nx);
334 printf(
", x0[%zu] = %g", dim, x0);
335 printf(
", dx[%zu] = %g", dim, dx);
337 printf(
", xunits[%zu] = %s", dim, unitx);
370 return "float complex";
372 return "double complex";
387 return "GZIP compression";
389 return "DIFF_GZIP compression";
391 return "ZERO_SUPPRESS_WORD_2 compression";
393 return "ZERO_SUPPRESS_WORD_4 compression";
397 return "unknown compression";
404 const char *tab =
" ";
409#if __GNUC__ >= 7 && !defined __INTEL_COMPILER
415 fputs(
"... ", stdout);
int main(int argc, char *argv[])
int dumpdetector(LALFrameUFrFile *frfile, size_t det)
const char * compressstr(int type)
const char * typestr(int type)
int dumpframe(LALFrameUFrFile *frfile, size_t pos)
int dumpchannel(LALFrameUFrChan *channel, size_t chan, const char *chantype)
int XLALFrameUFrameHQueryFrame(const LALFrameUFrameH *frame)
Query FrameH structure for the frame number.
const char * XLALFrameUFrTOCQuerySimName(const LALFrameUFrTOC *toc, size_t sim)
Query FrTOC structure for the name of a FrSimData structure.
int XLALFrameUFrChanVectorQueryCompress(const LALFrameUFrChan *channel)
Query FrChan structure for the compression scheme of its FrVect structure.
size_t XLALFrameUFrTOCQueryNFrame(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrameH structures contained.
int XLALFrameUFrChanVectorQueryType(const LALFrameUFrChan *channel)
Query FrChan structure for the data type of its FrVect structure.
const char * XLALFrameUFrChanVectorQueryName(const LALFrameUFrChan *channel)
Query FrChan structure for the name of its FrVect structure.
void XLALFrameUFrTOCFree(LALFrameUFrTOC *toc)
Free a FrTOC structure.
LALFrameUFrChan * XLALFrameUFrChanRead(LALFrameUFrFile *stream, const char *name, size_t pos)
Read a channel FrChan structure from a FrFile stream.
size_t XLALFrameUFrTOCQuerySimN(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrSimData structures.
void XLALFrameUFrameHFree(LALFrameUFrameH *frame)
Free a FrameH structure.
void XLALFrameUFrChanFree(LALFrameUFrChan *channel)
Free a FrChan structure.
size_t XLALFrameUFrChanVectorQueryNDim(const LALFrameUFrChan *channel)
Query FrChan structure for the number of dimensions of the multi-dimensional data in its FrVect struc...
const char * XLALFrameUFrDetectorQueryPrefix(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector prefix.
struct tagLALFrameUFrameH LALFrameUFrameH
Incomplete type for a frame header FrameH structure.
size_t XLALFrameUFrChanVectorQueryNx(const LALFrameUFrChan *channel, size_t dim)
Query FrChan structure for the number of points in the dim dimension of the multi-dimensional data in...
double XLALFrameUFrameHQueryDt(const LALFrameUFrameH *frame)
Query FrameH structure for the duration.
int XLALFrameUFrameHQueryULeapS(const LALFrameUFrameH *frame)
Query FrameH structure for the number of leap seconds.
double XLALFrameUFrChanQueryTimeOffset(const LALFrameUFrChan *channel)
Query FrChan structure for time offset for this channel.
LALFrameUFrTOC * XLALFrameUFrTOCRead(LALFrameUFrFile *stream)
Read the table of contents FrTOC structure for a FrFile stream.
LALFrameUFrameH * XLALFrameUFrameHRead(LALFrameUFrFile *stream, int pos)
Read a frame header FrameH structure from a FrFile stream.
size_t XLALFrameUFrTOCQueryProcN(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrProcData structures.
double XLALFrameUFrChanVectorQueryDx(const LALFrameUFrChan *channel, size_t dim)
Query FrChan structure for the sampling interval in the dim dimension of the multi-dimensional data i...
const char * XLALFrameUFrTOCQueryProcName(const LALFrameUFrTOC *toc, size_t proc)
Query FrTOC structure for the name of a FrProcData structure.
size_t XLALFrameUFrChanVectorQueryNData(const LALFrameUFrChan *channel)
Query FrChan structure for the number of points of data in its FrVect structure.
const char * XLALFrameUFrameHQueryName(const LALFrameUFrameH *frame)
Query FrameH structure for its name.
const char * XLALFrameUFrChanVectorQueryUnitY(const LALFrameUFrChan *channel)
Query FrChan structure for sample units of the data in the FrVect structure.
void XLALFrameUFrDetectorFree(LALFrameUFrDetector *detector)
Free a FrDetector structure.
const char * XLALFrameUFrTOCQueryAdcName(const LALFrameUFrTOC *toc, size_t adc)
Query FrTOC structure for the name of a FrAdcData structure.
const char * XLALFrameUFrChanVectorQueryUnitX(const LALFrameUFrChan *channel, size_t dim)
Query FrChan structure for the units of the domain of the dim dimension of the multi-dimensional data...
LALFrameUFrFile * XLALFrameUFrFileOpen(const char *filename, const char *mode)
Open a frame file FrFile stream.
double XLALFrameUFrChanVectorQueryStartX(const LALFrameUFrChan *channel, size_t dim)
Query FrChan structure for the starting value of the dim dimension of the multi-dimensional data in t...
double XLALFrameUFrameHQueryGTimeModf(double *iptr, const LALFrameUFrameH *frame)
Query FrameH structure for the start time.
struct tagLALFrameUFrTOC LALFrameUFrTOC
Incomplete type for a table of contents FrTOC structure.
int XLALFrameUFrDetectorQueryLocalTime(const LALFrameUFrDetector *detector)
Query FrDetector structure for the local time offset at the detector.
void XLALFrameUFrFileClose(LALFrameUFrFile *stream)
Close a FrFile stream.
size_t XLALFrameUFrTOCQueryAdcN(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrAdcData structures.
int XLALFrameUFrameHQueryDataQuality(const LALFrameUFrameH *frame)
Query FrameH structure for the data quality word.
int XLALFrameUFrameHQueryRun(const LALFrameUFrameH *frame)
Query FrameH structure for the run number.
size_t XLALFrameUFrTOCQueryDetectorN(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrDetector structures.
const char * XLALFrameUFrDetectorQueryName(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector name.
LALFrameUFrDetector * XLALFrameUFrDetectorRead(LALFrameUFrFile *stream, const char *name)
Read a detector FrDetector structure from a FrFile stream.
size_t XLALFrameUFrChanVectorQueryNBytes(const LALFrameUFrChan *channel)
Query FrChan structure for the number of bytes of data in its FrVect structure.
const char * XLALFrameUFrTOCQueryDetectorName(const LALFrameUFrTOC *toc, size_t det)
Query FrTOC structure for the name of a FrDetector structure.
const char * XLALFrameUFrChanQueryName(const LALFrameUFrChan *channel)
Query FrChan structure for its name.
@ LAL_FRAMEU_FR_VECT_COMPRESS_DIFF_GZIP
Id for gzip compression of differential values.
@ LAL_FRAMEU_FR_VECT_COMPRESS_ZERO_SUPPRESS_WORD_2
Id for differentiation and zero suppression for 2-byte word integer types only.
@ LAL_FRAMEU_FR_VECT_COMPRESS_RAW
Id for uncompressed raw values.
@ LAL_FRAMEU_FR_VECT_COMPRESS_GZIP
Id for gzip compression.
@ LAL_FRAMEU_FR_VECT_COMPRESS_ZERO_SUPPRESS_WORD_4
Id for differentiation and zero suppression for 4-byte word (integer or floating-point).
@ LAL_FRAMEU_FR_VECT_STRING
Id for string data type.
@ LAL_FRAMEU_FR_VECT_16C
Id for 128-bit double precision complex data type.
@ LAL_FRAMEU_FR_VECT_C
Id for 8-bit signed char data type.
@ LAL_FRAMEU_FR_VECT_4R
Id for 32-bit single precision floating point data type.
@ LAL_FRAMEU_FR_VECT_2S
Id for 16-bit signed integer data type.
@ LAL_FRAMEU_FR_VECT_8S
Id for 64-bit signed integer data type.
@ LAL_FRAMEU_FR_VECT_8U
Id for 64-bit unsigned integer data type.
@ LAL_FRAMEU_FR_VECT_4S
Id for 32-bit signed integer data type.
@ LAL_FRAMEU_FR_VECT_8C
Id for 64-bit single precision complex data type.
@ LAL_FRAMEU_FR_VECT_1U
Id for 8-bit unsigned char data type.
@ LAL_FRAMEU_FR_VECT_8R
Id for 64-bit double precision floating point data type.
@ LAL_FRAMEU_FR_VECT_4U
Id for 32-bit unsigned integer data type.
@ LAL_FRAMEU_FR_VECT_2U
Id for 16-bit unsigned integer data type.