Changeset 3992 in Sophya for trunk/AddOn/TAcq/brprocGain.cc
- Timestamp:
- May 11, 2011, 4:13:03 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/brprocGain.cc
r3953 r3992 41 41 BRGainCalculator::BRGainCalculator(RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean, 42 42 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) 44 44 { 45 45 … … 70 70 nummedianfile_ = 0; 71 71 nbtot_specwin_ = 0; 72 windowTime_ = TimeStamp(); //default 72 73 73 74 } … … 88 89 { 89 90 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 97 95 98 96 //JEC 13/12/10 save the filtered spectra 99 97 if ( (nbtot_specwin_>0)&&(nbtot_specwin_%nbwin4mean_==0) ) SaveMedianSpectra(); 100 98 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 } 102 108 //DBG cout << "BRGainCalculator::ProcSpecWin()/Debug: numpaqstart=" << numpaqstart 103 109 //DBG << " numpaqend=" << numpaqend << endl; … … 124 130 //perform a median filter on the frequencies 125 131 TVector<r_4> medianFilterFreq = medfiltspecmtx_.Row(i); 126 sa_size_t hww = 50; //half freq window for filtering132 sa_size_t hww = medianFilterHalfWidth_; //half freq window for filtering 127 133 sa_size_t fMin = 0.; 128 134 sa_size_t fMax = spec_window_.SizeX()-1; … … 164 170 << " nbtot_specwin = " << nbtot_specwin_ 165 171 << 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_; 183 193 } 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_; 184 202 cout << nummedianfile_ << "-BRGainCalculator::ProcSpecWin() save filtered spectra matrix in " 185 203 << flnm << endl; 186 187 //increment the file index 188 nummedianfile_++; 204 } 205 206 //increment the file index 207 nummedianfile_++; 189 208 190 191 192 193 194 195 196 209 //reset the matirx 210 medfiltspecmtx_ = (r_4)(0.); 211 212 //reset counter 213 nbtot_specwin_ = 0; 214 215 return; 197 216 } 198 217 //JEC 13/12/10 End
Note:
See TracChangeset
for help on using the changeset viewer.