Changeset 4012 in Sophya for trunk/AddOn/TAcq
- Timestamp:
- Aug 2, 2011, 7:25:02 PM (14 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/acqparam_exemple.d
r4010 r4012 113 113 # Defaut : visicalc 1024 1 1 114 114 visicalc 5000 2 1 115 #### Passage en mode Time Interval 116 # @visitimeint deltatime_in_seconds 117 visitimeint 0.5 115 118 ## Activation de remplissage du DataTable des visibilites 116 119 ## @visidtable -
trunk/AddOn/TAcq/branap.cc
r4004 r4012 17 17 outpath_="./"; 18 18 fgfitsout_=false; 19 nmean_=nmean;20 nbloc_=1;21 19 imin_=imax_=0; 22 20 istep_=1; … … 31 29 prtlevel_=0; 32 30 prtmodulo_=50000; 31 32 nmean_=nmean; 33 fgtimeinterval_=false; 34 timeinterval_=1.; 35 nbloc_=1; 36 33 37 nbcalgrp_=1; 34 38 nthreads_=1; … … 77 81 nmean_=atoi(arg[ka+1]); 78 82 ka+=2; 83 } 84 else if (strcmp(arg[ka],"-tmint")==0) { 85 timeinterval_=atoi(arg[ka+1]); 86 fgtimeinterval_=true; ka+=2; 79 87 } 80 88 else if (strcmp(arg[ka],"-nbloc")==0) { … … 224 232 << " -fitsout : Force FITS format for output files \n" 225 233 << " -nmean NMean: Number of packet used for spectra/visibility computation \n" 234 << " -tmint dtime: Time interval definition (instead of nmean) for spectra/visibility computation \n" 226 235 << " -nbloc NBloc: Number of MemMgr blocs in output file\n" 227 236 << " -zones NZones,NbPaqinZone : Number of Zones and number of paquets in one zone (RAcqMemZoneMgr) \n" … … 287 296 cout << " OutPath= " << outpath_ << (fgfitsout_?" force FITS output":" PPF output") << endl; 288 297 cout << " Action=" << action_ << " NMean=" << nmean_ << " NBloc=" << nbloc_ << endl; 298 cout << ((fgtimeinterval_)?" Time Interval mode for visi/spectra ":" NPaq Interval mode") 299 << " TimeInterval=" << timeinterval_ << " seconds " << endl; 289 300 cout << " FreqMin= " << freqmin_ << " FreqMax= " << freqmax_ << " NBinFreq= " << nbinfreq_ << endl; 290 301 if (fgdtpaq_) cout<< " Fill Per Paquet DadaTable "; -
trunk/AddOn/TAcq/branap.h
r3993 r4012 34 34 string outpath_; 35 35 bool fgfitsout_; // true -> force fichier sortie format FITS (defaut PPF) 36 uint_4 nmean_; 37 uint_4 nbloc_; 38 uint_4 imin_, imax_, istep_; 36 uint_4 imin_, imax_, istep_; 39 37 bool rdsamefc_; // read paquets with same frame counter 40 38 uint_4 freqmin_, freqmax_, nbinfreq_; … … 49 47 long int prtmodulo_; 50 48 49 uint_4 nmean_; 50 // definition intervalle de temps (au lieu du nombre de paquet pour spectres moyennes/visibilites 51 bool fgtimeinterval_; // true : calcul visibilites/spectres moyens par intervalle de temps (au lieu de nmean) 52 double timeinterval_; // definition de l'intervalle de temps en secondes pour spectres moyens/visibilites 53 uint_4 nbloc_; 54 51 55 uint_4 nbcalgrp_; // Nb d'objets/threads dans BRVisCalcGroup 52 56 uint_4 nthreads_; // Nb de threads pour l'execution parallele ds BRVisibilityCalculator -
trunk/AddOn/TAcq/brparam.cc
r4010 r4012 204 204 fgdoVisiC=false; 205 205 nmeanVisiC=1024; 206 fgtimeintervalVisiC=false; 207 timeintervalVisiC=1.; 206 208 nbcalgrpVisiC=1; 207 209 nthrVisiC=1; … … 290 292 291 293 fgdoVisiC=p.fgdoVisiC; 292 nmeanVisiC=p.nmeanVisiC; 294 nmeanVisiC=p.nmeanVisiC; 295 fgtimeintervalVisiC=p.fgtimeintervalVisiC; 296 timeintervalVisiC=p.timeintervalVisiC; 293 297 nbcalgrpVisiC=p.nbcalgrpVisiC; 294 298 nthrVisiC=p.nthrVisiC; … … 384 388 nbcalgrpVisiC=conf.IParam("visicalc",1,1); 385 389 nthrVisiC=conf.IParam("visicalc",2,1); 390 } 391 if (conf.HasKey("visitimeint")) { 392 fgtimeintervalVisiC=true; 393 timeintervalVisiC=conf.DParam("visitimeint",0,1.); 386 394 } 387 395 if (conf.HasKey("visidtable")) fgfdtVisiC=true; … … 551 559 os << " Visibility calculation, nbCalGrp=" << nbcalgrpVisiC << " NThr/VisCal=" << nthrVisiC 552 560 << ((fgfdtVisiC)?" Fill_VisiDTable":" ") << endl; 561 if (fgtimeintervalVisiC) os << " ... VisiCalc TimeIntervalMode : " << timeintervalVisiC << " seconds " << endl; 562 else os << " ... VisiCalc NPaq=" << nmeanVisiC << " IntervalMode " << endl; 553 563 os << " ... VisiCalc FirstPair= " << firstpairVisiC << " NbPairs= " << nbpairsVisiC 554 564 << ((fgpimpVisiC)?" (Odd-Even visibilities+AutoCorrel only) ":"") << endl; -
trunk/AddOn/TAcq/brparam.h
r4010 r4012 206 206 bool fgdoVisiC; // true -> calcul des visibilites 207 207 uint_4 nmeanVisiC; // nombre de paquets moyennes pour les calculs de visibilites 208 bool fgtimeintervalVisiC; // true : sauvegarde matrice de visibilites par intervalle de temps 209 double timeintervalVisiC; // definition de l'intervalle de temps en secondes pour suvegarde de la matrice de visibilites 208 210 uint_4 nbcalgrpVisiC; // Nb d'objets/threads dans BRVisCalcGroup 209 211 uint_4 nthrVisiC; // Nb de threads pour l'execution parallele ds BRVisibilityCalculator -
trunk/AddOn/TAcq/brviscalc.cc
r3993 r4012 28 28 BRVisibilityCalculator::BRVisibilityCalculator(RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean, size_t nthr) 29 29 : BRBaseProcessor(memgr), paralex_(*this, nthr), nparthr_(nthr), 30 outpath_(outpath), n mean_(nmean), nbcalc_(1), calcid_(0),30 outpath_(outpath), nbcalc_(1), calcid_(0), 31 31 vpdata_(2*memgr.NbFibres()), vpdatar_(2*memgr.NbFibres()) 32 32 // , dtfos_(outpath+"visdt.fits", Fits_Create), visdt_(dtfos_, 1024, true); 33 33 { 34 34 SetFFTData(); 35 SetNPaqIntervalMode(nmean); 35 36 DefineRank(1,0); 36 37 SetPPFOutput(); 38 39 npaqcumul_=0; 40 moyfc_=moytt_=0.; 41 first_fc_=first_tt_=0; 37 42 38 43 uint_4 maxnpairs = (2*memgr_.NbFibres()+1)*memgr_.NbFibres(); … … 57 62 if (nmean_ < 1) nmean_=1; 58 63 59 cout << " BRVisibilityCalculator::/Info nmean=" << nmean_ << endl;60 61 64 totnbpaq_=0; 62 65 numfile_=0; 63 66 nb_flop_=0.; 64 moyfc_=moytt_=0.;65 67 66 68 fgallfibok=NULL; … … 272 274 << "]::run() - Starting " << " NFibers=" << memgr_.NbFibres() 273 275 << " NChan=" << 2*memgr_.NbFibres() << " NPairs=" << nbpairs_ << " First:" << pairst_ << endl; 274 276 277 if (fgnpaq_time) 278 cout << " BRVisibilityCalculator::run()/Info NPaq=" << nmean_ << " Interval mode for visibility mtrix save" << endl; 279 else 280 cout << " BRVisibilityCalculator::run()/Info Time Tnterval (dt=" << dtimemean_ << ") for visibility mtrix save" << endl; 281 275 282 if (nparthr_ < 2) return BRBaseProcessor::run(); 276 283 // Execution multithread parallele … … 324 331 } 325 332 326 if (totnbpaq_%nmean_ == 0) { 327 if (totnbpaq_ > 0) { 328 moyfc_/=nmean_; 329 moytt_/=nmean_; 330 UpdateVisMtxInfo(); // add/update keywords in the Info DVList 331 // ATTENTION : Matrice visibilites non moyennee 332 char nfile[48]; 333 if (nbcalc_==1) 334 sprintf(nfile,"vismtx%d.%s",numfile_,OutFileExtension()); 335 else 336 sprintf(nfile,"vismtx_%d_%d.%s",(int)calcid_,numfile_,OutFileExtension()); 337 string flnm=outpath_+nfile; 338 if (fgfitsout_) { // Ecriture au format FITS 339 FitsInOutFile fo(flnm, FitsInOutFile::Fits_Create); 340 TArray<r_4> arvismtx = ArrCastC2R(vismtx_); 341 arvismtx.Info()=vismtx_.Info(); 342 fo << arvismtx; 343 } 344 else { // Format PPF 345 POutPersist po(flnm); 346 po << vismtx_; 347 } 348 if ((prtlev_>0)&&(numfile_%prtmodulo_==0)) { 349 cout << numfile_ << "-BRVisCalc[" << calcid_ << "/" << nbcalc_ << "]::run() NPaqProc=" 350 << totnbpaq_ << " TotMegaFLOP=" << (uint_8)TotNbMegaFLOP() << " -> VisibMtx in " << flnm << endl; 351 } 352 if (fgvisdt_) FillVisibTable(moyfc_, moytt_); 353 numfile_++; 354 } 355 vismtx_ = complex<r_4>((r_4)0.,(r_4)0.); 356 moyfc_=moytt_=0.; 357 // first_tmstamp_.SetNow(); // Current date and time 358 first_tmstamp_=cts_; // Current date and time 333 if ( CheckInterval4VisMtxSave() ) { 334 if ((prtlev_>0)&&(numfile_%prtmodulo_==0)) { 335 cout << numfile_ << "-BRVisCalc[" << calcid_ << "/" << nbcalc_ << "]::run() NPaqProc=" 336 << totnbpaq_ << " TotMegaFLOP=" << (uint_8)TotNbMegaFLOP() << " -> VisibMtx FileNum=" << numfile_ << endl; 337 } 338 SaveVisibilityMatrix(); 359 339 } 360 340 … … 378 358 moytt_ += (vpaq_[0].TimeTag()-ttfirst_[0]); 379 359 if ((fgcktt_)&&(calcid_==0)) CheckTimeTag(); 380 if ( totnbpaq_%nmean_ ==0) {360 if (npaqcumul_==0) { 381 361 first_fc_=curfc_[0]; 382 first_tt_= (vpaq_[0].TimeTag()-ttfirst_[0]);362 first_tt_= vpaq_[0].TimeTag(); 383 363 } 364 npaqcumul_++; 384 365 totnbpaq_++; 385 366 } … … 431 412 } 432 413 433 if (totnbpaq_%nmean_ == 0) { 434 if (totnbpaq_ > 0) { 435 moyfc_/=nmean_; 436 moytt_/=nmean_; 437 UpdateVisMtxInfo(); // add/update keywords in the Info DVList 438 // ATTENTION : Matrice visibilites non moyennee 439 char nfile[48]; 440 if (nbcalc_==1) 441 sprintf(nfile,"vismtx%d.%s",numfile_,OutFileExtension()); 442 else 443 sprintf(nfile,"vismtx_%d_%d.%s",(int)calcid_,numfile_,OutFileExtension()); 444 string flnm=outpath_+nfile; 445 if (fgfitsout_) { // Ecriture au format FITS 446 FitsInOutFile fo(flnm, FitsInOutFile::Fits_Create); 447 TArray<r_4> arvismtx = ArrCastC2R(vismtx_); 448 arvismtx.Info()=vismtx_.Info(); 449 fo << arvismtx; 450 } 451 else { // Format PPF 452 POutPersist po(flnm); 453 po << vismtx_; 454 } 455 if ((prtlev_>0)&&(numfile_%prtmodulo_==0)) { 456 cout << numfile_ << "-BRVisCalc[" << calcid_ << "/" << nbcalc_ << "]::Process() NPaqProc=" 457 << totnbpaq_ << " TotMegaFLOP=" << (uint_8)TotNbMegaFLOP() << " -> VisibMtx in " << flnm << endl; 458 } 459 if (fgvisdt_) FillVisibTable(moyfc_, moytt_); 460 numfile_++; 461 } 462 vismtx_ = complex<r_4>((r_4)0.,(r_4)0.); 463 moyfc_=moytt_=0.; 464 first_fc_=curfc_[0]; 465 first_tt_= (vpaq_[0].TimeTag()-ttfirst_[0]); 466 // first_tmstamp_.SetNow(); // Current date and time 467 first_tmstamp_=cts_; // Current date and time 414 if ( CheckInterval4VisMtxSave() ) { 415 if ((prtlev_>0)&&(numfile_%prtmodulo_==0)) { 416 cout << numfile_ << "-BRVisCalc[" << calcid_ << "/" << nbcalc_ << "]::Process() NPaqProc=" 417 << totnbpaq_ << " TotMegaFLOP=" << (uint_8)TotNbMegaFLOP() << " -> VisibMtx FileNum= " << numfile_ << endl; 418 } 419 SaveVisibilityMatrix(); 468 420 } 469 421 … … 494 446 } 495 447 448 npaqcumul_++; 496 449 moyfc_ += curfc_[0]; 497 450 moytt_ += (vpaq_[0].TimeTag()-ttfirst_[0]); … … 499 452 totnbpaq_++; 500 453 return 0; 454 } 455 /* --Methode-- */ 456 void BRVisibilityCalculator::SaveVisibilityMatrix() 457 { 458 if (totnbpaq_ > 0) { 459 moyfc_/=npaqcumul_; 460 moytt_/=npaqcumul_; 461 UpdateVisMtxInfo(); // add/update keywords in the Info DVList 462 // ATTENTION : Matrice visibilites non moyennee 463 char nfile[48]; 464 if (nbcalc_==1) 465 sprintf(nfile,"vismtx%d.%s",numfile_,OutFileExtension()); 466 else 467 sprintf(nfile,"vismtx_%d_%d.%s",(int)calcid_,numfile_,OutFileExtension()); 468 string flnm=outpath_+nfile; 469 if (fgfitsout_) { // Ecriture au format FITS 470 FitsInOutFile fo(flnm, FitsInOutFile::Fits_Create); 471 TArray<r_4> arvismtx = ArrCastC2R(vismtx_); 472 arvismtx.Info()=vismtx_.Info(); 473 fo << arvismtx; 474 } 475 else { // Format PPF 476 POutPersist po(flnm); 477 po << vismtx_; 478 } 479 if (fgvisdt_) FillVisibTable(moyfc_, moytt_); 480 numfile_++; 481 } 482 vismtx_ = complex<r_4>((r_4)0.,(r_4)0.); 483 npaqcumul_=0; 484 moyfc_=moytt_=0.; 485 first_fc_=curfc_[0]; 486 first_tt_=vpaq_[0].TimeTag(); 487 // first_tmstamp_.SetNow(); // Current date and time 488 first_tmstamp_=cts_; // Current date and time 489 490 return; 501 491 } 502 492 … … 512 502 vismtx_.Info().SetComment(ikey,ikdesc); 513 503 ikey="FirstTT"; ikdesc="First TimeTag"; 514 vismtx_.Info().SetI(ikey, first_tt_);504 vismtx_.Info().SetI(ikey,(first_tt_-ttfirst_[0])); 515 505 vismtx_.Info().SetComment(ikey,ikdesc); 516 506 ikey="LastFC"; ikdesc="Last FrameCounter"; … … 527 517 vismtx_.Info().SetComment(ikey,ikdesc); 528 518 ikey="NPAQSUM"; ikdesc="Number of paquets summed"; 529 vismtx_.Info().SetI(ikey,n mean_);519 vismtx_.Info().SetI(ikey,npaqcumul_); 530 520 } 531 521 … … 752 742 } 753 743 /* --Methode-- */ 744 void BRVisCalcGroup::SetNPaqIntervalMode(uint_4 nmean) 745 { 746 for(size_t i=0; i<viscalcp_.size(); i++) 747 viscalcp_[i]->SetNPaqIntervalMode(nmean); 748 } 749 /* --Methode-- */ 750 void BRVisCalcGroup::SetTimeIntervalMode(double dtime) 751 { 752 for(size_t i=0; i<viscalcp_.size(); i++) 753 viscalcp_[i]->SetTimeIntervalMode(dtime); 754 } 755 /* --Methode-- */ 754 756 void BRVisCalcGroup::SetPrintLevel(int lev, uint_8 prtmodulo) 755 757 { -
trunk/AddOn/TAcq/brviscalc.h
r3967 r4012 67 67 // Pour ecrire les fichiers de sortie au format PPF (defaut) 68 68 inline void SetPPFOutput() { fgfitsout_=false; } 69 // Pour passer en mode nombre de paquet pour sauvegarde matrices visibilites (defaut) 70 inline void SetNPaqIntervalMode(uint_4 nmean=1000) 71 { fgnpaq_time=true; nmean_=(nmean>0)?nmean:1000; } 72 // Pour passer en mode intervalle en temps pour sauvegarde matrices visibilites - intervalle de temps en secondes 73 inline void SetTimeIntervalMode(double dtime=1.) 74 { fgnpaq_time=false; dtimemean_=(dtime>1e-6)?dtime:1.; } 69 75 70 76 // Methode d'execution standard du thread (on redefinit la methode de BRBaseProcessor) … … 84 90 virtual void UpdateChanIds(); 85 91 virtual int Process(); 92 virtual void SaveVisibilityMatrix(); 86 93 virtual void UpdateVisMtxInfo(); 87 94 virtual int FillVisibTable(double fcm, double ttm); 95 inline bool CheckInterval4Save(); 88 96 virtual int CheckTimeTag(); 89 97 inline const char* OutFileExtension() { return ((fgfitsout_)?"fits":"ppf"); } 98 // return true if npaq or time interval elasped to save visibility matrix 99 inline bool CheckInterval4VisMtxSave() 100 { 101 if (npaqcumul_<1) return false; 102 if (fgnpaq_time) 103 return ((npaqcumul_>=nmean_)?true:false); 104 else { 105 return (((vpaq_[0].TimeTag()-first_tt_)/1.25e8>=dtimemean_)?true:false); 106 } 107 } 90 108 91 109 ParallelExecutor paralex_; // Pour l'execution en parallele … … 93 111 94 112 bool fgdataraw_; // true -> donnees provenant du firmware RAW 95 uint_4 nmean_; // Nombre de spectres pour le calcul des moyennes96 113 string outpath_; // directory pour fichiers de sortie 97 114 uint_4 nbcalc_, calcid_; // Nombre total de threads/objets BRVisibilityCalculator parallèles, l'identificateur de l'objet 98 115 116 // Definition du mode (type d'intervalle) pour calcul des moyennes 117 uint_4 nmean_; // Nombre de spectres pour le calcul des moyennes 118 double dtimemean_; // Intervalle en temps pour le calcul des moyennes - exprimes en secondes 119 bool fgnpaq_time; // true -> utilisation nmean_ comme nb de paquet/spectre, false -> dtimemean_ 120 99 121 uint_4 pairst_, nbpairs_; // Numero de la premiere paire, nombre de paires ( 1 paire= 1 visibilites) 100 122 bool fgpimp_; // true -> calculer uniquement visibilities avec no voie pair-impair … … 107 129 bool* fgallfibok; 108 130 131 uint_8 npaqcumul_; // Nb de paquets cumules/moyennes ds la matrice de visibilite 109 132 double moyfc_, moytt_; // moyenne des FrameCounter / TimeTag pour chaque matrice de visibilite 110 133 uint_8 first_fc_,first_tt_; // Valeurs premier FrameCounter / TimeTag pour chaque matrice de visibilite … … 167 190 // configuration avec donnees firmware RAW 168 191 void SetRawData(); 192 // Pour passer en mode nombre de paquet pour sauvegarde matrices visibilites (defaut) 193 void SetNPaqIntervalMode(uint_4 nmean=1000); 194 // Pour passer en mode intervalle en temps pour sauvegarde matrices visibilites 195 void SetTimeIntervalMode(double dtime=1.); 169 196 170 197 void SetPrintLevel(int lev=0, uint_8 prtmodulo=10); -
trunk/AddOn/TAcq/mfacq.cc
r4010 r4012 432 432 VCGThr.SetPrintLevel(acpar.prtlevel_, acpar.prtmodulo2_); 433 433 if (acpar.fgfitsVisiC) VCGThr.SetFitsOutput(); 434 if (acpar.fgtimeintervalVisiC) VCGThr.SetTimeIntervalMode(acpar.timeintervalVisiC); 434 435 435 436 cout << "mfacq[3] Creating EthernetReader thread object " << endl; -
trunk/AddOn/TAcq/vismfib.cc
r3967 r4012 76 76 if (par.action_ == "viscktt") procg.ActivateTimeTagCheck(par.TotalNPaquets()); 77 77 if (par.fgfitsout_) procg.SetFitsOutput(); 78 78 if (par.fgtimeinterval_) procg.SetTimeIntervalMode(par.timeinterval_); 79 79 BRFFTCalculator procfft(mmgr, par.fgsinglechannel_); 80 80
Note:
See TracChangeset
for help on using the changeset viewer.