Changeset 350 in Sophya for trunk/Poubelle
- Timestamp:
- Aug 4, 1999, 4:10:06 PM (26 years ago)
- Location:
- trunk/Poubelle/archTOI.old
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Poubelle/archTOI.old/archeopsfile.cc
r346 r350 1 // archeopsfile.cc 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 4 1 5 #define utilitaires_de_block_archeops 2 6 #include "archeopsfile.h" … … 335 339 type_block(peekBlock) < 0 || type_block(peekBlock) > 19 || 336 340 longueur_block(peekBlock) != long_block[type_block(peekBlock)]) { 337 cout << " block de type/longueur invalide" << endl;341 cout << "invalid block, bad type or length" << endl; 338 342 memset(peekBlock, 0, sizeof(block_type_modele)); // don't keep trash... 339 343 peekPos = searchNextBlock(peekPos); … … 343 347 swapContent(peekBlock); 344 348 if (verifie_block(peekBlock) != block_correct) { 345 cout << " block invalide" << numero_block(peekBlock);349 cout << "invalid block " << numero_block(peekBlock); 346 350 if (!fixBlock(peekBlock)) { 347 351 cout << " -- skipped" << endl; … … 378 382 } 379 383 380 bool ArcheopsFile::fixBlock(block_type_modele* blk) {384 bool ArcheopsFile::fixBlock(block_type_modele* ) { 381 385 return false; 382 386 } … … 505 509 #else 506 510 block_type_param* param = lastParam(); 511 if (!param) return; 507 512 int jc=0;for(int j=0;j<nb_max_bolo;j++) // jc = bolo_comprime // j=bolo normal 508 513 { … … 730 735 if (*p2 == ':' || *p2 == '/') p2++; 731 736 if (*p2 == 'h') p2++; 732 if (!strncmp(p2, "ARK",3) ) {737 if (!strncmp(p2, "ARK",3) || !strncmp(p2,"ark",3)) { 733 738 rawMJD = 1377.4; 734 739 } else { … … 806 811 bool ArcheopsFile::hasGPSTime() { 807 812 if (!lastGPS()) return false; 808 return blockSet->gpsParser.hasGPSTime(); 813 // return blockSet->gpsParser.hasGPSTime(); 814 return blockSet->gpsParser.hasTime(); 809 815 } 810 816 -
trunk/Poubelle/archTOI.old/archeopsfile.h
r342 r350 1 // archeopsfile.h 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 1 4 #ifndef ARCHEOPSFILE_H 2 5 #define ARCHEOPSFILE_H -
trunk/Poubelle/archTOI.old/archtoi.cc
r342 r350 1 // archtoi.cc 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 4 1 5 #include <string> 2 6 #include <iostream.h> … … 27 31 void ArchTOI::init() 28 32 { 29 format = ascii ;33 format = ascii_fmt; 30 34 undef = "#"; 31 35 allBolos = false; … … 60 64 tsttoi(sampleNum) 61 65 else tsttoi(internalTime) 62 else tsttoi( utc)66 else tsttoi(mjd) 63 67 else tsttoi(boloTens) 64 68 else tsttoi(boloRaw) 65 else tsttoi(sst Signal)66 else tsttoi(sst Raw)69 else tsttoi(sstDiode) 70 else tsttoi(sstChannel) 67 71 else tsttoi(sstStarZ) 68 72 else tsttoi(sstStarF) … … 117 121 } 118 122 if (key == "#ASCII") { 119 format = ascii; 123 format = ascii_fmt; 124 } else if (key == "#FITS") { 125 format = fits_fmt; 120 126 } else if (key == "#TRANGE") { 121 127 double tmin, tmax; … … 135 141 double t0; 136 142 sscanf(arg.c_str(), "%lg", &t0); 137 svr.SetMJD0(0); 143 svr.SetMJD0(t0); 144 } else if (key == "#PERECH") { 145 double t0; 146 sscanf(arg.c_str(), "%lg", &t0); 147 svr.SetPerEch(t0); 138 148 } else if (key == "#END") { 139 149 return false; … … 190 200 while (iter.Next()) { 191 201 int nn = iter.getSampleIndex(); 192 // if (nn%200 == 0) {cout << "."; cout.flush(); 193 // if (ofn != iter.currentFile()->filename()) { 194 // ofn = iter.currentFile()->filename(); 195 // cout << "current file=" << ofn << endl; 196 // } 197 //} 198 //if (nn%(200*80) == 0) cout << endl; 202 if (nn%200 == 0) { 203 cout << "."; cout.flush(); 204 } 205 if (nn%(200*80) == 0) cout << endl; 199 206 // Si rien de dispo parmi les triggering, alors on passe au suivant 200 207 bool hasValue = false; -
trunk/Poubelle/archTOI.old/archtoi.h
r342 r350 1 // archtoi.h 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 1 4 #ifndef ARCHTOI_H 2 5 #define ARCHTOI_H … … 18 21 void run(string const& filename); 19 22 20 enum fmt {ascii };23 enum fmt {ascii_fmt, fits_fmt}; 21 24 enum flg {hasflag = 1, 22 25 useNA = 2}; -
trunk/Poubelle/archTOI.old/archtoidump.cc
r342 r350 1 // archtoidump.cc 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 1 3 2 4 #include <iostream.h> -
trunk/Poubelle/archTOI.old/archtoimain.cc
r342 r350 1 // archtoimain.cc 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 1 4 #include <iostream.h> 2 5 #include <fstream.h> -
trunk/Poubelle/archTOI.old/gpsparser.cc
r346 r350 1 // gpsparser.cc 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 4 1 5 #include <string.h> 2 6 #include <stdio.h> … … 63 67 // $104020,3740.712,N,00400.781,W,0,00,01.0,0003,M,-050,M,, 64 68 65 //#include <fstream.h>66 //#include <iomanip.h>69 #include <fstream.h> 70 #include <iomanip.h> 67 71 //ofstream gpsdump("gpsdump"); 68 72 //ofstream gpsdata("gpsdata"); … … 72 76 strncpy(gpsString, blk->gps, 80); 73 77 char* p = gpsString; 74 //gpsdump << p ; if (p[strlen(p)-1] != '\n') gpsdump << '\n';78 // gpsdump << p ; if (p[strlen(p)-1] != '\n') gpsdump << '\n'; 75 79 char* fence = p+80; 76 80 stringOk = false; … … 154 158 if (*p != 'M') return; 155 159 156 //if (gpsutc < outc) jr += 86400;157 //outc = gpsutc;158 //gpsdata << setprecision(10) << gpsutc + jr << " " << gpslat << " " << gpslong << " " << quality << " " << nsat << '\n';160 // if (gpsutc < outc) jr += 86400; 161 // outc = gpsutc; 162 // gpsdata << setprecision(10) << gpsutc + jr << " " << gpslat << " " << gpslong << " " << quality << " " << nsat << '\n'; 159 163 160 164 stringOk = true; -
trunk/Poubelle/archTOI.old/gpsparser.h
r342 r350 1 // gpsparser.h 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 1 4 #ifndef GPSPARSER_H 2 5 #define GPSPARSER_H -
trunk/Poubelle/archTOI.old/ssthandler.cc
r342 r350 1 // ssthandler.cc 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 4 1 5 // Prediction mouvement d'etoiles entre un tour et le suivant... 2 6 // si TS -> TS + dT, H -> H + dT, dT=dH -
trunk/Poubelle/archTOI.old/ssthandler.h
r342 r350 1 // ssthandler.h 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 1 4 #ifndef SSTHANDLER_H 2 5 #define SSTHANDLER_H -
trunk/Poubelle/archTOI.old/toiinterpolator.cc
r342 r350 1 // toiinterpolator.cc 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 4 1 5 #include "toiinterpolator.h" 2 6 -
trunk/Poubelle/archTOI.old/toiinterpolator.h
r342 r350 1 // toiinterpolator.h 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 4 1 5 #ifndef TOIINTERPOLATOR_H 2 6 #define TOIINTERPOLATOR_H -
trunk/Poubelle/archTOI.old/toiiter.cc
r342 r350 1 // toiiter.cc 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 4 1 5 #include "toiiter.h" 2 6 #include "toiinterpolator.h" … … 13 17 file = NULL; 14 18 directory = ""; 15 fileName = "";16 19 17 20 files.clear(); … … 26 29 tBlock0 = -1; 27 30 perEch = -1; 31 // Values for Trapani 99 = default values 32 tBlock0 = 1376.8358818; 33 perEch = 0.005836818076; 28 34 29 35 trigMask = 0; … … 37 43 TOIIter::TOIIter(TOIIter const& x) { 38 44 directory = x.directory; 39 fileName = x.fileName;40 45 files = x.files; 41 46 // curFile = x.curFile; // $CHECK$ DANGER !! … … 82 87 83 88 void TOIIter::Init() { 84 // On a soit un repertoire, soit un fichier, soit une liste de fichiers....89 // On a soit un repertoire, soit une liste de fichiers.... 85 90 if (directory == "") { 86 if (files.empty()) { // un seul fichier 87 file = new ArcheopsFile(fileName); 91 if (files.empty()) { // Ni repertoire, ni fichiers 92 cerr << "toiiter : pas de repertoire, pas de fichiers" << endl; 93 exit(-1); 88 94 } else { 89 curFile = files.begin(); 90 file = new ArcheopsFile((*curFile).c_str()); 95 // On a deja une liste de fichiers 91 96 } 92 97 } else { // On a un repertoire a explorer … … 123 128 } 124 129 } else if (isOnBoardRecorder) { 125 if (strncmp(ent->d_name, "ARK", 3) ) continue;130 if (strncmp(ent->d_name, "ARK", 3) && strncmp(ent->d_name, "ark", 3)) continue; 126 131 char * sfx = ent->d_name + strlen(ent->d_name) - 4; 127 if (strcmp(sfx, ".DAT") ) continue;132 if (strcmp(sfx, ".DAT") && strcmp(sfx, ".dat")) continue; 128 133 files.insert(directory + ent->d_name); 129 134 } … … 131 136 } 132 137 closedir(dir); 133 curFile = files.begin(); 134 file = new ArcheopsFile((*curFile).c_str()); 135 } 138 } 139 140 ScanFiles(); 141 142 curFile = files.begin(); 143 file = new ArcheopsFile((*curFile).c_str()); 144 cout << "opening file " << (*curFile).c_str() << endl; 136 145 137 146 // On avance jusqu'a avoir au moins un bloc param et un bloc reglage, … … 139 148 // Si on a des donnees de l'enregistreur de vol, pas de bloc param, et 140 149 // on en simule un 150 double oldTStart = tStart; 151 tStart = -9.e99; // pour init, on accepte des blocs avant tstart.... 152 141 153 if (!file->lastParam()) { 142 154 if (isOnBoardRecorder) { … … 170 182 file->popMark(); 171 183 } 184 tStart = oldTStart; // on restaure 172 185 173 186 if (perEch < 0) … … 200 213 trigMask |= block_sst_mask; 201 214 break; 202 case sst Signal:215 case sstDiode: 203 216 file->needSSTProcessMask(SSTHandler::rmveOffset); 204 217 trigMask |= block_sst_mask; 205 218 break; 206 case sst Raw:219 case sstChannel: 207 220 trigMask |= block_sst_mask; 208 221 break; … … 234 247 } 235 248 delete file; file = NULL; // on ne travaille plus sur le fichier directement... 249 } 250 } 251 252 void TOIIter::ScanFiles() { 253 file1stSamp.clear(); 254 cout << "Scanning all files" << endl; 255 // Petite astuce pour les STL non conformes comme celles de digital 256 // qui ne supportent pas files.erase(i) suivi de i++.... 257 set<string> copy = files; 258 for (set<string>::iterator i = copy.begin(); i != copy.end(); i++) { 259 ArcheopsFile fich((*i).c_str()); 260 if (fich.nextBlock()) { 261 file1stSamp[*i] = fich.blockNum()*72; // premier numsample 262 cout << "File " << *i << " 1st sample = " << fich.blockNum()*72 << endl; 263 } else { 264 cout << "File " << *i << " unrecoverable, skipping" << endl; 265 files.erase(*i); 266 } 267 } 268 cout << "Scan done" << endl; 269 270 // Et maintenant, on ne garde que ceux qui tombent dans l'intervalle... 271 copy = files; 272 string prev=""; 273 for (set<string>::iterator i = copy.begin(); i != copy.end(); i++) { 274 double smp = file1stSamp[*i]; 275 double t = tBlock0 + smp * perEch/86400.; 276 if (t>tEnd) { // premier echantillon apres tEnd 277 files.erase(*i); 278 prev = ""; 279 continue; 280 } 281 if (t<tStart) { // premier echantillon avant tStart -> on vire le precedent si existe 282 if (prev != "") { 283 files.erase(prev); 284 } 285 } 286 prev = *i; 236 287 } 237 288 } … … 256 307 } 257 308 309 258 310 bool TOIIter::Next() { 311 while (1) { 312 if (!NextSample()) return false; // end of files 313 double t = tBlock0+(file->blockNum() * file->nEchBlock() + imes) * perEch/86400.; 314 if (t < tStart) continue; 315 if (t > tEnd) return false; 316 return true; 317 } 318 } 319 320 bool TOIIter::NextSample() { 259 321 if (rawIter) { // Delegation pour interpolation 260 322 // Trouve prochain sample disponible … … 324 386 case sampleNum: 325 387 case internalTime: 326 case utc:388 case mjd: 327 389 return true; 328 390 case boloTens: … … 331 393 case boloRaw: 332 394 return file->lastBolo() != NULL; 333 case sst Signal:334 case sst Raw:395 case sstDiode: 396 case sstChannel: 335 397 return file->lastSST() != NULL; 336 398 case sstStarZ: … … 370 432 //return (file->blockNum() * file->nEchBlock() + imes) * file->perEchant(); 371 433 return (file->blockNum() * file->nEchBlock() + imes) * perEch; 372 case utc:373 /* printf(" utc: %d %d %g %g %g\n",file->blockNum(),434 case mjd: 435 /* printf("mjd: %d %d %g %g %g\n",file->blockNum(), 374 436 (file->blockNum() * file->nEchBlock() + imes), 375 437 file->perEchant(), … … 382 444 case boloRaw: 383 445 return file->getRawBolo(index, imes); 384 case sst Signal:446 case sstDiode: 385 447 return file->getSSTSignal(index, imes); 386 case sst Raw:448 case sstChannel: 387 449 return file->getSSTRawSignal(index, imes); 388 450 case sstStarZ: … … 419 481 case sampleNum: 420 482 case internalTime: 421 case utc:483 case mjd: 422 484 return true; 423 485 case boloTens: … … 425 487 case boloRaw: 426 488 return file->blockNum() == file->getBoloBlockNum(); 427 case sst Raw:428 case sst Signal:489 case sstChannel: 490 case sstDiode: 429 491 case sstStarZ: 430 492 case sstStarF: -
trunk/Poubelle/archTOI.old/toiiter.h
r342 r350 1 // toiiter.h 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 1 4 #ifndef TOIITER_H 2 5 #define TOIITER_H … … 5 8 #include <vector> 6 9 #include <set> 10 #include <map> 7 11 #include <string> 8 12 #include "archeopsfile.h" … … 11 15 sampleNum, // Numero d''echantillon (timer interne transputer) 12 16 internalTime, // temps transputer depuis debut manip, en secondes. 13 utc, // UTC (en jours, MJD = JD - 2450000). index=0 : premier bloc GPS. 1: + sioux.17 mjd, // UTC (en jours, MJD = JD - 2450000). index=0 : premier bloc GPS. 1: + sioux. 14 18 boloTens, // tension en microVolts, filtree avec filtre carre indexe par bolometre 15 19 boloRaw, // tension brute, non filtree indexe par bolometre 16 20 boloTemp, // Kelvins 17 sst Signal,// signal brut SST, indice = diode, 0-4518 sst Raw,// signal brut SST, indice = canal, 0-4721 sstDiode, // signal brut SST, indice = diode, 0-45 22 sstChannel, // signal brut SST, indice = canal, 0-47 19 23 sstStarZ, // numero de diode d''une eventuelle etoile, i=etoile 0..n 20 24 sstStarF, // flux d''une eventuelle etoile, <0 si moins de i+1 etoiles … … 78 82 TOIIter(); 79 83 void Init(); // After setting the options, opens the first file. 84 void ScanFiles(); // Parcourt tous les fichiers, cherche le premier echantillon... 80 85 86 bool NextSample(); // no test of trange 81 87 bool NextFile(); 82 88 83 89 ArcheopsFile* file; 84 string directory; // If several files to be read85 s tring fileName; // If only one file to be read86 set<string> files; // list of files in the directory...90 string directory; // If directory scanning 91 set<string> files; // list of files to be read... 92 map<string, long> file1stSamp; // premier echantillon de chaque fichier 87 93 set<string>::iterator curFile; 88 94 bool isOnBoardRecorder; -
trunk/Poubelle/archTOI.old/toisvr.cc
r342 r350 1 // toisvr.cc 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 4 1 5 #include "toisvr.h" 2 6 … … 6 10 void TOISvr::SetDirectory(string d) { 7 11 iter.directory = d; 8 iter.fileName = "";9 }10 11 void TOISvr::SetFile(string f) {12 iter.directory = "";13 iter.fileName = f;14 12 } 15 13 16 14 void TOISvr::AddFile(string f) { 17 iter.directory = "";18 15 iter.files.insert(f); 19 16 } … … 23 20 } 24 21 22 void TOISvr::SetPerEch(double t0) { // en secondes, periode d'echantillonnage 23 iter.perEch = t0; 24 } 25 25 26 26 void TOISvr::OnBoardRecorderFiles(bool x) { -
trunk/Poubelle/archTOI.old/toisvr.h
r342 r350 1 // toisvr.h 2 // Eric Aubourg CEA/DAPNIA/SPP juillet 1999 3 4 1 5 #ifndef TOISVR_H 2 6 #define TOISVR_H … … 9 13 10 14 void SetDirectory(string); 11 void SetFile(string);12 15 void AddFile(string); 13 16 void OnBoardRecorderFiles(bool); 14 17 void SetMJD0(double); 18 void SetPerEch(double); 15 19 16 20 void SetTimeInterval(double tStart, double tEnd);
Note:
See TracChangeset
for help on using the changeset viewer.