72#include <lal/LALFrameU.h>
77#define FAILURE(...) do { fprintf(stderr, __VA_ARGS__); exit(1); } while (0)
80int printval(
void *data,
size_t i,
int dtype);
82int main(
int argc,
char *argv[])
85 char *defaultfilev[1] = { stdio };
86 int filec = (argc == 1 ? 1 : argc - 1);
87 char **filev = (argc == 1 ? defaultfilev : &argv[1]);
90 for (f = 0; f < filec; ++f) {
91 char *fname = filev[f];
92 LALFrameUFrFile *frfile;
103 FAILURE(
"file %s not found\n", fname);
108 printf(
"==> %s <==\n", fname);
122 for (chan = 0; chan < nadc; ++chan) {
126 printf(
"# time (s)\t%s",
name);
127 for (pos = 0; pos < nframe; ++pos) {
134 if (unit && strlen(unit))
135 printf(
" (%s)", unit);
143 for (chan = 0; chan < nsim; ++chan) {
147 printf(
"# time (s)\t%s",
name);
148 for (pos = 0; pos < nframe; ++pos) {
155 if (unit && strlen(unit))
156 printf(
" (%s)", unit);
164 for (chan = 0; chan < nproc; ++chan) {
169 for (pos = 0; pos < nframe; ++pos) {
177 if (unit && strcmp(unit,
"s") == 0)
178 printf(
"# time (s)\t%s",
name);
179 else if (unit && strcmp(unit,
"s^-1") == 0) {
180 printf(
"# freq (s^-1)\t%s",
name);
183 else if (unit && strlen(unit)) {
184 printf(
"# sample (%s)\t%s", unit,
name);
188 printf(
"# sample\t%s",
name);
192 if (unit && strlen(unit))
193 printf(
" (%s)", unit);
236 x0fp = modf(x0, &x0ip);
237 for (i = 0; i < ndata; ++i) {
239 xfp = modf(x0fp + i * dx, &xip);
241 printf(
"%ld.%09ld", (
long)xip, (
long)fabs(1e9 * xfp));
254 return printf(
"%c", ((
char *)data)[i]);
256 return printf(
"%" PRIi16, ((int16_t *) data)[i]);
258 return printf(
"%" PRIi32, ((int32_t *) data)[i]);
260 return printf(
"%" PRIi64, ((int64_t *) data)[i]);
262 return printf(
"%" PRIu8, ((uint8_t *) data)[i]);
264 return printf(
"%" PRIu16, ((uint16_t *) data)[i]);
266 return printf(
"%" PRIu32, ((uint32_t *) data)[i]);
268 return printf(
"%" PRIu64, ((uint64_t *) data)[i]);
270 return printf(
"%e", (
double)((
float *)data)[i]);
272 return printf(
"%e", ((
double *)data)[i]);
274 return printf(
"(%e,%e)", (
double)((
float *)data)[2 * i],
275 (
double)((
float *)data)[2 * i + 1]);
277 return printf(
"(%e,%e)", ((
float *)data)[2 * i],
278 ((
float *)data)[2 * i + 1]);
280 return printf(
"%s", ((
char **)data)[i]);
const char * XLALFrameUFrTOCQuerySimName(const LALFrameUFrTOC *toc, size_t sim)
Query FrTOC structure for the name of a FrSimData structure.
size_t XLALFrameUFrTOCQueryNFrame(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrameH structures contained.
void * XLALFrameUFrChanVectorQueryData(const LALFrameUFrChan *channel)
Query FrChan structure for the data pointer in its FrVect structure.
int XLALFrameUFrChanVectorQueryType(const LALFrameUFrChan *channel)
Query FrChan structure for the data type 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 XLALFrameUFrChanFree(LALFrameUFrChan *channel)
Free a FrChan structure.
int XLALFrameUFrChanVectorExpand(LALFrameUFrChan *channel)
Expands a FrVect structure within a FrChan structure.
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.
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.
double XLALFrameUFrTOCQueryGTimeModf(double *iptr, const LALFrameUFrTOC *toc, size_t pos)
Query FrTOC structure for start time of a FrameH structure.
const char * XLALFrameUFrChanVectorQueryUnitY(const LALFrameUFrChan *channel)
Query FrChan structure for sample units of the data in the FrVect 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...
struct tagLALFrameUFrTOC LALFrameUFrTOC
Incomplete type for a table of contents FrTOC structure.
void XLALFrameUFrFileClose(LALFrameUFrFile *stream)
Close a FrFile stream.
size_t XLALFrameUFrTOCQueryAdcN(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrAdcData structures.
@ 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.
int main(int argc, char *argv[])
int printchannel(LALFrameUFrChan *channel, double x0, int fdom)
int printval(void *data, size_t i, int dtype)