Changeset 3755 in Sophya for trunk/AddOn


Ignore:
Timestamp:
Mar 10, 2010, 3:32:34 PM (16 years ago)
Author:
ansari
Message:

Amelioration cosmetique de tstrdfits.cc et ajout fichier makef_auton pour compilation autonome de tstrdfits.cc avec minifits.cc brpaqu.cc, Reza 10/03/2010

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*/
    15
    26// include standard c/c++
     
    812
    913
    10 // include mini-fits lib
     14// include mini-fits lib et manipulation de paquets AcqBAORadio
    1115#include "minifits.h"
     16#include "brpaqu.h"
    1217
    1318int main(int narg, char* arg[])
     
    1924  cout << " ---------- tstrdfits.cc Start ------------- " << endl;
    2025  int rc = 0;
     26  int maxprt = 7;
    2127  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 ----
    2234    for(int ifile=1; ifile<narg; ifile++) {
    2335      string ffname = arg[ifile];
     
    3042        cout << " PB : DataType!=MF_Byte --> skipping " << endl;
    3143      }
    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;
    4275  }
    4376  catch (MiniFITSException& exc) {
Note: See TracChangeset for help on using the changeset viewer.