Changeset 4351 in ntrip


Ignore:
Timestamp:
Jun 24, 2012, 5:48:40 PM (12 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/reqcanalyze.cpp

    r4350 r4351  
    254254                                     QVector<t_polarPoint*>* dataMP2) {
    255255
    256   int numVal = satStat.anaObs.size();
    257   if (numVal < 2) {
    258     return;
    259   }
    260 
    261   double mean1 = 0.0;
    262   double mean2 = 0.0;
    263   for (int ii = 0; ii < numVal; ii++) {
    264     const t_anaObs* anaObs = satStat.anaObs[ii];
    265     mean1 += anaObs->MP1;
    266     mean2 += anaObs->MP2;
    267   }
    268   mean1 /= numVal;
    269   mean2 /= numVal;
    270   double stddev1 = 0.0;
    271   double stddev2 = 0.0;
    272   for (int ii = 0; ii < numVal; ii++) {
    273     const t_anaObs* anaObs = satStat.anaObs[ii];
    274     double diff1 = anaObs->MP1 - mean1;
    275     double diff2 = anaObs->MP2 - mean2;
    276     stddev1 += diff1 * diff1;
    277     stddev2 += diff2 * diff2;
    278     //// beg test
    279     double bla = anaObs->zen/90.0;
    280     (*dataMP1) << (new t_polarPoint(anaObs->az, anaObs->zen, bla));
    281     (*dataMP2) << (new t_polarPoint(anaObs->az, anaObs->zen, bla));
    282     //// end test
    283   }
    284   double MP1 = sqrt(stddev1 / (numVal-1));
    285   double MP2 = sqrt(stddev2 / (numVal-1));
    286        
    287   _log->setRealNumberNotation(QTextStream::FixedNotation);
    288   _log->setRealNumberPrecision(2);
    289 
    290   *_log << "MP1 " << prn << " " << MP1 << endl;
    291   *_log << "MP2 " << prn << " " << MP2 << endl;
    292 }
     256  const int LENGTH = 60;  // number of epochs in one chunk
     257
     258  int numEpo = satStat.anaObs.size();
     259
     260  for (int chunkStart = 0; chunkStart + LENGTH < numEpo; chunkStart += LENGTH) {
     261
     262    // Compute Mean
     263    // ------------
     264    double mean1 = 0.0;
     265    double mean2 = 0.0;
     266    for (int ii = 0; ii < LENGTH; ii++) {
     267      int iEpo = chunkStart + ii;
     268      const t_anaObs* anaObs = satStat.anaObs[iEpo];
     269      mean1 += anaObs->MP1;
     270      mean2 += anaObs->MP2;
     271    }
     272    mean1 /= LENGTH;
     273    mean2 /= LENGTH;
     274
     275    // Compute Standard Deviation
     276    // --------------------------
     277    double stddev1 = 0.0;
     278    double stddev2 = 0.0;
     279    for (int ii = 0; ii < LENGTH; ii++) {
     280      int iEpo = chunkStart + ii;
     281      const t_anaObs* anaObs = satStat.anaObs[iEpo];
     282      double diff1 = anaObs->MP1 - mean1;
     283      double diff2 = anaObs->MP2 - mean2;
     284      stddev1 += diff1 * diff1;
     285      stddev2 += diff2 * diff2;
     286    }
     287    double MP1 = sqrt(stddev1 / (LENGTH-1));
     288    double MP2 = sqrt(stddev2 / (LENGTH-1));
     289
     290    const t_anaObs* anaObs = satStat.anaObs[chunkStart];
     291    (*dataMP1) << (new t_polarPoint(anaObs->az, anaObs->zen, MP1));
     292    (*dataMP2) << (new t_polarPoint(anaObs->az, anaObs->zen, MP2));
     293
     294    _log->setRealNumberNotation(QTextStream::FixedNotation);
     295    _log->setRealNumberPrecision(2);
     296    *_log << "MP1 " << prn << " " << anaObs->az << " " << anaObs->zen << MP1 << endl;
     297    *_log << "MP2 " << prn << " " << anaObs->az << " " << anaObs->zen << MP2 << endl;
     298  }
     299}
Note: See TracChangeset for help on using the changeset viewer.