Changeset 3635 in Sophya for trunk/AddOn/TAcq/mfits2spec.cc
- Timestamp:
- May 26, 2009, 5:05:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/mfits2spec.cc
r3610 r3635 45 45 int ana_data_0(vector<string>& infiles, string& outfile); 46 46 // Fonction d'analyse 2eme version , 1 voie / paquet 47 int ana_data_1(vector<string>& infiles, string& oufile );47 int ana_data_1(vector<string>& infiles, string& oufile, bool fgnotrl=false); 48 48 // Fonction d'analyse 2eme version , 2 voies / paquet 49 int ana_data_2(vector<string>& infiles, string& oufile );49 int ana_data_2(vector<string>& infiles, string& oufile, bool fgnotrl=false); 50 50 // Fonction d'analyse 2eme version , 2 voies / paquet 51 int ana_data_fft_2(vector<string>& infiles, string& oufile );51 int ana_data_fft_2(vector<string>& infiles, string& oufile, bool fgnotrl=false); 52 52 53 53 //---------------------------------------------------- … … 59 59 cout << " Usage: mfits2spec ACT OutPPF file1 [file2 file3 ...] " << endl; 60 60 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" 62 62 << " -0: Nancay-July2008 \n" 63 63 << " -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; 65 66 cout << " OutPPF : Output PPF file name " << endl; 66 67 cout << " file1,file2 ... : Input FITS files " << endl; … … 96 97 cout << " ---------- mfits2spec.cc Start - ACT= " << act << " ------------- " << endl; 97 98 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 98 102 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); 102 106 else cout << " mfits2spec.cc / Bad argument ACT=" << act << " -> exit" << endl; 103 107 cout << resu ; … … 177 181 178 182 /*--Nouvelle-Fonction--*/ 179 int ana_data_1(vector<string>& infiles, string& outfile )183 int ana_data_1(vector<string>& infiles, string& outfile, bool fgnotrl) 180 184 // Calcul spectre moyen 1 voie, donnees brutes 181 185 { … … 202 206 continue; 203 207 } 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 } 205 214 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; 207 216 data = new Byte[paqsz]; 208 217 for(int ib=0; ib<paqsz; ib++) data[ib]=0; 209 218 } 210 219 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; 213 222 continue; 214 223 } … … 257 266 258 267 /*--Nouvelle-Fonction--*/ 259 int ana_data_2(vector<string>& infiles, string& outfile )268 int ana_data_2(vector<string>& infiles, string& outfile, bool fgnotrl) 260 269 // Calcul spectres moyens 2 voies, donnees brutes 261 270 { … … 284 293 continue; 285 294 } 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 } 287 301 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; 289 303 cout << " ana_data_2/ Allocating data , PaqSz=" << paqsz << endl; 290 304 data = new Byte[paqsz]; … … 292 306 } 293 307 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; 296 310 continue; 297 311 } … … 359 373 360 374 /*--Nouvelle-Fonction--*/ 361 int ana_data_fft_2(vector<string>& infiles, string& outfile )375 int ana_data_fft_2(vector<string>& infiles, string& outfile, bool fgnotrl) 362 376 // Calcul spectres moyens 2 voies, donnees brutes 363 377 { … … 385 399 continue; 386 400 } 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 } 388 407 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; 390 409 cout << " ana_data_fft_2/ Allocating data , PaqSz=" << paqsz << endl; 391 410 data = new Byte[paqsz]; … … 393 412 } 394 413 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; 397 416 continue; 398 417 }
Note:
See TracChangeset
for help on using the changeset viewer.