source: Sophya/trunk/Poubelle/archTOI.old/toiiter.cc@ 426

Last change on this file since 426 was 426, checked in by ansari, 26 years ago

alpha delta a partir croisement galax

File size: 21.4 KB
Line 
1// toiiter.cc
2// Eric Aubourg CEA/DAPNIA/SPP juillet 1999
3
4#ifndef nb_max_bolo
5#define _archeops // Acquisition Archeops (avec transputer)
6#define programme
7extern "C" {
8#include "archeops.h"
9}
10#endif
11
12
13#include "toiiter.h"
14#include "toiinterpolator.h"
15#include "archparam.h"
16#include <dirent.h>
17#include <iostream.h>
18#include "templocator.h"
19
20// Format bloc GPS
21// $GPGGA,hhmmss.ss,ddmm.mmmm,n,dddmm.mmmm,e,q,ss,y.y,a.a,z,
22
23TOIIter::TOIIter() {
24 // Toutes les valeurs initialisees par defaut. Le TOISvr les positionnera,
25 // puis lancera l'initialisation
26
27 file = NULL;
28 directory = "";
29
30 files.clear();
31
32 isOnBoardRecorder = false;
33
34 imes=0;
35
36 tStart = -9.e99;
37 tEnd = 9.e99;
38
39 //tBlock0 = -1;
40 // perEch = -1;
41 // Values for Trapani 99 = default values
42 //tBlock0 = 1376.8358818;
43 //perEch = 0.005836818076;
44
45 trigMask = 0;
46 rawIter = NULL;
47 interp = NULL;
48 lastSample = -1;
49 maxLookAhead = 10000;
50
51 auxGPS = NULL;
52
53 initDone = false;
54
55 underSample = 1;
56}
57
58TOIIter::TOIIter(TOIIter const& x) {
59 directory = x.directory;
60 files = x.files;
61 if (x.initDone && x.curFile != x.files.end()) curFile = files.find(*(x.curFile));
62 isOnBoardRecorder = x.isOnBoardRecorder;
63 imes = x.imes;
64 tStart = x.tStart;
65 tEnd = x.tEnd;
66 trigMask = x.trigMask;
67 infos = x.infos;
68
69 if (x.file)
70 file = new ArcheopsFile(*x.file);
71 else
72 file = NULL;
73
74 if (x.rawIter) {
75 rawIter = new TOIIter(*x.rawIter);
76 interp = new TOIInterpolator[infos.size()];
77 for (int i=0; i<infos.size(); i++)
78 interp[i] = x.interp[i];
79 } else {
80 rawIter = NULL;
81 interp = NULL;
82 }
83
84 lastSample = x.lastSample;
85 maxLookAhead = x.maxLookAhead;
86
87 auxGPS = x.auxGPS;
88 if (auxGPS) auxGPS = auxGPS->clone();
89
90 initDone = x.initDone;
91 underSample = x.underSample;
92}
93
94TOIIter::~TOIIter() {
95 delete file;
96 delete rawIter;
97 delete[] interp;
98 delete auxGPS;
99}
100
101#ifdef __MWERKS__
102#define filesep ':'
103#else
104#define filesep '/'
105#endif
106
107void TOIIter::Init() {
108 if (initDone) return;
109 initDone = true;
110 // On a soit un repertoire, soit une liste de fichiers....
111 if (directory == "") {
112 if (files.empty()) { // Ni repertoire, ni fichiers
113 cerr << "toiiter : pas de repertoire, pas de fichiers" << endl;
114 exit(-1);
115 } else {
116 // On a deja une liste de fichiers
117 }
118 } else { // On a un repertoire a explorer
119 // On cherche soit les fichiers dans le repertoire donne, soit des fichiers
120 // dans un sous-repertoire "arch-YY_MM_DD". Les fichiers ont un nom en
121 // "hYY_MM_DD-hh_mm_ss".
122 // Pour l'enregistreur de vol, les fichiers ont un nom en ARKxxxxxx.DAT
123 if (directory[directory.length()-1] != filesep)
124 directory += filesep;
125 DIR* dir = opendir(directory.c_str());
126 struct dirent* ent;
127 while ((ent = readdir(dir)) != NULL) {
128 // si c'est un repertoire, avec un nom de jour, il faut l'explorer...
129 if (!strncmp(ent->d_name, "arch-", 5)) {
130 double mjd = ArcheopsFile::decodeMJD(ent->d_name+5) - 2./24.; // ENTIER + .5 en temps local!
131 if (mjd >= tStart - 1. && mjd <= tEnd) {
132 string direc2 = directory + ent->d_name + filesep;
133 DIR* dir2 = opendir(direc2.c_str());
134 struct dirent* ent2;
135 while ((ent2 = readdir(dir2)) != NULL) {
136 if (*ent2->d_name == 'h') {
137 double mjd2 = ArcheopsFile::decodeMJD(ent->d_name+1) - 2./24.;
138 if (mjd2 >= tStart - 1./24. && mjd2 <= tEnd) {
139 files.insert(direc2 + ent2->d_name);
140 }
141 }
142 }
143 }
144 } else {
145 if (!isOnBoardRecorder && *ent->d_name == 'h') {
146 double mjd = ArcheopsFile::decodeMJD(ent->d_name+1) - 2./24.; // $CHECK$ UTCOffset
147 if (mjd >= tStart - 1./24. && mjd <= tEnd) {
148 files.insert(directory + ent->d_name);
149 }
150 } else if (isOnBoardRecorder) {
151 if (strncmp(ent->d_name, "ARK", 3) && strncmp(ent->d_name, "ark", 3)) continue;
152 char * sfx = ent->d_name + strlen(ent->d_name) - 4;
153 if (strcmp(sfx, ".DAT") && strcmp(sfx, ".dat")) continue;
154 files.insert(directory + ent->d_name);
155 }
156 }
157 }
158 closedir(dir);
159 }
160
161 ScanFiles();
162
163 curFile = files.begin();
164 file = new ArcheopsFile((*curFile).c_str());
165 cout << "opening file " << (*curFile).c_str() << endl;
166
167 // On avance jusqu'a avoir au moins un bloc param et un bloc reglage,
168 // car on ne peut rien faire sans...
169 // Si on a des donnees de l'enregistreur de vol, pas de bloc param, et
170 // on en simule un
171 double oldTStart = tStart;
172 tStart = -9.e99; // pour init, on accepte des blocs avant tstart....
173
174 if (!file->lastParam()) {
175 if (isOnBoardRecorder) {
176 extern param_bolo parametr;
177 block_type_param block;
178 block.param = parametr;
179 valide_block((block_type_modele*)&block, block_param, 0);
180 file->forceBlock((block_type_modele*)&block);
181 } else {
182 file->nextBlock(block_param_mask);
183 }
184 }
185 if (!file->lastReglage()) file->nextBlock(block_reglage_mask);
186
187 // On cherche un bloc GPS pour avoir la correspondance timestamp/UTC.
188 // Pour le moment, on se fonde sur le premier bloc GPS. On pourra faire
189 // mieux en prenant le min de tous les delta_T, a condition d'avoir un
190 // peu plus de details sur la facon dont le GPS est lu.
191
192 if (archParam.acq.tBlock0 < 0) {
193 archParam.acq.tBlock0 = file->getStartMJD();
194
195 file->pushMark();
196 if (file->lastGPS() || file->nextBlock(block_gps_mask)) {
197 // le temps du bloc courant, en secondes
198 double dt = file->blockNum() * file->perBlock();
199 archParam.acq.tBlock0 = file->getGPSMJD() - dt/86400.;
200 } else { // pas de bloc GPS...
201 archParam.acq.tBlock0 = file->getStartMJD();
202 }
203 file->popMark();
204 }
205 tStart = oldTStart; // on restaure
206
207 if (archParam.acq.perEch < 0)
208 archParam.acq.perEch = file->perEchant();
209
210 bool hasInterp = false;
211
212 trigMask = 0;
213 for (vector<info>::iterator i = infos.begin(); i != infos.end(); i++) {
214 if ((*i).interpolated) hasInterp = true;
215 if ((*i).triggering) {
216 switch ((*i).kind) {
217 case boloTens:
218 case boloTens2:
219 case boloRaw:
220 case boloRawCN:
221 case boloTensCN:
222 trigMask |= block_bolo_mask;
223 break;
224 case boloTens2T:
225 case boloRes:
226 case boloTemp:
227 trigMask |= block_bolo_mask | block_reglage_mask;
228 break;
229 case dilDAC:
230 case dilSwitch:
231 trigMask |= block_dilution_mask;
232 case boloGainAmpli:
233 case boloDACV:
234 case boloDACI:
235 trigMask |= block_reglage_mask;
236 break;
237 case gpsTime:
238 case longitude:
239 case latitude:
240 case altitude:
241 trigMask |= block_gps_mask;
242 break;
243 case azimutBolo:
244 trigMask |= block_bolo_mask;
245 //file->needSSTProcessMask(SSTHandler::findPeriod);
246 //trigMask |= block_sst_mask;
247 break;
248 case sstStarCnt:
249 case sstStarZ:
250 case sstStarF:
251 case sstStarT:
252 file->needSSTProcessMask(SSTHandler::findStars);
253 trigMask |= block_sst_mask;
254 break;
255 case sstDiode:
256 case sstDiodeCN:
257 file->needSSTProcessMask(SSTHandler::permDiode);
258 trigMask |= block_sst_mask;
259 break;
260 case sstChannel:
261 case sstChannelCN:
262 trigMask |= block_sst_mask;
263 break;
264 case gyroRaw:
265 case gyroTens:
266 trigMask |= block_gyro_mask;
267 break;
268 case gyroSpeed:
269 trigMask |= block_gyro_mask; // $CHECK$ + info to calibrate gyros
270 break;
271 case alphaAxis:
272 case deltaAxis:
273 case alphaSst:
274 case deltaSst:
275 case alphaBolo:
276 case deltaBolo:
277 trigMask |= block_bolo_mask;
278 //file->needSSTProcessMask(SSTHandler::findAxis);
279 //trigMask |= block_sst_mask;
280 break;
281 }
282 }
283 }
284
285 if (trigMask & (block_bolo_mask | block_sst_mask)) {
286 imes = 9999;
287 } else {
288 imes = 0;
289 }
290
291 if (hasInterp) {
292 rawIter = new TOIIter(*this);
293 interp = new TOIInterpolator[infos.size()];
294 for (int i=0; i<infos.size(); i++) {
295 rawIter->infos[i].interpolated = false;
296 }
297 delete file; file = NULL; // on ne travaille plus sur le fichier directement...
298 }
299}
300
301void TOIIter::ScanFiles() {
302 file1stSamp.clear();
303 cout << "Scanning all files" << endl;
304 // Petite astuce pour les STL non conformes comme celles de digital
305 // qui ne supportent pas files.erase(i) suivi de i++....
306 set<string> copy = files;
307 for (set<string>::iterator i = copy.begin(); i != copy.end(); i++) {
308 ArcheopsFile fich((*i).c_str());
309 if (fich.nextBlock()) {
310 file1stSamp[*i] = fich.blockNum()*72; // premier numsample
311 cout << "File " << *i << " 1st sample = " << fich.blockNum()*72 << endl;
312 } else {
313 cout << "File " << *i << " unrecoverable, skipping" << endl;
314 files.erase(*i);
315 }
316 }
317 cout << "Scan done" << endl;
318
319 // Et maintenant, on ne garde que ceux qui tombent dans l'intervalle...
320 copy = files;
321 string prev="";
322 for (set<string>::iterator i = copy.begin(); i != copy.end(); i++) {
323 double smp = file1stSamp[*i];
324 double t = archParam.acq.tBlock0 + smp * archParam.acq.perEch/86400.;
325 if (t>tEnd) { // premier echantillon apres tEnd
326 files.erase(*i);
327 prev = "";
328 continue;
329 }
330 if (t<tStart) { // premier echantillon avant tStart -> on vire le precedent si existe
331 if (prev != "") {
332 files.erase(prev);
333 }
334 }
335 prev = *i;
336 }
337}
338
339bool TOIIter::NextFile() {
340 if (rawIter)
341 return rawIter->NextFile();
342
343 if (files.empty()) {
344 return false;
345 } else {
346 if (curFile == files.end()) return false;
347 curFile++;
348 if (curFile == files.end()) return false;
349 cout << "opening file " << (*curFile).c_str() << endl;
350 ArcheopsFile* newfile = new ArcheopsFile((*curFile).c_str());
351 newfile->grabLastBlocs(*file);
352 delete file;
353 file = newfile;
354 return true;
355 }
356}
357
358bool TOIIter::Next() {
359 for (int ii=0; ii<underSample; ii++)
360 if (!Next1()) return false;
361 return true;
362}
363
364bool TOIIter::Next1() {
365 if (!initDone) Init();
366 while (1) {
367 if (!NextSample()) return false; // end of files
368 double t = getMJD();
369 if (t < tStart) continue;
370 if (t > tEnd) return false;
371 return true;
372 }
373}
374
375bool TOIIter::NextSample() {
376 if (rawIter) { // Delegation pour interpolation
377 // Trouve prochain sample disponible
378 for (int k=0; k<2; k++) {
379 long smp = 2147483647L;
380 for (int i=0; i<infos.size(); i++) {
381 long ss = interp[i].nextSample(lastSample+1);
382 if (ss > 0 && ss < smp) smp=ss;
383 }
384 if (smp != 2147483647L) {
385 lastSample = smp;
386 break;
387 }
388 if (!fetchAhead()) // tout le monde etait en bout de course,
389 return false; // on lit un echantillon, ca suffit, d'ou le k<2
390 }
391 // Verifie que tous les interpolateurs ont assez de donnees pour
392 // trouver la valeur correspondante
393 for (int i=0; i<infos.size(); i++) {
394 //rif (infos[i].interpolated)
395 while (interp[i].needMoreDataFor(lastSample) &&
396 rawIter->getSampleIndex() - lastSample < maxLookAhead)
397 if (!fetchAhead()) return false;
398 }
399
400 // On est pret...
401 return true;
402 }
403
404 // trigger sur info indexee dans bloc bolo, bloc gyro ou bloc sst ?
405 if (trigMask & (block_bolo_mask | block_sst_mask | block_gyro_mask )) {
406 imes++;
407 if (imes < file->nEchBlock()) return true;
408 imes = 0;
409 }
410
411 // soit pas d'info indexee, soit fin bloc courant...
412 while (1) {
413 if (file->nextBlock(trigMask)) {
414 while (file->sameBlockNumAhead()) { // tant que meme numero de bloc, on lit
415 if (!file->nextBlock()) { // fin de fichier ?
416 if (NextFile()) file->nextBlock(); // fichier suivant
417 else return false; // tout fini
418 }
419 }
420 return true;
421 }
422 if (!NextFile()) return false;
423 }
424}
425
426/* double TOIIter::getTime() { // MJD
427 // le temps du bloc courant, en secondes
428 double dt = file->blockNum() * file->perBlock();
429 return tBlock0 + dt/86400. + imes*file->perEchant()/86400.;
430 }
431 */
432
433bool TOIIter::canGetValue(int column) {
434 if (!initDone) Init();
435 if (column < 0 || column >= infos.size()) return false;
436 TOIKind kind = infos[column].kind;
437 if (auxGPS &&
438 (kind == longitude || kind == latitude || kind == altitude || kind == tsid)) {
439 double dummy;
440 return auxGPS->getLocation(getMJD(), dummy, dummy, dummy) == 0;
441 }
442 if (rawIter) {
443 return interp[column].canGet(lastSample);
444 }
445 int index = infos[column].index;
446 switch (kind) {
447 case sampleNum:
448 case internalTime:
449 case mjd:
450 return true;
451 case boloTens:
452 case boloTens2:
453 case boloTens2T:
454 case boloRes:
455 case boloRawCN:
456 if (imes==0 && file->llastBolo()==NULL) return false;
457 return file->lastBolo() != NULL;
458 case boloTensCN:
459 case boloRaw:
460 return file->lastBolo() != NULL;
461 case boloGainAmpli:
462 case boloDACV:
463 case boloDACI:
464 return file->lastReglage() != NULL;
465 case dilDAC:
466 case dilSwitch:
467 return file->lastDilution() != NULL;
468 case sstDiode:
469 case sstChannel:
470 case sstDiodeCN:
471 case sstChannelCN:
472 return file->lastSST() != NULL;
473 case sstStarCnt:
474 case sstStarZ:
475 case sstStarF:
476 case sstStarT:{
477 if (file->lastSST() == NULL) return false;
478 int n = file->getNumbStar(imes);
479 return (n > 0 && index < n);
480 }
481 case gyroRaw:
482 case gyroTens:
483 case gyroSpeed:
484 return (file->lastGyro() != NULL);
485 case gpsTime:
486 return file->hasGPSTime();
487 case longitude:
488 case latitude:
489 return file->hasGPSPos();
490 case altitude:
491 return file->hasGPSAlt();
492 case tsid:
493 return file->hasGPSPos();
494 case azimutBolo:
495 case alphaAxis:
496 case deltaAxis:
497 case alphaBolo:
498 case deltaBolo:
499 return true;
500 //return (file->lastGPS() != NULL && file->lastSST() != NULL);
501 case alphaSst:
502 case deltaSst:
503 return false;
504
505 case boloTemp:
506 return false;
507 }
508 return false;
509}
510
511
512double TOIIter::getValue(int column) {
513 if (!initDone) Init();
514 if (column < 0 || column >= infos.size()) return -1;
515 TOIKind kind = infos[column].kind;
516 if (auxGPS &&
517 (kind == longitude || kind == latitude || kind == altitude || kind == tsid)) {
518 double lat,lon,alt;
519 if (auxGPS->getLocation(getMJD(), lat, lon, alt)) return -99999;
520 if (kind == longitude) return lon;
521 if (kind == latitude) return lat;
522 if (kind == altitude) return alt;
523 if (kind == tsid) {
524 tSid.setLongitude(lon);
525 return tSid.getLST(getMJD());
526 }
527 }
528 if (rawIter) {
529 if (infos[column].interpolated)
530 return interp[column].getIValue(lastSample);
531 else
532 return interp[column].getEValue(lastSample);
533 }
534 int index = infos[column].index;
535 switch (kind) {
536 case sampleNum:
537 return getSampleIndex();
538 case internalTime:
539 return getSampleIndex() * archParam.acq.perEch;
540 case mjd:
541 return getMJD();
542 case boloTens:
543 return file->getMuVBolo(index, imes);
544 case boloTens2:
545 return file->getMuVBolo2(index, imes);
546 case boloRaw:
547 return file->getRawBolo(index, imes);
548 case boloRawCN:
549 return file->getRawBoloCN(index, imes);
550 case boloTensCN:
551 return file->getMuVBoloCN(index, imes);
552 case boloGainAmpli:
553 return file->getGainAmpli(index);
554 case boloDACV:
555 return file->getDACV(index);
556 case boloDACI:
557 return file->getDACI(index);
558 case boloTens2T:
559 return file->getMuVBolo2T(index, imes);
560 case boloRes:
561 return file->getBoloRes(index, imes);
562 case dilDAC:
563 return file->getADCDil(index);
564 case dilSwitch:
565 return file->getSwitchDil();
566 case sstDiode:
567 return file->getSSTSignal(index, imes);
568 case sstChannel:
569 return file->getSSTRawSignal(index, imes);
570 case sstDiodeCN:
571 return file->getSSTSignalCN(index, imes);
572 case sstChannelCN:
573 return file->getSSTRawSignalCN(index, imes);
574 case sstStarCnt:
575 return file->getNumbStar(imes);
576 case sstStarZ:
577 return file->getSSTStarZ(index, imes);
578 case sstStarF:
579 return file->getSSTStarF(index, imes);
580 case sstStarT:
581 return file->getSSTStarT(index, imes);
582 case gyroRaw:
583 return file->getGyroRaw(index, imes);
584 case gyroTens:
585 return file->getGyroTens(index, imes);
586 case gyroSpeed:
587 return file->getGyroSpeed(index, imes);
588 case gpsTime:
589 return file->getGPSUTC();
590 case longitude:
591 return file->getGPSLong();
592 case latitude:
593 return file->getGPSLat();
594 case altitude:
595 return file->getGPSAlt();
596 case tsid:
597 tSid.setLongitude(file->getGPSLong());
598 return tSid.getLST(getMJD());
599 case azimutBolo:
600 case alphaAxis:
601 case deltaAxis:
602 case alphaBolo:
603 case deltaBolo: {
604 double lat, lon;
605 if (auxGPS) {
606 double alti;
607 auxGPS->getLocation(getMJD(), lat, lon, alti);
608 } else {
609 lon = file->getGPSLong();
610 lat = file->getGPSLat();
611 }
612 tSid.setLongitude(lon);
613 double ts = tSid.getLST(getMJD());
614 tempLocator.setEarthPos(lon, lat);
615 tempLocator.setTSid(ts);
616 if ((kind) == alphaAxis) return tempLocator.getAlphaZenith();
617 if ((kind) == deltaAxis) return tempLocator.getDeltaZenith();
618 if ((kind) == azimutBolo) return tempLocator.getAzimutBolo(getSampleIndex(),index);
619 if ((kind) == alphaBolo) return tempLocator.getAlphaBolo(getSampleIndex(),index);
620 if ((kind) == deltaBolo) return tempLocator.getDeltaBolo(getSampleIndex(),index);
621 return 0;
622 }
623 }
624 return -1;
625}
626
627bool TOIIter::newValue(int column) {
628 if (!initDone) Init();
629 if (column < 0 || column >= infos.size()) return false;
630 TOIKind kind = infos[column].kind;
631 if (auxGPS &&
632 (kind == longitude || kind == latitude || kind == altitude)) {
633 return true;
634 }
635 if (rawIter) {
636 return interp[column].isNewValue(lastSample);
637 }
638 switch (kind) {
639 case sampleNum:
640 case internalTime:
641 case mjd:
642 case tsid:
643 return true;
644 case boloTens:
645 case boloTens2:
646 case boloTens2T:
647 case boloRes:
648 return file->blockNum() == file->getBoloBlockNum();
649 case boloRaw:
650 case boloRawCN:
651 case boloTensCN:
652 return file->blockNum() == file->getBoloBlockNum();
653 case boloGainAmpli:
654 return file->blockNum() == file->getReglageBlockNum() && imes==0;
655 case boloDACI:
656 case boloDACV:
657 return file->blockNum() == file->getReglageBlockNum() && imes==0;
658 case dilDAC:
659 case dilSwitch:
660 return file->blockNum() == file->getDilutionBlockNum() && imes==0;
661 case sstChannel:
662 case sstDiode:
663 case sstStarCnt:
664 case sstStarZ:
665 case sstStarF:
666 case sstStarT:
667 return file->blockNum() == file->getSSTBlockNum();
668 case sstChannelCN:
669 case sstDiodeCN:
670 return file->blockNum() == file->getSSTCompBlockNum();
671 case gyroRaw:
672 case gyroTens:
673 case gyroSpeed:
674 return file->blockNum() == file->getGyroBlockNum();
675 case gpsTime:
676 return file->blockNum() == file->getGPSBlockNum() && imes==0;
677 case longitude:
678 return file->blockNum() == file->getGPSBlockNum() && imes==0;
679 case latitude:
680 return file->blockNum() == file->getGPSBlockNum() && imes==0;
681 case altitude:
682 return file->blockNum() == file->getGPSBlockNum() && imes==0;
683 case azimutBolo:
684 case alphaBolo:
685 case deltaBolo:
686 return true; // $CHECK$ with SSTHandler
687 case alphaAxis:
688 return true; // $CHECK$ with SSTHandler
689 case deltaAxis:
690 return true; // $CHECK$ with SSTHandler
691 }
692 return false;
693}
694
695bool TOIIter::extendValue(int column) {
696 return (!infos[column].interpolated && !newValue(column));
697}
698
699bool TOIIter::interpValue(int column) {
700 return (infos[column].interpolated && !newValue(column));
701}
702
703bool TOIIter::isTrig(int column) {
704 if (column < 0 || column >= infos.size()) return false;
705 return infos[column].triggering;
706}
707
708
709TOIKind TOIIter::getKind(int column) {
710 if (column < 0 || column >= infos.size()) return (TOIKind)-1;
711 return infos[column].kind;
712}
713
714int TOIIter::getIndex(int column) {
715 if (column < 0 || column >= infos.size()) return (TOIKind)-1;
716 return infos[column].index;
717}
718
719int TOIIter::getColTOI(TOIKind kind, int index) {
720 for (int i=0; i<infos.size(); i++)
721 if (infos[i].kind == kind && infos[i].index == index)
722 return i;
723 return -1;
724}
725
726bool TOIIter::canGetTOI(TOIKind kind, int index) {
727 int col = getColTOI(kind, index);
728 if (col<0) return false;
729 return canGetValue(col);
730}
731
732double TOIIter::getTOI(TOIKind kind, int index) {
733 int col = getColTOI(kind, index);
734 if (col<0) return -9.e99;
735 return getValue(col);
736}
737
738
739int TOIIter::getBlockSampleIndex() {
740 return imes;
741}
742
743int TOIIter::getUnderSampling() {
744 return underSample;
745}
746
747int TOIIter::getSampleIndex() {
748 if (!initDone) Init();
749 if (file) {
750 return file->blockNum() * file->nEchBlock() + imes;
751 } else {
752 return lastSample;
753 }
754}
755
756double TOIIter::getMJD() {
757 if (!initDone) Init();
758 int sample = getSampleIndex();
759 return archParam.acq.tBlock0 + sample*archParam.acq.perEch/86400.;
760}
761
762bool TOIIter::fetchAhead() { // Seulement si delegation
763 if (!rawIter) return false;
764 if (!rawIter->Next()) return false;
765 long sample = rawIter->getSampleIndex();
766 for (int i=0; i<infos.size(); i++) {
767 if (rawIter->canGetValue(i) && rawIter->newValue(i)) {
768 interp[i].enterValue(rawIter->getValue(i), sample);
769 }
770 }
771 return true;
772}
773
774block_type_param* TOIIter::lastParam() {
775 if (!initDone) Init();
776 if (file) return file->lastParam();
777 else return rawIter->lastParam();
778}
779
780
Note: See TracBrowser for help on using the repository browser.