Changeset 3635 in Sophya for trunk/AddOn/TAcq/mfits2spec.cc


Ignore:
Timestamp:
May 26, 2009, 5:05:44 PM (16 years ago)
Author:
ansari
Message:

Amelioration/ correction diverses, introduction du programme de lecture / traitement multi-thread mcrd.cc - Reza 26/05/2009

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/mfits2spec.cc

    r3610 r3635  
    4545int ana_data_0(vector<string>& infiles, string& outfile);
    4646// Fonction d'analyse 2eme version , 1 voie / paquet
    47 int ana_data_1(vector<string>& infiles, string& oufile);
     47int ana_data_1(vector<string>& infiles, string& oufile, bool fgnotrl=false);
    4848// Fonction d'analyse 2eme version , 2 voies / paquet
    49 int ana_data_2(vector<string>& infiles, string& oufile);
     49int ana_data_2(vector<string>& infiles, string& oufile, bool fgnotrl=false);
    5050// Fonction d'analyse 2eme version , 2 voies / paquet
    51 int ana_data_fft_2(vector<string>& infiles, string& oufile);
     51int ana_data_fft_2(vector<string>& infiles, string& oufile, bool fgnotrl=false);
    5252
    5353//----------------------------------------------------
     
    5959    cout << " Usage: mfits2spec ACT OutPPF file1 [file2 file3 ...] " << endl;
    6060    cout << "  Or :  mfits2spec ACT OutPPF -infits DirName Imin Imax " << endl;
    61     cout << " ACT=-0,-1,-2,-fft2 \n"
     61    cout << " ACT=-0,-1,-2,-fft2 , -1nt -2nt -fft2nt \n"
    6262         << "   -0: Nancay-July2008 \n"
    6363         << "   -1,-2 :  Raw data  1 ou 2 channels / packet(or frame) \n"
    64          << "   -fft2 :  FFT data 2 channels / packet " << endl;
     64         << "   -fft2 :  FFT data 2 channels / packet \n"
     65         << "   nt : (-1nt -2nt -fft2nt) fits files without frame trailer " << endl;
    6566    cout << " OutPPF : Output PPF file name " << endl; 
    6667    cout << " file1,file2 ... : Input FITS files " << endl; 
     
    9697    cout << " ---------- mfits2spec.cc Start - ACT= " << act << " ------------- " << endl;
    9798    ResourceUsage resu;
     99    bool fgnotrl=false;   // fichier fits avec Trailer de frame (> mai 2009)
     100    if ((act=="-1nt")||(act=="-2nt")||(act=="-fft2nt")) fgnotrl=true;  // fichier fits SANS trailer
     101
    98102    if (act == "-0") ana_data_0(infiles, outppf);
    99     else if (act == "-1") ana_data_1(infiles, outppf);
    100     else if (act == "-2") ana_data_2(infiles, outppf);
    101     else if (act == "-fft2") ana_data_fft_2(infiles, outppf);
     103    else if ((act == "-1")||(act=="-1nt")) ana_data_1(infiles, outppf, fgnotrl);
     104    else if ((act == "-2")||(act=="-2nt")) ana_data_2(infiles, outppf, fgnotrl);
     105    else if ((act == "-fft2")||(act=="-fft2nt")) ana_data_fft_2(infiles, outppf, fgnotrl);
    102106    else cout << " mfits2spec.cc / Bad argument ACT=" << act << " -> exit" << endl;
    103107    cout << resu ;
     
    177181
    178182/*--Nouvelle-Fonction--*/
    179 int ana_data_1(vector<string>& infiles, string& outfile)
     183int ana_data_1(vector<string>& infiles, string& outfile, bool fgnotrl)
    180184// Calcul spectre moyen 1 voie, donnees brutes 
    181185{
     
    202206      continue;
    203207    }
    204 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) ...
     208// Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) si fgnotrl=true
     209    int incpaqsz=0;
     210    if (fgnotrl) {
     211      incpaqsz=16;
     212      cout << " Warning : FITS files without frame trailers ..." << endl;
     213    }
    205214    if (paqsz == 0)  {  // premier passage, on fixe la taille de paquet et on alloue le buffer
    206       paqsz = mff.NAxis1()+16;
     215      paqsz = mff.NAxis1()+incpaqsz;
    207216      data = new Byte[paqsz];
    208217      for(int ib=0; ib<paqsz; ib++) data[ib]=0;
    209218    }
    210219    else {
    211       if (paqsz != mff.NAxis1()+16) {
    212       cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+16 --> skipping " << endl;
     220      if (paqsz != mff.NAxis1()+incpaqsz) {
     221      cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+" << incpaqsz << " --> skipping " << endl;
    213222      continue;
    214223      }
     
    257266
    258267/*--Nouvelle-Fonction--*/
    259 int ana_data_2(vector<string>& infiles, string& outfile)
     268int ana_data_2(vector<string>& infiles, string& outfile, bool fgnotrl)
    260269// Calcul spectres moyens 2 voies, donnees brutes 
    261270{
     
    284293      continue;
    285294    }
    286 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) ...
     295// Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) si fgnotrl=true
     296    int incpaqsz=0;
     297    if (fgnotrl) {
     298      incpaqsz=16;
     299      cout << " Warning : FITS files without frame trailers ..." << endl;
     300    }
    287301    if (paqsz == 0)  {  // premier passage, on fixe la taille de paquet et on alloue le buffer
    288       paqsz = mff.NAxis1()+16;
     302      paqsz = mff.NAxis1()+incpaqsz;
    289303      cout << " ana_data_2/ Allocating data , PaqSz=" << paqsz << endl;
    290304      data = new Byte[paqsz];
     
    292306    }
    293307    else {
    294       if (paqsz != mff.NAxis1()+16) {
    295       cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+16 --> skipping " << endl;
     308      if (paqsz != mff.NAxis1()+incpaqsz) {
     309      cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+" << incpaqsz << " --> skipping " << endl;
    296310      continue;
    297311      }
     
    359373
    360374/*--Nouvelle-Fonction--*/
    361 int ana_data_fft_2(vector<string>& infiles, string& outfile)
     375int ana_data_fft_2(vector<string>& infiles, string& outfile, bool fgnotrl)
    362376// Calcul spectres moyens 2 voies, donnees brutes 
    363377{
     
    385399      continue;
    386400    }
    387 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) ...
     401// Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) si fgnotrl=true
     402    int incpaqsz=0;
     403    if (fgnotrl) {
     404      incpaqsz=16;
     405      cout << " Warning : FITS files without frame trailers ..." << endl;
     406    }
    388407    if (paqsz == 0)  {  // premier passage, on fixe la taille de paquet et on alloue le buffer
    389       paqsz = mff.NAxis1()+16;
     408      paqsz = mff.NAxis1()+incpaqsz;
    390409      cout << " ana_data_fft_2/ Allocating data , PaqSz=" << paqsz << endl;
    391410      data = new Byte[paqsz];
     
    393412    }
    394413    else {
    395       if (paqsz != mff.NAxis1()+16) {
    396       cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+16 --> skipping " << endl;
     414      if (paqsz != mff.NAxis1()+incpaqsz) {
     415      cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+" << incpaqsz << " --> skipping " << endl;
    397416      continue;
    398417      }
Note: See TracChangeset for help on using the changeset viewer.