Changeset 2004 in Sophya for trunk


Ignore:
Timestamp:
May 15, 2002, 6:03:43 PM (23 years ago)
Author:
ansari
Message:

Correction bugs de SimpleOffsetEstimator - Reza 15/5/2002

Location:
trunk/ArchTOIPipe/ProcWSophya
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/ProcWSophya/simoffset.cc

    r2000 r2004  
    1616
    1717SimpleOffsetEstimator::SimpleOffsetEstimator(int mwsz, int nptfit, int degpol)
    18   : poly(degpol)
     18  : poly((degpol > 1)?degpol:1)
    1919{
    2020  mWSz = (mwsz > 8) ? mwsz : 8;
    2121  nPtFit = (nptfit > degpol+2) ? nptfit : degpol+2;
     22  degPol = (degpol > 1)?degpol:1;
    2223  totnscount = 0;
    2324  totnbblock = 0;
     
    3233{
    3334  os << "\n ------------------------------------------------------ \n"
    34      << " SimpleDeglitcher::PrintStatus() - MeanWSize= " << mWSz << " NPtFit="
    35      << nPtFit << " DegPoly=" << poly.Degre() << endl;
     35     << " SimpleOffsetEstimator::PrintStatus() - MeanWSize= " << mWSz << " NPtFit="
     36     << nPtFit << " DegPoly=" << degPol << " poly.Degre()=" << poly.Degre() << endl;
    3637  TOIProcessor::PrintStatus(os);
    3738  os << " ProcessedSampleCount=" << ProcessedSampleCount() << endl;
     
    115116
    116117    int nbblkok = 0;
    117    
     118
     119    bool fginiXYdone = false;
     120
    118121    double sn0 = 0.;
    119122    double nok = 0.;
     
    140143        nok++;
    141144      }
    142       if (nbblkok == 0) {
     145     
     146      sn0 = (double)(k+wsize/2);
     147     
     148      if (!fginiXYdone) {
     149        if (nok > 0.5) {
     150          mean /= nok;
     151          meanx /= nok;
     152          sig = sig/nok-mean*mean;     
     153        }
    143154        X = RegularSequence(k+wsize*0.5, (double)wsize);
    144155        Y = mean;
    145156        YErr = (nok > 0.5) ? sqrt(mean) : 1.;
    146       }
    147      
    148       sn0 = (double)(k+wsize/2);
    149      
     157        fginiXYdone = true;
     158      }
     159
    150160      if (nok > 3.) {
    151161        mean /= nok;
     
    161171      X0 = X;
    162172      X0 -= sn0;
    163       poly.Fit(X,Y,YErr,poly.Degre(),errCoef);
    164      
     173      if (nbblkok > poly.Degre()+1)
     174        poly.Fit(X0,Y,YErr,degPol,errCoef);
     175      else {
     176        poly[0] = mean;
     177        for(int jj=1; jj<=poly.Degre(); jj++) poly[jj] = 0.;
     178      }
     179      /*
     180      if (nbblkok < 8) {
     181        cout << "------ DBG-X " << nbblkok << "," << nok << " degre=" << poly.Degre() << endl;
     182        cout << "DBG-A X0=" << X0 << endl;
     183        cout << "DBG-A Y=" << Y << endl;
     184        cout << "DBG-A YErr=" << YErr << endl;
     185        cout << "DBG-A poly= " << poly << endl;
     186      }
     187      */
    165188     
    166189      // Calcul des valeurs d'offset en sortie
  • trunk/ArchTOIPipe/ProcWSophya/simoffset.h

    r2000 r2004  
    4343  int mWSz;
    4444  int nPtFit;
     45  int degPol;
    4546  Poly poly;
    4647  bool ntpoly;
Note: See TracChangeset for help on using the changeset viewer.