LALApps 10.1.0.1-eeff03c
info.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 Duncan Brown, Jolien Creighton, Robert Adam Mercer
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 <config.h>
21#include <stdio.h>
22
23#include <FrameL.h>
24
25const char *typestr( int type );
26const char *typestr( int type )
27{
28 switch ( type )
29 {
30 case FR_VECT_C:
31 return "char";
32 case FR_VECT_2S:
33 return "int_2";
34 case FR_VECT_4S:
35 return "int_4";
36 case FR_VECT_8S:
37 return "int_8";
38 case FR_VECT_1U:
39 return "unsigned char";
40 case FR_VECT_2U:
41 return "unsigned int_2";
42 case FR_VECT_4U:
43 return "unsigned int_4";
44 case FR_VECT_8U:
45 return "unsigned int_8";
46 case FR_VECT_4R:
47 return "float";
48 case FR_VECT_8R:
49 return "double";
50 case FR_VECT_C8:
51 return "complex";
52 case FR_VECT_C16:
53 return "double complex";
54 default:
55 return "unknown";
56 }
57 return "unknown";
58}
59
60
61int main( int argc, char *argv[] )
62{
63 if ( argc == 1 )
64 {
65 fprintf( stderr, "usage: %s framefiles\n", argv[0] );
66 return 1;
67 }
68
69 FrLibIni( NULL, stderr, 0 );
70
71 while ( --argc > 0 )
72 {
73 struct FrFile *frfile;
74 struct FrameH *frame;
75 char *fname = *++argv;
76 if ( ! ( frfile = FrFileINew( fname ) ) )
77 return fprintf( stderr, "file %s not found!\n", fname ), 1;
78 fprintf( stdout, "\n>>> Info for frame file %s:\n", fname );
79 while ( ( frame = FrameRead( frfile ) ) )
80 {
81 fprintf( stdout, "\n>> %s, run %u, frame %u:\n", frame->name, frame->run,
82 frame->frame );
83 fprintf( stdout, "GPS time (s) = %u.%09u\n", frame->GTimeS,
84 frame->GTimeN );
85 /* fprintf( stdout, "local time (s) = %d\n", frame->localTime ); */
86 fprintf( stdout, "leap seconds = %u\n", frame->ULeapS );
87 fprintf( stdout, "duration (s) = %f\n", frame->dt );
88 if ( frame->rawData )
89 {
90 struct FrAdcData *adc = frame->rawData->firstAdc;
91 fprintf( stdout, "adc channels:\n" );
92 while ( adc )
93 {
94 fprintf( stdout, "\t%s: (crate %u, channel %u)",
95 adc->name, adc->channelGroup, adc->channelNumber );
96 if ( adc->data )
97 fprintf( stdout, ", %ld %s points @ %f Hz", (long)adc->data->nData,
98 typestr( adc->data->type ), adc->sampleRate );
99 fprintf( stdout, "\n" );
100 adc = adc->next;
101 }
102 }
103 if ( frame->procData )
104 {
105 struct FrProcData *proc = frame->procData;
106 while ( proc )
107 {
108#if defined FR_VERS && FR_VERS < 5000
109 fprintf( stdout, "\t%s: srate = %f Hz,", proc->name,
110 proc->sampleRate );
111#else
112 fprintf( stdout, "\t%s:", proc->name );
113#endif
114 if ( proc->data )
115 {
116 int dim;
117 fprintf( stdout, " %ld %s points [%s]", (long)proc->data->nData,
118 typestr( proc->data->type ), proc->data->unitY );
119 for ( dim = 0; dim < (int)proc->data->nDim; ++dim )
120 fprintf( stdout, ", nx(%d) = %ld dx(%d) = %f %s", dim,
121 (long)proc->data->nx[dim], dim, proc->data->dx[dim],
122 proc->data->unitX[dim] );
123 }
124 fprintf( stdout, "\n" );
125 proc = proc->next;
126 }
127 }
128 if ( frame->simData )
129 {
130 struct FrSimData *sim = frame->simData;
131 while ( sim )
132 {
133#if defined FR_VERS && FR_VERS < 5000
134 fprintf( stdout, "\t%s: srate = %f Hz,", sim->name,
135 sim>sampleRate );
136#else
137 fprintf( stdout, "\t%s:", sim->name );
138#endif
139 if ( sim->data )
140 {
141 int dim;
142 fprintf( stdout, " %ld %s points [%s]", (long)sim->data->nData,
143 typestr( sim->data->type ), sim->data->unitY );
144 for ( dim = 0; dim < (int)sim->data->nDim; ++dim )
145 fprintf( stdout, ", nx(%d) = %ld dx(%d) = %f %s", dim,
146 (long)sim->data->nx[dim], dim, sim->data->dx[dim],
147 sim->data->unitX[dim] );
148 }
149 fprintf( stdout, "\n" );
150 sim = sim->next;
151 }
152 }
153 FrameFree( frame );
154 }
155 FrFileIEnd( frfile );
156 }
157
158 return 0;
159}
#define fprintf
INT4 sampleRate
Definition: blindinj.c:124
int main(int argc, char *argv[])
Definition: info.c:61
const char * typestr(int type)
Definition: info.c:26
type
proc
int
CHAR fname[256]
Definition: spininj.c:211