Changeset 3979 in Sophya for trunk/AddOn
- Timestamp:
- May 4, 2011, 9:18:09 AM (14 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/branap.cc
r3967 r3979 45 45 46 46 gainfile_=""; 47 48 proctimeduration_=9.e9; 49 fgtimeselect_=false; 47 50 } 48 51 … … 137 140 ka++; 138 141 } 142 //-tmproc hh:mm:ss,nseconds 143 else if (strcmp(arg[ka],"-tmproc")==0) { 144 int ah=0,am=0; 145 double as=0, als=0; 146 sscanf(arg[ka+1],"%d:%d:%lg,%lg",&ah,&am,&as,&als); 147 fgtimeselect_=true; proctimeduration_=als; 148 proctimestart_.SetHour(ah,am,as); 149 ka+=2; 150 } 139 151 else if (strcmp(arg[ka],"-gain")==0) { 140 152 gainfile_=arg[ka+1]; … … 190 202 << " [-singlechan] [-twochan] [-fftdata] [-rawdata] \n" 191 203 << " [-freqfilter] [-gain filename] [-varcut min,max] [-nband nband,first,last] \n" 192 << " [- filldt] [-tspwin wsz,extsz,nfiles] \n"204 << " [-tmproc hh:mm:ss,nseconds] [-filldt] [-tspwin wsz,extsz,nfiles] \n" 193 205 << " -in Imin,Imax,Istep InPath FiberList [InPath2 FiberList2 InPath3 FiberList3 ...] \n" << endl; 194 206 if (fgshort) { … … 218 230 << " -varcut min,max : min-max cut on variance \n" 219 231 << " -nband nband,first,last: numbers of freq. bands and first and last bands used for cuts \n" 232 << " -tmproc hh:mm:ss,nseconds : processing time window definition \n" 220 233 << " -filldt : force data table filling \n" 221 234 << " -freqfilter : force median filtering on the frequencies \n" … … 238 251 bool fgdatafft_in_fits=false; 239 252 bool fgsinglechan_in_fits=false; 240 int rc = DecodeMiniFitsHeader(flnm,paqsize_, npaqinfile_,fgdatafft_in_fits, fgsinglechan_in_fits); 253 SOPHYA::TimeStamp tmstart; 254 int rc = DecodeMiniFitsHeader(flnm,paqsize_, npaqinfile_,fgdatafft_in_fits, fgsinglechan_in_fits,tmstart); 241 255 if (!fgforcesingleortwochan_) fgsinglechannel_=fgsinglechan_in_fits; 242 256 if (!fgforceraworfft_) fgdatafft_=fgdatafft_in_fits; 257 if (fgtimeselect_) { 258 int year,month,day; 259 tmstart.GetDate(year,month,day); 260 proctimestart_.SetDate(year,month,day); 261 proctimeend_.Set(proctimestart_.ToDays()+proctimeduration_/86400.); 262 } 243 263 return rc; 244 264 } … … 252 272 cout << " IMin= " << imin_ << " IMax= " << imax_ << " IStep= " << istep_ 253 273 << ((rdsamefc_)?" SameFrameCounter read mode":" AllOKPaquets read mode ") << endl; 274 if (fgtimeselect_) { 275 cout << " Processing time window, StartTime=" << proctimestart_ << " duration= " << proctimeduration_ 276 << " EndTime=" << proctimeend_ << endl; 277 } 254 278 cout << " OutPath= " << outpath_ << (fgfitsout_?" force FITS output":" PPF output") << endl; 255 279 cout << " Action=" << action_ << " NMean=" << nmean_ << " NBloc=" << nbloc_ << endl; … … 274 298 /* --Fonction-- */ 275 299 int BRAnaParam::DecodeMiniFitsHeader(const char* filename, uint_4& paqsz, uint_4& npaq, 276 bool& fgdatafft, bool& fgsinglechannel )300 bool& fgdatafft, bool& fgsinglechannel, SOPHYA::TimeStamp& tmstart) 277 301 { 278 302 cout << " DecodeMiniFitsHeader - Opening file: " << filename << endl; … … 285 309 if (acqmode.substr(0,3)=="fft") fgdatafft=true; 286 310 if (acqmode.find("1c") < acqmode.length()) fgsinglechannel=true; 311 string fkvs=mff.GetKeyValue("DATEOBS"); 312 if (fkvs.length()>0) tmstart.Set(fkvs); 313 fkvs=mff.GetKeyValue("TMSTART"); 314 if (fkvs.length()>0) tmstart.Set(fkvs); 287 315 return 0; 288 316 } -
trunk/AddOn/TAcq/branap.h
r3967 r3979 13 13 #include <iostream> 14 14 15 #include "timestamp.h" 16 15 17 class BRAnaParam { 16 18 public: … … 26 28 27 29 static int DecodeMiniFitsHeader(const char* filename, uint_4& paqsz, uint_4& npaq, 28 bool& fgdatafft, bool& fgsinglechannel );30 bool& fgdatafft, bool& fgsinglechannel, SOPHYA::TimeStamp& tmstart); 29 31 30 32 vector<string> dirlist_; … … 61 63 62 64 string gainfile_; // nom du fichier de gain (reponse spectrale) 65 66 // definition fenetre en temps pour le traitement des paquets 67 SOPHYA::TimeStamp proctimestart_; // temps de debut de la fenetre 68 SOPHYA::TimeStamp proctimeend_; // temps de debut de la fenetre 69 double proctimeduration_; // duree en secondes de la fenetre 70 bool fgtimeselect_; // vrai -> selection des paquets dans la fenetre en temps 63 71 }; 64 72 -
trunk/AddOn/TAcq/brbaseproc.cc
r3955 r3979 96 96 cout << "BRBaseProcessor[" << bpnom_ << "," << bpid_ << "]::run() - Starting " << " NFibers=" 97 97 << memgr_.NbFibres() << endl; 98 if (fgproctimewin_) cout << " BRBaseProcessor...TimeWindow Start=" << tmstart_ << " End=" << tmend_ << endl; 98 99 99 100 size_t paqsz=memgr_.PaqSize(); 100 101 size_t procpaqsz=memgr_.ProcPaqSize(); 102 103 double tstartdays = tmstart_.ToDays(); 104 double tenddays = tmend_.ToDays(); 105 101 106 bool fgrun=true; 102 107 while (fgrun) { 103 108 if (stop_) break; 104 109 if (memgr_.GetRunState() == MemZR_Stopped) break; 105 int mid= memgr_.FindMemZoneId(mmact_); // (MemZA_ProcA);106 // Byte* buffg = memgr_.GetMemZone(mid );110 mid_ = memgr_.FindMemZoneId(mmact_); // (MemZA_ProcA); 111 // Byte* buffg = memgr_.GetMemZone(mid_); 107 112 // if (buffg == NULL) { 108 if (mid < 0) {113 if (mid_ < 0) { 109 114 cout << "BRBaseProcessor[" << bpnom_ << "," << bpid_ << "]::run()/ERROR FindMemZoneId(" 110 << (int)mmact_ << ") ->" << mid << ") -> NULL" << endl;115 << (int)mmact_ << ") ->" << mid_ << ") -> NULL" << endl; 111 116 setRC(7); fgrun=false; 112 117 break; 113 118 } 114 cts_=memgr_.GetAuxData(mid )->FillTime(); // get associated date/time (DATEOBS)119 cts_=memgr_.GetAuxData(mid_)->FillTime(); // get associated date/time (DATEOBS) 115 120 for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++) { 116 fbuff_[fib] = memgr_.GetMemZone(mid ,fib);121 fbuff_[fib] = memgr_.GetMemZone(mid_,fib); 117 122 if (fbuff_[fib] == NULL) { // cela ne devrait pas arriver 118 123 cout << "BRBaseProcessor[" << bpnom_ << "," << bpid_ << "]::run()/ERROR memgr.GetMemZone(" 119 << mid << "," << fib << ") -> NULL" << endl;124 << mid_ << "," << fib << ") -> NULL" << endl; 120 125 setRC(9); fgrun=false; 121 126 break; 122 127 } 123 if ((procpaqsz>0)&&((fprocbuff_[fib]=memgr_.GetProcMemZone(mid ,fib))==NULL)) { // cela ne devrait pas arriver non plus128 if ((procpaqsz>0)&&((fprocbuff_[fib]=memgr_.GetProcMemZone(mid_,fib))==NULL)) { // cela ne devrait pas arriver non plus 124 129 cout << "BRBaseProcessor[" << bpnom_ << "," << bpid_ << "]::run()/ERROR memgr.GetProcMemZone(" 125 << mid << "," << fib << ") -> NULL" << endl;130 << mid_ << "," << fib << ") -> NULL" << endl; 126 131 setRC(9); fgrun=false; 127 132 break; 128 133 } 129 134 } 130 for(size_t jp=0; jp<memgr_.NbPaquets(); jp++) { // boucle sur les paquets d'une zone 131 fgokallfibers_=true; 132 for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++) { 133 vpaq_[fib].Set(fbuff_[fib]+jp*paqsz); 134 vfgok_[fib]=vpchk_[fib].Check(vpaq_[fib],curfc_[fib]); 135 if (!vfgok_[fib]) fgokallfibers_=false; 136 if (procpaqsz>0) vprocpaq_[fib] = fprocbuff_[fib]+jp*procpaqsz; 137 } 138 //--- Traitement 139 int rcp=0; 140 if (fgokallfibers_) { 141 if (totprocnpaq_==0) { 142 for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++) { 143 fcfirst_[fib]=curfc_[fib]; 144 ttfirst_[fib]=vpaq_[fib].TimeTag(); 135 136 // On ne traite les paquets que si pas de fenetre en temps ou tmstart_ <= FillTime() <= tmend_ 137 double ftmdays = memgr_.GetAuxData(mid_)->FillTime().ToDays(); 138 if ((!fgproctimewin_) || ( (ftmdays<=tenddays)&&(ftmdays>=tstartdays) ) ) { 139 140 for(size_t jp=0; jp<memgr_.NbPaquets(); jp++) { // boucle sur les paquets d'une zone 141 fgokallfibers_=true; 142 for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++) { 143 vpaq_[fib].Set(fbuff_[fib]+jp*paqsz); 144 vfgok_[fib]=vpchk_[fib].Check(vpaq_[fib],curfc_[fib]); 145 if (!vfgok_[fib]) fgokallfibers_=false; 146 if (procpaqsz>0) vprocpaq_[fib] = fprocbuff_[fib]+jp*procpaqsz; 147 } 148 //--- Traitement 149 int rcp=0; 150 if (fgokallfibers_) { 151 if (totprocnpaq_==0) { 152 for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++) { 153 fcfirst_[fib]=curfc_[fib]; 154 ttfirst_[fib]=vpaq_[fib].TimeTag(); 155 } 145 156 } 157 rcp=Process(); 158 totprocnpaq_++; 146 159 } 147 rcp=Process(); 148 totprocnpaq_++; 149 } 150 // if (rcp != 0) { fgrun=false; break; } 151 } // Fin de boucle sur les paquets 152 memgr_.FreeMemZone(mid, mmsta_); // (MemZS_ProcA); 160 // if (rcp != 0) { fgrun=false; break; } 161 } // Fin de boucle sur les paquets 162 } // Fin de test pour fenetre en temps de traitement des paquets 163 164 memgr_.FreeMemZone(mid_, mmsta_); // (MemZS_ProcA); 153 165 } // Fin de boucle sur les zones a traiter 154 166 //------------------------------------ … … 198 210 for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++) 199 211 cout << getCurTimeTagSeconds(fib) << "," ; 212 if (prtlev_<4) return 0; 213 cout << " ... FileSequenceNumber[0..." << memgr_.NbFibres()-1 << "]=" ; 214 for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++) 215 cout << memgr_.GetAuxData(mid_)->FileSequenceNumber(fib) << ","; 200 216 cout << endl; 201 217 } -
trunk/AddOn/TAcq/brbaseproc.h
r3955 r3979 39 39 { bpnom_=nom; bpid_=id; } 40 40 41 // Definition de la fentre en temps des paquets a traiter - par defaut, traitement de tous les paquets 42 // Process() est alors appele pour les paquets des zones MemZoneMgr 43 // avec TimeStart <= getObsTime() <= TimeEnd 44 inline void SetProcTimeWindow(SOPHYA::TimeStamp tmstart, SOPHYA::TimeStamp tmend) 45 { tmstart_=tmstart; tmend_=tmend; fgproctimewin_=true; } 46 // Annulation de la definition de la fenetre de traitement en temps 47 inline void ClearProcTimeWindow() 48 { fgproctimewin_=false; } 49 41 50 // get Observation Time ( obtained from MemZoneMgr ) 42 51 inline SOPHYA::TimeStamp& getObsTime() { return cts_; } … … 65 74 MemZaction mmact_; // Definition de l'action sur les paquets (defaut=MemZA_ProcA) 66 75 MemZStatus mmsta_; // Statut associe a mmact_ (defaut=MemZS_ProcA) 76 int mid_; // Identificateur zone memoire courant 67 77 bool stop_; 68 78 vector<Byte*> fbuff_; // Vecteur de pointeur de zone memoire pour chaque fibre … … 83 93 int bpid_; // numero d'identificateur 84 94 95 SOPHYA::TimeStamp tmstart_, tmend_; // definition de la fenetre en temps pour appel de Process() 96 bool fgproctimewin_; // false -> pas de fenetre en temps, Process() appele pour tous les paquets 97 85 98 int prtlev_; // print level 86 99 uint_8 prtmodulo_; // print periodicity (modulo) -
trunk/AddOn/TAcq/brfitsrd.cc
r3978 r3979 275 275 for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++) 276 276 mmbufib_[fib]=memgr_.GetMemZone(mid_,fib); 277 // Definition temps pour la zone a remplir 277 // Definition temps pour la zone a remplir et numeros de sequence des fichiers en cours de lecture 278 278 memgr_.GetAuxData(mid_)->FillTime().Set(ctmstart_.ToDays()+cpaqdeltatime_*(double)vfpos_[0]/86400.); 279 memgr_.GetAuxData(mid_)->FileSequenceNumVec()=vfilenum_; 279 280 return false; 280 281 } -
trunk/AddOn/TAcq/racqumem.cc
r3958 r3979 39 39 memzones.push_back(new Byte[mzsz] ); 40 40 states.push_back(st); 41 auxdatap.push_back( new RAcqMZAuxData);41 auxdatap.push_back( new RAcqMZAuxData((size_t)NbFibres()) ); 42 42 if (procmzsz > 0) procmemzones.push_back(new Byte[procmzsz] ); 43 43 } -
trunk/AddOn/TAcq/racqumem.h
r3955 r3979 71 71 class RAcqMZAuxData { 72 72 public: 73 RAcqMZAuxData() { } 73 RAcqMZAuxData(size_t nbfib) 74 : fileseqnum_(nbfib) , badseqnum_(-1) { } 74 75 inline SOPHYA::TimeStamp& FillTime() { return filltime_; } 75 76 inline std::vector<uint_4>& FileSequenceNumVec() { return fileseqnum_; } 77 uint_4& FileSequenceNumber(size_t i=0) { 78 if (i<fileseqnum_.size()) return fileseqnum_[i]; 79 else return badseqnum_; 80 } 76 81 SOPHYA::TimeStamp filltime_; 82 std::vector<uint_4> fileseqnum_; 83 uint_4 badseqnum_; 77 84 }; 78 85
Note:
See TracChangeset
for help on using the changeset viewer.