Changeset 4012 in Sophya for trunk/AddOn/TAcq/brviscalc.cc
- Timestamp:
- Aug 2, 2011, 7:25:02 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 {
Note:
See TracChangeset
for help on using the changeset viewer.