Changeset 1443 in Sophya for trunk/ArchTOIPipe/ProcWSophya
- Timestamp:
- Mar 15, 2001, 4:46:21 PM (25 years ago)
- Location:
- trunk/ArchTOIPipe/ProcWSophya
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/ProcWSophya/rztoi.cc
r1442 r1443 212 212 cout << " ... Processing remaining Samples - SN=" 213 213 << snlast << " ->" << sne << endl; 214 for(ii=snlast; ii< sne; ii++) {214 for(ii=snlast; ii<=sne; ii++) { 215 215 val = getData(0, ii); 216 216 putData(0, ii, val*_fact); -
trunk/ArchTOIPipe/ProcWSophya/simtoipr.cc
r1442 r1443 17 17 maxpoints = maxnpt; 18 18 totnscount = glnscount = glcount = 0; 19 deglitchdone = false; 19 20 } 20 21 21 22 SimpleDeglitcher::~SimpleDeglitcher() 22 23 { 24 } 25 26 void SimpleDeglitcher::PrintStatus(ostream & os) 27 { 28 os << "\n ------------------------------------------------------ \n" 29 << " SimpleDeglitcher::PrintStatus() - WindowSize=" << WSize() 30 << " NbSigmas=" << NbSigmas() << " MaxPoints=" << MaxPoints() << endl; 31 TOIProcessor::PrintStatus(os); 32 if (deglitchdone) os << " Deglitching performed " << endl; 33 else os << " NO deglitching done " << endl; 34 double nst = (TotalSampleCount() > 0) ? TotalSampleCount() : 1.; 35 os << " TotalSampleCount=" << TotalSampleCount() << " GlitchCount= " 36 << GlitchCount() << " GlitchSampleCount=" << GlitchSampleCount() 37 << "( " << (double)GlitchSampleCount()*100./nst << " % )" << endl; 38 os << " ------------------------------------------------------ " << endl; 23 39 } 24 40 … … 29 45 declareOutput("mean"); 30 46 declareOutput("sigma"); 47 declareOutput("incopie"); 31 48 name = "SimpleDeglitcher"; 32 49 // upExtra = 1; A quoi ca sert ? … … 42 59 bool fgmean = checkOutputTOIIndex(1); 43 60 bool fgsigma = checkOutputTOIIndex(2); 61 bool fgincopie = checkOutputTOIIndex(3); 44 62 45 63 if (!checkInputTOIIndex(0)) { … … 48 66 throw ParmError("SimpleDeglitcher::run() Input TOI (in) not connected!"); 49 67 } 50 if (!fgout && !fgmean && !fgsigma ) {68 if (!fgout && !fgmean && !fgsigma &&!fgincopie) { 51 69 cerr << " SimpleDeglitcher::run() - No Output TOI connected! " 52 70 << endl; … … 59 77 } 60 78 61 cout << " SimpleDeglitcher::run() SN =" << snb << " - " << sne << endl;79 cout << " SimpleDeglitcher::run() SNRange=" << snb << " - " << sne << endl; 62 80 try { 81 Timer tm("SimpleDeglitcher::run()"); 63 82 // Le debut 64 83 int wsz2 = wsize/2; … … 67 86 for(k=0; k<wsize; k++) 68 87 vin(k) = getData(0, k+snb); 69 double s = vin.Sum() /wsize;88 double s = vin.Sum(); 70 89 double mean = s/wsize; 71 90 double s2 = vin.SumX2(); … … 75 94 bool fgglitch = false; 76 95 double valcur,valsub,valadd; 77 for(k=0;k< sne-snb;k++) {96 for(k=0;k<=sne-snb;k++) { 78 97 totnscount++; 79 if (k%10000 == 0) cout << " DBG: K=" << k << endl;98 // if (k%10000 == 0) cout << " DBG: K=" << k << endl; 80 99 // Calcul mean-sigma 81 100 if ((k>wsz2) && (k<sne-snb-wsz2)) { 82 101 valsub = vin((k+wsz2)%wsize); 83 vin((k+wsz2)%wsize) = valadd = getData(0, k+ snb);102 vin((k+wsz2)%wsize) = valadd = getData(0, k+wsz2+snb); 84 103 s += (valadd-valsub); 85 s2 += (valadd*valadd-valsub -valsub);104 s2 += (valadd*valadd-valsub*valsub); 86 105 mean = s/wsize; 87 106 sigma = sqrt(s2/wsize-mean*mean); … … 94 113 putData(2, k+snb, sigma, 0); 95 114 115 valcur = vin(k%wsize); 116 if (fgincopie) 117 putData(3, k+snb, valcur, 0); 118 96 119 if (!fgout) continue; // Pas de sortie out (deglitche) 97 120 98 valcur = vin(k%wsize); 121 122 // if (k<100) { 123 // cout << "DBG-A-Deglitch[" << k << "] mean=" 124 // << mean << " sigma=" << sigma << " valcur=" 125 // << valcur << " Kgl=" << kgl ; 126 // if (fgglitch) cout << " In Glitch" ; 127 // cout << endl; 128 // } 99 129 100 130 if (valcur < mean+nsig*sigma) { // inferieur au seuil … … 139 169 } 140 170 141 if (k%5000 == 0) cout << " ---DBG2: K=" << k << " glcount=" 142 << glcount << " LastPut= " << lastput << endl; 143 } // Boucle sur les num-sample 144 cout << " La fin lastput=" << lastput << " SNE=" << sne; 145 for(k=lastput-snb; k<sne-snb; k++) 146 putData(0, k+snb, vin(k%wsize), 0); 147 cout << " DBG3- OUT of try bloc ! " << endl; 148 171 // if (k%5000 == 0) cout << " ---DBG2: K=" << k << " glcount=" 172 // << glcount << " LastPut= " << lastput << endl; 173 } // Fin de Boucle sur les num-sample 174 175 //DBG cout << " La fin lastput=" << lastput << " SNE=" << sne; 176 //DBG for(k=lastput-snb+1; k<sne-snb; k++) 177 //DBG putData(0, k+snb, vin(k%wsize), 0); 178 // cout << " DBG3- OUT of try bloc ! " << endl; 179 cout << " SimpleDeglitcher::run() - End of processing " 180 << " TotalSampleCount=" << TotalSampleCount() 181 << " GlitchCount= " << GlitchCount() << endl; 182 if (fgout) deglitchdone = true; 149 183 } // Bloc try 150 184 catch (PException & exc) { … … 174 208 } 175 209 210 void SimpleFilter::PrintStatus(ostream & os) 211 { 212 os << "\n ------------------------------------------------------ \n" 213 << " SimpleFilter::PrintStatus() - WindowSize=" << WSize() 214 << " FilterKind= " << Type() << endl; 215 TOIProcessor::PrintStatus(os); 216 os << " Coeff= " ; 217 for(int k=0; k<wsize; k++) os << coef[k] << " " ; 218 os << endl; 219 os << " TotalSampleCount=" << TotalSampleCount() << endl; 220 os << " ------------------------------------------------------ " << endl; 221 } 222 176 223 void SimpleFilter::init() { 177 224 cout << "SimpleFilter::init" << endl; 178 225 declareInput("in"); 179 226 declareOutput("out"); 227 declareOutput("incopie"); 180 228 name = "SimpleFilter"; 181 229 // upExtra = 1; … … 187 235 int sne = getMaxIn(); 188 236 189 cout << " SimpleFilter::run(): snb=" << snb << " sne=" << sne << endl;190 191 237 bool fgout = checkOutputTOIIndex(0); 238 bool fgincopie = checkOutputTOIIndex(1); 192 239 193 240 if (!checkInputTOIIndex(0)) { … … 201 248 throw ParmError("SimpleFilter::run() No output TOI connected!"); 202 249 } 250 251 cout << " SimpleFilter::run() SNRange=" << snb << " - " << sne << endl; 203 252 204 253 205 254 try { 255 Timer tm("SimpleFilter::run()"); 206 256 // Le debut 207 257 int wsz2 = wsize/2; … … 212 262 double mean = vin.Sum()/wsize; 213 263 for(k=0; k<wsize/2; k++) vin(k) = mean; 214 for(k=0;k< sne-snb;k++) {264 for(k=0;k<=sne-snb;k++) { 215 265 totnscount++; 216 266 // Calcul mean-sigma … … 224 274 } 225 275 putData(0,k+snb,sortie,0); 276 if (fgincopie) putData(1,k+snb,vin(k%wsize),0); 226 277 } // Boucle sur les num-sample 278 cout << " SimpleFilter::run() - End of processing " << endl; 227 279 } // Bloc try 228 280 -
trunk/ArchTOIPipe/ProcWSophya/simtoipr.h
r1442 r1443 27 27 inline int GlitchSampleCount() const { return glnscount; } 28 28 29 virtual void PrintStatus(ostream & os) ; // const plus tard 30 29 31 protected: 30 32 int totnscount; // Nombre total d'echantillon processe 31 33 int glnscount; // Nombre total de glitch 32 34 int glcount; // Nombre de glitch detecte 35 bool deglitchdone; // Deglitch effectue 33 36 34 37 int wsize; // Taille de fenetre de travail … … 62 65 inline int TotalSampleCount() const { return totnscount; } 63 66 67 virtual void PrintStatus(ostream & os) ; // const plus tard 68 64 69 virtual void init(); 65 70 virtual void run();
Note:
See TracChangeset
for help on using the changeset viewer.