00001
00002 #include "M3.h"
00003 #include "M3_system.h"
00004 #include <M3_format.h>
00005
00006 void M3_File_printData_mask( M3_File *theFile, int32_t numValToPrint, int32_t firstValToPrint );
00007 void M3_File_printData_map( M3_File *theFile, int32_t numValToPrint, int32_t firstValToPrint );
00008 void M3_File_printData_coord( M3_File *theFile, int32_t numValsToPrint, int32_t firstValToPrint );
00009 void M3_File_printData_noise( M3_File *theFile, int32_t numValsToPrint, int32_t firstValToPrint );
00010 void M3_File_printData_sparse( M3_File *theFile, int32_t numValsToPrint, int32_t firstValToPrint );
00011 void M3_File_printData_gcpointing( M3_File *theFile, int64_t numValsToPrint, int64_t firstValToPrint );
00012
00013
00014 void M3_File_printData_mask( M3_File *theFile, int32_t numValToPrint, int32_t firstValToPrint )
00015 {
00016 int32_t i,j,k,l;
00017 M3_AnyHeader header;
00018 M3_MapEl *mask;
00019 static int64_t diskBufferSize = -1;
00020 char *tempPtr;
00021 int64_t diskBufferLength;
00022
00023 if( diskBufferSize == -1 )
00024 {
00025 tempPtr = getenv("M3_DISK_BUFFER_SIZE");
00026 if( tempPtr )
00027 diskBufferSize = strtoll( tempPtr, NULL, 10);
00028 else
00029 diskBufferSize = M3_DISK_BUFFER_SIZE;
00030 }
00031
00032 diskBufferLength = diskBufferSize/sizeof(M3_MapEl );
00033
00034 M3_File_ReadHeader( theFile, &header );
00035
00036 fprintf( stdout, " %i\n\n", header.mask.numPixelInClass );
00037
00038 mask = (M3_MapEl *)calloc( diskBufferLength, sizeof(M3_MapEl) );
00039
00040 M3_ErrorCheck( -1, "M3_File_printData_mask", mask, M3_EFLAG_MALLOC_FSTRING );
00041
00042 j = 0;
00043 i = firstValToPrint;
00044 while( j < numValToPrint && i < header.mask.numPixelInClass )
00045 {
00046 for( k = 0; k < diskBufferLength && i < header.mask.numPixelInClass; k++ )
00047 {
00048 mask[k].pixel = i;
00049 i++;
00050 }
00051 M3_File_ReadData( theFile, &k, mask );
00052
00053 for( l = 0; l < k && j < numValToPrint; l++ )
00054 {
00055 fprintf( stdout, " %i %.8e\n", mask[l].pixel, mask[l].value );
00056 j++;
00057 }
00058 }
00059 fprintf( stdout, "\n\n");
00060 free( mask );
00061
00062 return;
00063 }
00064
00065 void M3_File_printData_map( M3_File *theFile, int32_t numValToPrint, int32_t firstValToPrint )
00066 {
00067 int32_t i, j, k, l;
00068 M3_AnyHeader header;
00069 M3_MapEl *map;
00070 static int64_t diskBufferSize = -1;
00071 char *tempPtr;
00072 int64_t diskBufferLength;
00073
00074 if( diskBufferSize == -1 )
00075 {
00076 tempPtr = getenv("M3_DISK_BUFFER_SIZE");
00077 if( tempPtr )
00078 diskBufferSize = strtoll( tempPtr, NULL, 10);
00079 else
00080 diskBufferSize = M3_DISK_BUFFER_SIZE;
00081 }
00082
00083 diskBufferLength = diskBufferSize/sizeof(M3_MapEl );
00084
00085 M3_File_ReadHeader( theFile, &header );
00086
00087 fprintf(stdout, "%i %i\n\n", header.map.numPixelInClass, header.map.numPixelInMap );
00088
00089 map = (M3_MapEl *)calloc( diskBufferLength, sizeof(M3_MapEl) );
00090
00091 M3_ErrorCheck( -1, "M3_File_printData_map", map, M3_EFLAG_MALLOC_FSTRING );
00092
00093 j = 0;
00094 i = firstValToPrint;
00095 while( j < numValToPrint && i < header.map.numPixelInClass )
00096 {
00097 for( k = 0; k < diskBufferLength && i < header.map.numPixelInClass; k++ )
00098 {
00099 map[k].pixel = i;
00100 i++;
00101 }
00102 M3_File_ReadData( theFile, &k, map );
00103
00104 for( l = 0; l < k && j < numValToPrint; l++ )
00105 {
00106 if( !isnan(map[l].value) )
00107 {
00108 fprintf( stdout, " %i %.8e\n", map[l].pixel, map[l].value );
00109 j++;
00110 }
00111 }
00112 }
00113
00114 fprintf( stdout, "\n\n");
00115
00116 free(map);
00117
00118 return;
00119 }
00120
00121 void M3_File_printData_coord( M3_File *theFile, int32_t numValsToPrint, int32_t firstValToPrint )
00122 {
00123 M3_CoordEl *coords;
00124 M3_CoordHeader header;
00125 int32_t i;
00126
00127 M3_File_ReadHeader( theFile, &header );
00128
00129 coords = (M3_CoordEl *)calloc( numValsToPrint, sizeof(M3_CoordEl) );
00130
00131 M3_ErrorCheck( -1, "M3_File_printData_coord", coords, M3_EFLAG_MALLOC_FSTRING );
00132
00133 for( i = 0; i < numValsToPrint; i++)
00134 {
00135 coords[i].pixel = i + firstValToPrint;
00136 }
00137
00138 M3_File_ReadData( theFile, &numValsToPrint, coords );
00139
00140 fprintf(stdout, " %i\n", header.numPixelInClass );
00141
00142 for( i = 0; i < numValsToPrint; i++)
00143 fprintf( stdout, " %i %.8e %.8e\n", coords[i].pixel, coords[i].ra, coords[i].dec );
00144 fprintf(stdout, "\n\n");
00145 free( coords);
00146
00147 }
00148
00149
00150
00151 void M3_File_printData_noise( M3_File *theFile, int32_t numValsToPrint, int32_t firstValToPrint )
00152 {
00153 int64_t i;
00154 M3_NoiseHeader header;
00155 double *noise;
00156
00157 M3_File_ReadHeader( theFile, &header );
00158
00159 fprintf( stdout, " %lli %lli %lli\n\n", header.firstSample, header.lastSample, header.corLength );
00160
00161 noise = (double*)malloc(sizeof(double)*(header.corLength + 1));
00162 M3_ErrorCheck(-1, "M3_File_printData_noise()", noise, M3_EFLAG_MALLOC_FSTRING);
00163
00164 M3_File_ReadData(theFile, NULL, noise );
00165
00166
00167
00168 for( i = firstValToPrint; i < firstValToPrint + numValsToPrint && i < header.corLength + 1; i++ )
00169 fprintf( stdout, " %.8e\n", noise[i] );
00170
00171 free(noise);
00172 }
00173
00174 void M3_File_printData_sparse( M3_File *theFile, int32_t numValToPrint, int32_t firstValToPrint )
00175 {
00176 int32_t i, j;
00177 int32_t k, l;
00178 M3_SparseHeader header;
00179 M3_SparsePixelMatrixEl *sparseEl;
00180 static int64_t diskBufferSize = -1;
00181 char *tempPtr;
00182 int64_t diskBufferLength;
00183
00184 if( diskBufferSize == -1 )
00185 {
00186 tempPtr = getenv("M3_DISK_BUFFER_SIZE");
00187 if( tempPtr )
00188 diskBufferSize = strtoll( tempPtr, NULL, 10);
00189 else
00190 diskBufferSize = M3_DISK_BUFFER_SIZE;
00191 }
00192
00193
00194 diskBufferLength = diskBufferSize/sizeof(M3_SparsePixelMatrixEl);
00195 sparseEl = (M3_SparsePixelMatrixEl *)calloc( diskBufferLength, sizeof(M3_SparsePixelMatrixEl) );
00196 M3_ErrorCheck(-1, "M3_File_printData_sparse()", (sparseEl ? 1 : 0), M3_EFLAG_MALLOC_FSTRING);
00197
00198 M3_File_ReadHeader( theFile, &header );
00199
00200 fprintf(stdout, "%lli %lli\n\n", header.numColumn, header.numNZ );
00201
00202 j = 0;
00203 i = firstValToPrint;
00204 while( j < numValToPrint )
00205 {
00206 for( k = 0; k < diskBufferLength && i < header.numColumn; k++ )
00207 {
00208 sparseEl[k].rowClass = 1;
00209 sparseEl[k].rowPixel = i;
00210 i++;
00211 }
00212 M3_File_ReadData( theFile, &k, sparseEl );
00213
00214 for( l = 0; l < k && j < numValToPrint; l++ )
00215 {
00216 if( !isnan(sparseEl[l].value) )
00217 {
00218 fprintf( stdout, " %i %i %.8e\n", sparseEl[l].rowClass, sparseEl[l].rowPixel, sparseEl[l].value );
00219 j++;
00220 }
00221 }
00222 }
00223
00224 fprintf( stdout, "\n\n");
00225
00226 free(sparseEl);
00227
00228 }
00229
00230 void M3_File_printData_gcpointing( M3_File *theFile, int64_t numValsToPrint, int64_t firstValToPrint )
00231 {
00232 int64_t i, j, k, numRead;
00233 double *data;
00234 M3_Interval readInterval;
00235 static int64_t diskBufferSize = -1;
00236 char *tempPtr;
00237 int64_t diskBufferLength;
00238 int64_t offset;
00239
00240 int dataPerSample = theFile->param.gcpointing.numDataPerSample;
00241
00242 if( diskBufferSize == -1 )
00243 {
00244 tempPtr = getenv("M3_DISK_BUFFER_SIZE");
00245 if( tempPtr )
00246 diskBufferSize = strtoll( tempPtr, NULL, 10);
00247 else
00248 diskBufferSize = M3_DISK_BUFFER_SIZE;
00249 }
00250
00251 diskBufferLength = diskBufferSize / (dataPerSample*sizeof(double));
00252
00253 data = (double*)malloc(diskBufferSize);
00254 M3_ErrorCheck(-1, "M3_File_printData_gcpointing()", (data?1:0), M3_EFLAG_MALLOC_FSTRING );
00255
00256 numRead = numValsToPrint/diskBufferLength + ( numValsToPrint%diskBufferLength ? 1 : 0 );
00257
00258 fprintf(stdout, "%lli %e %lli %e %i\n\n",
00259 theFile->param.gcpointing.firstTime.sec,
00260 theFile->param.gcpointing.firstTime.nsec,
00261 theFile->param.gcpointing.numSample,
00262 theFile->param.gcpointing.sampleRate,
00263 theFile->param.gcpointing.numDataPerSample );
00264
00265 for( k = 0; k < numRead; k++ )
00266 {
00267 readInterval.firstSample = firstValToPrint + k*diskBufferLength;
00268
00269 if( k == numRead-1 && numValsToPrint%diskBufferLength )
00270 diskBufferLength = numValsToPrint%diskBufferLength;
00271
00272 readInterval.lastSample = readInterval.firstSample + diskBufferLength - 1;
00273
00274 M3_File_ReadData( theFile, &readInterval, data );
00275
00276 for( i = 0; i < diskBufferLength; i++ )
00277 {
00278 offset = i * (int64_t)dataPerSample;
00279 for (j = 0; j < dataPerSample; j++) {
00280 fprintf(stdout, "%.15e ", data[offset + j]);
00281 }
00282 fprintf(stdout, "\n");
00283 fflush(stdout);
00284 }
00285 }
00286 free(data);
00287 return;
00288 }
00289
00290
00291 void printData_RCpointing( M3_DataSetLL *dataSet, int64_t firstValToPrint, int64_t numValsToPrint )
00292 {
00293 int64_t i, j, k, l, numRead;
00294 M3_PointingEl *data;
00295 M3_Interval readInterval;
00296 static int64_t diskBufferSize = -1;
00297 char *tempPtr;
00298 int64_t diskBufferLength;
00299
00300 if( diskBufferSize == -1 )
00301 {
00302 tempPtr = getenv("M3_DISK_BUFFER_SIZE");
00303 if( tempPtr )
00304 diskBufferSize = strtoll( tempPtr, NULL, 10);
00305 else
00306 diskBufferSize = M3_DISK_BUFFER_SIZE;
00307 }
00308
00309
00310 diskBufferLength = diskBufferSize/(dataSet->numNZ*sizeof(M3_PointingEl));
00311
00312 data = (M3_PointingEl*)malloc(diskBufferSize);
00313 M3_ErrorCheck(-1, "printData_RCpointing()", (data?1:0), M3_EFLAG_MALLOC_FSTRING );
00314
00315 numRead = numValsToPrint/diskBufferLength + ( numValsToPrint%diskBufferLength ? 1 : 0 );
00316
00317 for( k = 0; k < numRead; k++ )
00318 {
00319 readInterval.firstSample = firstValToPrint + k*diskBufferLength;
00320
00321 if( k == numRead-1 && numValsToPrint%diskBufferLength )
00322 diskBufferLength = numValsToPrint%diskBufferLength;
00323
00324 readInterval.lastSample = readInterval.firstSample + diskBufferLength - 1;
00325
00326 M3_DataSetLL_GetPointing( dataSet, readInterval, data );
00327
00328 for( i = 0; i < diskBufferLength; i++ )
00329 {
00330 for( l = 0; l < dataSet->numNZ; l++ )
00331 fprintf(stdout, "%i %e ", data[i*dataSet->numNZ + l].pixel, data[i*dataSet->numNZ + l].weight);
00332 fprintf(stdout, "\n");
00333 }
00334 }
00335 free(data);
00336 }
00337
00338
00339
00340 void printData_RCtod( M3_DataSetLL *dataSet, int64_t firstValToPrint, int64_t numValsToPrint )
00341 {
00342 int64_t i, j, k, l, numRead;
00343 double *data;
00344 M3_Interval readInterval;
00345 static int64_t diskBufferSize = -1;
00346 char *tempPtr;
00347 int64_t diskBufferLength;
00348
00349 if( diskBufferSize == -1 )
00350 {
00351 tempPtr = getenv("M3_DISK_BUFFER_SIZE");
00352 if( tempPtr )
00353 diskBufferSize = strtoll( tempPtr, NULL, 10);
00354 else
00355 diskBufferSize = M3_DISK_BUFFER_SIZE;
00356 }
00357
00358 diskBufferLength = diskBufferSize/(sizeof(double));
00359
00360 data = (double*)malloc(diskBufferSize);
00361 M3_ErrorCheck(-1, "printData_RCtod()", (data?1:0), M3_EFLAG_MALLOC_FSTRING );
00362
00363 numRead = numValsToPrint/diskBufferLength + ( numValsToPrint%diskBufferLength ? 1 : 0 );
00364
00365 for( k = 0; k < numRead; k++ )
00366 {
00367 readInterval.firstSample = firstValToPrint + k*diskBufferLength;
00368
00369 if( k == numRead-1 && numValsToPrint%diskBufferLength )
00370 diskBufferLength = numValsToPrint%diskBufferLength;
00371
00372 readInterval.lastSample = readInterval.firstSample + diskBufferLength - 1;
00373
00374 M3_DataSetLL_GetTOD( dataSet, readInterval, data );
00375
00376 for( i = 0; i < diskBufferLength; i++ )
00377 {
00378 fprintf(stdout, "%e\n", data[i]);
00379 }
00380 }
00381 free(data);
00382 }
00383
00384
00385 int main( int argc, char **argv )
00386 {
00387 int myRank, numProc;
00388 int64_t numValsToPrint, firstValToPrint, i, j;
00389 M3_File theFile = {0};
00390 M3_AnyHeader header;
00391 void *buffer = NULL;
00392 M3_Interval readInterval;
00393 int returnValue = 0;
00394 int runType;
00395 M3_RunConfigStruct *runConfig;
00396 M3_DataSetLL *dataSet;
00397 size_t cacheSize;
00398 M3_TODcacheStruct *todCache;
00399
00400
00401
00402 if( argc < 4 )
00403 {
00404 fprintf(stderr, "Usage: %s fileName fileFormat fileType [numValsToPrint] [firstValToPrint]\n", argv[0]);
00405 fprintf(stderr, " or\n");
00406 fprintf(stderr, "Usage: %s -r xmlFileName runType dataType groupID [numValsToPrint] [firstValToPrint]\n", argv[0]);
00407 return(1);
00408 }
00409
00410 if( strcmp(argv[1], "-r") && strcmp(argv[1], "-R") )
00411 {
00412 theFile.name = argv[1];
00413 theFile.format = argv[2];
00414
00415 if( strcmp( argv[3], "tod" ) == 0 )
00416 theFile.fileType = M3_TOD_FILE_TYPE;
00417 else if( strcmp( argv[3], "toc" ) == 0 )
00418 theFile.fileType = M3_TOC_FILE_TYPE;
00419 else if( strcmp( argv[3], "pointing" ) == 0 )
00420 theFile.fileType = M3_POINTING_FILE_TYPE;
00421 else if( strcmp( argv[3], "noise" ) == 0 )
00422 theFile.fileType = M3_NOISE_FILE_TYPE;
00423 else if( strcmp( argv[3], "filter" ) == 0 )
00424 theFile.fileType = M3_FILTER_FILE_TYPE;
00425 else if( strcmp( argv[3], "map" ) == 0 )
00426 theFile.fileType = M3_MAP_FILE_TYPE;
00427 else if( strcmp( argv[3], "mask" ) == 0 )
00428 theFile.fileType = M3_MASK_FILE_TYPE;
00429 else if( strcmp( argv[3], "coord") == 0 )
00430 theFile.fileType = M3_COORD_FILE_TYPE;
00431 else if( strcmp( argv[3], "spectrum") == 0 )
00432 theFile.fileType = M3_SPECTRUM_FILE_TYPE;
00433 else if( strcmp( argv[3], "bin") == 0 )
00434 theFile.fileType = M3_BIN_FILE_TYPE;
00435 else if( strcmp( argv[3], "bps") == 0 )
00436 theFile.fileType = M3_BPS_FILE_TYPE;
00437 else if( strcmp( argv[3], "fisher") == 0 )
00438 theFile.fileType = M3_FISHER_FILE_TYPE;
00439 else if( strcmp( argv[3], "sparse") == 0 )
00440 theFile.fileType = M3_SPARSE_FILE_TYPE;
00441 else if( strcmp( argv[3], "gcpointing") == 0 )
00442 theFile.fileType = M3_GCPOINTING_FILE_TYPE;
00443 else
00444 M3_ErrorCheck(-1, "Could not interperate file type", 0, M3_EFLAG_DEFAULT );
00445
00446 if( argc > 4 )
00447 numValsToPrint = strtoll(argv[4], NULL, 10);
00448 else
00449 numValsToPrint = 10;
00450
00451 if( argc > 5 )
00452 firstValToPrint = strtoll(argv[5], NULL, 10);
00453 else
00454 firstValToPrint = 0;
00455
00456 M3_File_ReadHeader( &theFile, &header );
00457
00458 switch( theFile.fileType )
00459 {
00460 case M3_TOD_FILE_TYPE:
00461
00462 fprintf( stdout, "%lli %lli\n\n", header.tod.firstSample, header.tod.lastSample);
00463
00464
00465 if( numValsToPrint )
00466 {
00467
00468 theFile.param.tod.interval.firstSample = header.tod.firstSample;
00469 theFile.param.tod.interval.lastSample = header.tod.lastSample;
00470 theFile.param.tod.calib = 1;
00471
00472
00473 buffer = malloc(numValsToPrint*sizeof(double));
00474 M3_ErrorCheck( 0, "main", buffer, M3_EFLAG_MALLOC_FSTRING );
00475
00476
00477 readInterval.firstSample = header.tod.firstSample + firstValToPrint;
00478 readInterval.lastSample = readInterval.firstSample + numValsToPrint - 1;
00479 M3_File_ReadData( &theFile, &readInterval, buffer);
00480
00481
00482 for( i = 0; i < numValsToPrint; i++ )
00483 fprintf( stdout, "%.8e\n", ((double *)buffer)[i] );
00484 }
00485
00486 fprintf( stdout, "\n\n");
00487
00488 break;
00489 case M3_TOC_FILE_TYPE:
00490
00491 fprintf( stdout, "%lli %lli\n\n", header.tod.firstSample, header.tod.lastSample );
00492
00493
00494 if( numValsToPrint )
00495 {
00496
00497 theFile.param.toc.interval.firstSample = header.toc.firstSample;
00498 theFile.param.toc.interval.lastSample = header.toc.lastSample;
00499 theFile.param.toc.calib = 1;
00500 theFile.param.toc.action = M3_MULTIPLY_TOC_ACTION;
00501
00502
00503 buffer = malloc(numValsToPrint*sizeof(double));
00504 M3_ErrorCheck( 0, "main", buffer, M3_EFLAG_MALLOC_FSTRING );
00505
00506
00507 readInterval.firstSample = header.toc.firstSample + firstValToPrint;
00508 readInterval.lastSample = readInterval.firstSample + numValsToPrint - 1;
00509 M3_File_ReadData( &theFile, &readInterval, buffer );
00510
00511
00512 for( i = 0; i < numValsToPrint; i++ )
00513 fprintf( stdout, "%.8e\n", ((double *)buffer)[i] );
00514 }
00515 fprintf( stdout, "\n\n");
00516
00517 break;
00518 case M3_POINTING_FILE_TYPE:
00519 fprintf( stdout, "%lli %lli %i %i\n\n", header.pointing.firstSample,
00520 header.pointing.lastSample,
00521 header.pointing.numPixelInClass,
00522 header.pointing.numNZ);
00523
00524 if( numValsToPrint )
00525 {
00526 theFile.param.pointing.interval.firstSample = header.pointing.firstSample;
00527 theFile.param.pointing.interval.lastSample = header.pointing.lastSample;
00528 theFile.param.pointing.calib = 1;
00529
00530 buffer = malloc(numValsToPrint*header.pointing.numNZ*sizeof(M3_PointingEl));
00531 M3_ErrorCheck( 0, "main", buffer, M3_EFLAG_MALLOC_FSTRING );
00532
00533 readInterval.firstSample = header.pointing.firstSample + firstValToPrint;
00534 readInterval.lastSample = readInterval.firstSample + numValsToPrint - 1;
00535 M3_File_ReadData( &theFile, &readInterval, buffer);
00536
00537 for( i = 0; i < numValsToPrint; i++ )
00538 {
00539 for( j = 0; j < header.pointing.numNZ; j++ )
00540 {
00541 fprintf( stdout, "%i %.8e ", ((M3_PointingEl*)buffer)[i*header.pointing.numNZ + j].pixel,
00542 ((M3_PointingEl*)buffer)[i*header.pointing.numNZ + j].weight );
00543 }
00544
00545 fprintf( stdout, "\n");
00546 }
00547 }
00548 break;
00549 case M3_NOISE_FILE_TYPE:
00550 theFile.param.noise.interval.firstSample = header.noise.firstSample;
00551 theFile.param.noise.interval.lastSample = header.noise.lastSample;
00552 theFile.param.noise.calib = 1;
00553 theFile.param.noise.corLength = header.noise.corLength;
00554 M3_File_printData_noise( &theFile, numValsToPrint, firstValToPrint );
00555 break;
00556 case M3_FILTER_FILE_TYPE:
00557 theFile.param.filter.interval.firstSample = header.filter.firstSample;
00558 theFile.param.filter.interval.lastSample = header.filter.lastSample;
00559 theFile.param.filter.length = header.filter.length;
00560 theFile.param.filter.bandWidth = header.filter.bandWidth;
00561 break;
00562 case M3_MAP_FILE_TYPE:
00563 theFile.param.map.numPixel = header.map.numPixelInMap;
00564 theFile.param.map.offset = 0;
00565 M3_File_printData_map( &theFile, numValsToPrint, firstValToPrint );
00566 break;
00567 case M3_MASK_FILE_TYPE:
00568 theFile.param.mask.offset = 0;
00569 M3_File_printData_mask( &theFile, numValsToPrint, firstValToPrint );
00570 break;
00571 case M3_COORD_FILE_TYPE:
00572 M3_File_printData_coord( &theFile, numValsToPrint, firstValToPrint );
00573 break;
00574 case M3_SPECTRUM_FILE_TYPE:
00575 break;
00576 case M3_BIN_FILE_TYPE:
00577 break;
00578 case M3_BPS_FILE_TYPE:
00579 break;
00580 case M3_FISHER_FILE_TYPE:
00581 break;
00582 case M3_SPARSE_FILE_TYPE:
00583 M3_File_printData_sparse( &theFile, numValsToPrint, firstValToPrint );
00584 break;
00585 case M3_GCPOINTING_FILE_TYPE:
00586 theFile.param.gcpointing.firstTime.sec = header.gcpointing.firstTime_sec;
00587 theFile.param.gcpointing.firstTime.nsec = header.gcpointing.firstTime_nsec;
00588 theFile.param.gcpointing.numSample = header.gcpointing.numSample;
00589 theFile.param.gcpointing.sampleRate = header.gcpointing.sampleRate;
00590 theFile.param.gcpointing.numDataPerSample = header.gcpointing.numDataPerSample;
00591 M3_File_printData_gcpointing( &theFile, numValsToPrint, firstValToPrint );
00592 break;
00593 }
00594
00595 if( buffer )
00596 free(buffer);
00597
00598 return(returnValue);
00599 }
00600 else
00601 {
00602 if( argc > 6 )
00603 numValsToPrint = strtoll(argv[6], NULL, 10);
00604 else
00605 numValsToPrint = 10;
00606
00607 if( argc > 7 )
00608 firstValToPrint = strtoll(argv[7], NULL, 10);
00609 else
00610 firstValToPrint = 0;
00611
00612 if( strcmp( argv[4], "MADnes" ) == 0 )
00613 runType = M3_MADNES_RUN_TYPE;
00614 else if( strcmp( argv[3], "MADmap") == 0 )
00615 runType = M3_MADMAP_RUN_TYPE;
00616 else if( strcmp( argv[3], "MADspec") == 0 )
00617 runType = M3_MADSPEC_RUN_TYPE;
00618 else if( strcmp( argv[3], "springtide") == 0 )
00619 runType = M3_SPRINGTIDE_RUN_TYPE;
00620 else
00621 {
00622 fprintf(stderr, "ERROR: runType is not recognized. Must be one of (MADnes, MADmap, MADspec, or springtide)\n");
00623 return 1;
00624 }
00625 if(strcmp(argv[1], "-r") == 0)
00626 M3_RunConfigStruct_Read( &runConfig, argv[2], runType );
00627 else
00628 M3_RunConfigStruct_ReadBin( &runConfig, argv[2], runType);
00629
00630 if( strcmp( argv[4], "pointing") == 0 )
00631 {
00632 M3_RunConfigStruct_GetDataSetRoot( runConfig, &dataSet );
00633 while(dataSet && strcmp( dataSet->name, argv[5] ) )
00634 dataSet = dataSet->next;
00635
00636 M3_ErrorCheck(-1, "groupID does not match any data set names", (dataSet?1:0), M3_EFLAG_DEFAULT);
00637 readInterval.firstSample = firstValToPrint;
00638 readInterval.lastSample = firstValToPrint+numValsToPrint - 1;
00639
00640 M3_RunConfigStruct_GetTODcache( runConfig, &todCache );
00641 M3_TODcacheStruct_AppendRequest( todCache, dataSet, readInterval);
00642 M3_TODcacheStruct_Initialize( todCache, runConfig, &cacheSize );
00643 printData_RCpointing(dataSet, firstValToPrint, numValsToPrint );
00644 M3_TODcacheStruct_Destroy( todCache );
00645 }
00646 else if( strcmp( argv[4], "tod") == 0 )
00647 {
00648 M3_RunConfigStruct_GetDataSetRoot( runConfig, &dataSet );
00649 while(dataSet && strcmp( dataSet->name, argv[5] ) )
00650 dataSet = dataSet->next;
00651
00652 M3_ErrorCheck(-1, "groupID does not match any data set names", (dataSet?1:0), M3_EFLAG_DEFAULT);
00653 readInterval.firstSample = firstValToPrint;
00654 readInterval.lastSample = firstValToPrint+numValsToPrint - 1;
00655
00656 M3_RunConfigStruct_GetTODcache( runConfig, &todCache );
00657 M3_TODcacheStruct_AppendRequest( todCache, dataSet, readInterval);
00658 M3_TODcacheStruct_Initialize( todCache, runConfig, &cacheSize );
00659 printData_RCtod(dataSet, firstValToPrint, numValsToPrint );
00660 M3_TODcacheStruct_Destroy( todCache );
00661 }
00662
00663 M3_RunConfigStruct_Destroy( runConfig );
00664
00665 }
00666
00667 return 0;
00668
00669 }