1 | #include <stdio.h>
|
---|
2 | #include <stdlib.h>
|
---|
3 | #include <math.h>
|
---|
4 | #include <iostream.h>
|
---|
5 |
|
---|
6 | #include "histinit.h"
|
---|
7 | #include "dvlist.h"
|
---|
8 | #include "ntuple.h"
|
---|
9 | #include "xntuple.h"
|
---|
10 | #include "fitsxntuple.h"
|
---|
11 | #include "fitsntuple.h"
|
---|
12 |
|
---|
13 | int main(int narg, char *arg[])
|
---|
14 | {
|
---|
15 | if (narg < 2) {
|
---|
16 | cerr << "scanfits/Erreur arg - Usage scanfits nomfits \n" << endl;
|
---|
17 | exit(0);
|
---|
18 | }
|
---|
19 | try {
|
---|
20 | SophyaInit();
|
---|
21 | string flnm = arg[1];
|
---|
22 | int nbblk = FitsInFile::NbBlocks(arg[1]);
|
---|
23 | cout << " :::: File " << flnm << " has " << nbblk << " blocks " << endl;
|
---|
24 | DVList header;
|
---|
25 | FitsFile::FitsExtensionType exttype;
|
---|
26 | FitsFile::FitsDataType datatype;
|
---|
27 |
|
---|
28 | cout << " FitsFile::FitsExtensionType : FitsExtensionType_IMAGE= " <<
|
---|
29 | (int)FitsFile::FitsExtensionType_IMAGE <<
|
---|
30 | " FitsExtensionType_ASCII_TBL= " << (int)FitsFile::FitsExtensionType_ASCII_TBL <<
|
---|
31 | " FitsExtensionType_BINARY_TBL= " << (int)FitsFile::FitsExtensionType_BINARY_TBL << endl;
|
---|
32 | cout << " FitsFile::FitsDataType: FitsDataType_double= " <<
|
---|
33 | (int)FitsFile::FitsDataType_double <<
|
---|
34 | " FitsDataType_float= " << (int)FitsFile::FitsDataType_float <<
|
---|
35 | " FitsDataType_int= " << (int)FitsFile::FitsDataType_int <<
|
---|
36 | " FitsDataType_char= " << (int)FitsFile::FitsDataType_char <<
|
---|
37 | " FitsDataType_ASCII= " << (int)FitsFile::FitsDataType_ASCII << endl << endl;
|
---|
38 |
|
---|
39 | int naxis;
|
---|
40 | vector<int> axis;
|
---|
41 | for(int i=1; i<=nbblk; i++) {
|
---|
42 | FitsInFile::GetBlockType(arg[1], i, exttype, naxis, axis, datatype, header);
|
---|
43 | cout << " --------- Header Num " << i << " Type " << (int)exttype
|
---|
44 | << " NAxis= " << naxis << " (" << axis.size() << " )"
|
---|
45 | << " DataType= " << (int)datatype << endl;
|
---|
46 | for(int j=0; j<axis.size(); j++) cout << axis[j] << " x " ;
|
---|
47 | cout << endl;
|
---|
48 | cout << header << endl;
|
---|
49 | cout << "----------------------------------------------------" << endl;
|
---|
50 | }
|
---|
51 |
|
---|
52 | }
|
---|
53 | catch (PThrowable & exc) {
|
---|
54 | cerr << " Catched Exception " << (string)typeid(exc).name()
|
---|
55 | << " - Msg= " << exc.Msg() << endl;
|
---|
56 | }
|
---|
57 | catch (...) {
|
---|
58 | cerr << " some other exception was caught ! " << endl;
|
---|
59 | }
|
---|
60 |
|
---|
61 | }
|
---|