Changeset 3755 in Sophya for trunk/AddOn
- Timestamp:
- Mar 10, 2010, 3:32:34 PM (16 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/tstrdfits.cc
r3639 r3755 1 /* Projet BAORadio 2 (C) LAL / Univ. Paris Sud , IRFU 2007-2010 3 Programme de lecture des paquets Acquisition BAORadio 4 */ 1 5 2 6 // include standard c/c++ … … 8 12 9 13 10 // include mini-fits lib 14 // include mini-fits lib et manipulation de paquets AcqBAORadio 11 15 #include "minifits.h" 16 #include "brpaqu.h" 12 17 13 18 int main(int narg, char* arg[]) … … 19 24 cout << " ---------- tstrdfits.cc Start ------------- " << endl; 20 25 int rc = 0; 26 int maxprt = 7; 21 27 try { 28 int paqsz = 0; 29 int nprt = 0; 30 BRPaquet paq; 31 BRPaqChecker pcheck; 32 Byte* data=NULL; 33 //---- Boucle sur les fichiers a lire ---- 22 34 for(int ifile=1; ifile<narg; ifile++) { 23 35 string ffname = arg[ifile]; … … 30 42 cout << " PB : DataType!=MF_Byte --> skipping " << endl; 31 43 } 32 size_t sx = mff.NAxis1(); 33 size_t sy = mff.NAxis2(); 34 Byte* data = new Byte[sx]; 35 for(int j=0; j<sy; j++) { 36 mff.ReadB(data, sx, j*sx); 37 cout << " j=" << j << " data[0...3]=" << (int)data[0] << " , " 38 << (int)data[1] << " , " << (int)data[2] << endl; 39 } 40 cout << "---- FIN lecture " << ffname << endl; 41 } 44 if (paqsz == 0) { // premier passage, on fixe la taille de paquet et on alloue le buffer 45 paqsz = mff.NAxis1(); 46 cout << " tstrdfits/ Allocating data , PaqSz=" << paqsz << endl; 47 data = new Byte[paqsz]; 48 for(int ib=0; ib<paqsz; ib++) data[ib]=0; 49 paq.Set(data, paqsz); 50 } 51 else { // Sinon, on verifie que les differents fichiers ont la meme taille de paquet 52 if (paqsz != mff.NAxis1()) { 53 cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()" << " --> skipping " << endl; 54 continue; 55 } 56 } 57 58 size_t sx = mff.NAxis1(); 59 size_t sy = mff.NAxis2(); 60 // On construit un paquet sur 61 // Boucle de lecture des paquets dans le fichier 62 for(int j=0; j<sy; j++) { 63 mff.ReadB(data, sx, j*sx); // Lecture du paquet 64 pcheck.Check(paq); // Verification, comptage des paquets OK 65 if ((j%55==0)&&(nprt<maxprt)) { // Impression optionnel du contenu du paquet 66 paq.Print(); nprt++; 67 } 68 } 69 cout << "---- FIN lecture fichier " << ffname << endl; 70 } 71 cout << "-------- FIN boucle de lecture des fichiers ----------" << endl; 72 cout << pcheck; 73 cout << "------------------------------------------------------" << endl; 74 delete[] data; 42 75 } 43 76 catch (MiniFITSException& exc) {
Note:
See TracChangeset
for help on using the changeset viewer.