Changeset 3992 in Sophya for trunk/AddOn/TAcq/brprocGain.cc


Ignore:
Timestamp:
May 11, 2011, 4:13:03 PM (14 years ago)
Author:
campagne
Message:

halfmedwith poru le filtrage des freq. TIMWIN pour tagger les fenetres des paquets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/brprocGain.cc

    r3953 r3992  
    4141BRGainCalculator::BRGainCalculator(RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean,
    4242                                           bool fgdatafft, bool fgsinglechan)
    43   : BRMeanSpecCalculator(memgr,outpath,nmean,fgdatafft,fgsinglechan), forceMedianFreqFilter_(false),nbwin4mean_(nmean)
     43  : BRMeanSpecCalculator(memgr,outpath,nmean,fgdatafft,fgsinglechan), forceMedianFreqFilter_(false), medianFilterHalfWidth_(50), nbwin4mean_(nmean)
    4444{
    4545
     
    7070  nummedianfile_ = 0;
    7171  nbtot_specwin_ = 0;
     72  windowTime_ = TimeStamp(); //default
    7273
    7374}
     
    8889{
    8990
    90 //   cout << "(JEC): BRGainCalculator ProcSpecWin: "<<   nbtot_specwin_
    91 //        << " nbwin4mean = " << nbwin4mean_
    92 //        << endl;
    93  
    94   //  cout<< "(Spec_window info) Start" << endl;
    95   //spec_window_.Show();
    96   //cout<< "(Spec_window info) End" << endl;
     91  //   cout << "(JEC): BRGainCalculator ProcSpecWin: "<<   nbtot_specwin_
     92  //        << endl;
     93 
     94
    9795
    9896  //JEC 13/12/10 save the filtered spectra
    9997  if ( (nbtot_specwin_>0)&&(nbtot_specwin_%nbwin4mean_==0) ) SaveMedianSpectra();
    10098
    101 
     99  // Get time of window
     100  windowTime_ = getObsTime();
     101
     102 if (prtlev_>1)  {
     103      cout << " BRGainCalculator::ProcSpecWin() num_win=" << nbtot_specwin_ << " numpaqstart=" << numpaqstart
     104           << " numpaqend=" << numpaqend  << " nbwin4mean = " << nbwin4mean_ << endl;
     105      cout << " (1) ObsTime=" << windowTime_ << " TimeTag=" << getCurTimeTagSeconds() << " s. FrameCounter="
     106           << getCurFrameCounter() << endl;
     107  } 
    102108  //DBG  cout << "BRGainCalculator::ProcSpecWin()/Debug: numpaqstart=" << numpaqstart
    103109  //DBG     << " numpaqend=" << numpaqend << endl;
     
    124130      //perform a median filter on the frequencies
    125131      TVector<r_4> medianFilterFreq = medfiltspecmtx_.Row(i);
    126       sa_size_t hww = 50; //half freq window for filtering
     132      sa_size_t hww = medianFilterHalfWidth_; //half freq window for filtering
    127133      sa_size_t fMin = 0.;
    128134      sa_size_t fMax = spec_window_.SizeX()-1;
     
    164170       << " nbtot_specwin = " <<  nbtot_specwin_
    165171       << endl;
    166  
    167     for(sa_size_t ir=0; ir< medfiltspecmtx_.NRows(); ir++){
    168       char buff[32];
    169       sprintf(buff,"NPAQSUM_%d",(int)ir);
    170       medfiltspecmtx_.Info()["NPAQSUM"] = nbtot_specwin_;
    171       medfiltspecmtx_.Info()[buff] = nbtot_specwin_;
    172       if ( nbtot_specwin_ > 0) {
    173         medfiltspecmtx_.Row(ir)  /= (r_4)nbtot_specwin_;
    174       }
    175     }//eo loop on channels
    176     char nfile[64];
    177     string flnm;
    178     {
    179       sprintf(nfile,"medfiltmtx%d.fits",nummedianfile_);
    180       flnm="!"+outpath_+nfile;
    181       FitsInOutFile fos(flnm,FitsInOutFile::Fits_Create);
    182       fos << medfiltspecmtx_;
     172  if (prtlev_>1)  {
     173    cout << " BRGainCalculator:SaveMedianSpectra() nbwin4mean = " << nbwin4mean_ << endl
     174         << " (2) ObsTime=" << windowTime_ << " Total Intensity " << 0.5*medfiltspecmtx_.Sum() << endl;
     175  } 
     176 
     177  //JEC compute power spectrum
     178 
     179
     180
     181
     182  for(sa_size_t ir=0; ir< medfiltspecmtx_.NRows(); ir++){
     183    char buff[32];
     184    sprintf(buff,"NPAQSUM_%d",(int)ir);
     185    medfiltspecmtx_.Info()["NPAQSUM"] = nbtot_specwin_;
     186    medfiltspecmtx_.Info()[buff] = nbtot_specwin_;
     187    //JEC timeStamp in the day @ millisec: faudra gerer le passage a minuit!
     188    medfiltspecmtx_.Info()["TIMEWIN"] = (windowTime_.SecondsPart())*1000.;
     189
     190
     191    if ( nbtot_specwin_ > 0) {
     192      medfiltspecmtx_.Row(ir)  /= (r_4)nbtot_specwin_;
    183193    }
     194  }//eo loop on channels
     195  char nfile[64];
     196  string flnm;
     197  {
     198    sprintf(nfile,"medfiltmtx%d.fits",nummedianfile_);
     199    flnm="!"+outpath_+nfile;
     200    FitsInOutFile fos(flnm,FitsInOutFile::Fits_Create);
     201    fos << medfiltspecmtx_;
    184202    cout << nummedianfile_ << "-BRGainCalculator::ProcSpecWin() save filtered spectra matrix in "
    185203         << flnm << endl;
    186 
    187     //increment the file index
    188     nummedianfile_++;
     204  }
     205 
     206  //increment the file index
     207  nummedianfile_++;
    189208   
    190     //reset the matirx
    191     medfiltspecmtx_ = (r_4)(0.);
    192 
    193     //reset counter
    194     nbtot_specwin_ = 0;
    195 
    196     return;
     209  //reset the matirx
     210  medfiltspecmtx_ = (r_4)(0.);
     211
     212  //reset counter
     213  nbtot_specwin_ = 0;
     214
     215  return;
    197216}
    198217//JEC 13/12/10 End
Note: See TracChangeset for help on using the changeset viewer.