Index: trunk/BNC/src/rinex/reqcanalyze.cpp
===================================================================
--- trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 6213)
+++ trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 6255)
@@ -35,5 +35,5 @@
  * Created:    11-Apr-2012
  *
- * Changes:    
+ * Changes:
  *
  * -----------------------------------------------------------------------*/
@@ -72,13 +72,13 @@
   _currEpo = 0;
 
-  connect(this, SIGNAL(dspSkyPlot(const QString&, 
-                                  const QByteArray&,
-                                  QVector<t_polarPoint*>*, 
+  connect(this, SIGNAL(dspSkyPlot(const QString&,
                                   const QByteArray&,
                                   QVector<t_polarPoint*>*,
-                                  const QByteArray&, double)), 
-          this, SLOT(slotDspSkyPlot(const QString&, 
+                                  const QByteArray&,
+                                  QVector<t_polarPoint*>*,
+                                  const QByteArray&, double)),
+          this, SLOT(slotDspSkyPlot(const QString&,
                                     const QByteArray&,
-                                    QVector<t_polarPoint*>*, 
+                                    QVector<t_polarPoint*>*,
                                     const QByteArray&,
                                     QVector<t_polarPoint*>*,
@@ -105,9 +105,9 @@
 }
 
-//  
-////////////////////////////////////////////////////////////////////////////
-void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName, 
+//
+////////////////////////////////////////////////////////////////////////////
+void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName,
                                    const QByteArray& title1,
-                                   QVector<t_polarPoint*>* data1, 
+                                   QVector<t_polarPoint*>* data1,
                                    const QByteArray& title2,
                                    QVector<t_polarPoint*>* data2,
@@ -135,5 +135,5 @@
       }
     }
-    
+
     QwtInterval scaleInterval(0.0, maxValue);
 
@@ -152,5 +152,5 @@
     }
 
-    t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 
+    t_graphWin* graphWin = new t_graphWin(0, fileName, plots,
                                           &scaleTitle, &scaleInterval);
 
@@ -166,5 +166,5 @@
 }
 
-//  
+//
 ////////////////////////////////////////////////////////////////////////////
 void t_reqcAnalyze::run() {
@@ -198,5 +198,5 @@
 }
 
-//  
+//
 ////////////////////////////////////////////////////////////////////////////
 void t_reqcAnalyze::analyzeFile(t_rnxObsFile* obsFile) {
@@ -232,5 +232,5 @@
       }
       _obsStat._endTime = _currEpo->tt;
-  
+
       // Loop over all satellites
       // ------------------------
@@ -239,7 +239,7 @@
         t_satObs obs;
         t_rnxObsFile::setObsFromRnx(obsFile, _currEpo, rnxSat, obs);
-  
+
         QString prn(obs._prn.toString().c_str());
-  
+
         t_ephGlo* ephGlo  = 0;
         int       slotNum = 0;
@@ -255,5 +255,5 @@
           }
         }
-  
+
         t_irc irc = _allObsMap[prn].addObs(obs, slotNum);
 
@@ -271,5 +271,5 @@
         }
       }
-  
+
       prepareObsStat(iEpo, obsFile->interval(), xyzSta);
       iEpo++;
@@ -282,5 +282,5 @@
     }
     else {
-      qDebug() << str;    
+      qDebug() << str;
     }
     _mutex.unlock();
@@ -299,5 +299,5 @@
     it.next();
     QString    prn     = it.key();
-    preparePlotData(prn, xyzSta, obsFile->interval(), 
+    preparePlotData(prn, xyzSta, obsFile->interval(),
                     dataMP1, dataMP2, dataSNR1, dataSNR2);
   }
@@ -310,8 +310,16 @@
     QFileInfo  fileInfo(obsFile->fileName());
     QByteArray title = fileInfo.fileName().toAscii();
-    emit dspSkyPlot(obsFile->fileName(), "MP1", dataMP1, "MP2", dataMP2, 
+    emit dspSkyPlot(obsFile->fileName(), "MP1", dataMP1, "MP2", dataMP2,
                     "Meters", 2.0);
-    emit dspSkyPlot(obsFile->fileName(), "SNR1", dataSNR1, "SNR2", dataSNR2, 
-                    "", 9.0);
+    double mean = 0.0;
+    for (int ii = 0; ii < dataSNR1->size(); ii++) {
+      const t_polarPoint* point = dataSNR1->at(ii);
+      mean += point->_value;
+    }
+    mean /= dataSNR1->size();
+    double max = (mean > 9.0) ? 54.0 : 9.0;
+    QByteArray str = (mean > 9.0) ? "dbHz" : "";
+    emit dspSkyPlot(obsFile->fileName(), "SNR1", dataSNR1, "SNR2", dataSNR2,
+    		str, max);
     emit dspAvailPlot(obsFile->fileName(), title);
   }
@@ -337,7 +345,7 @@
 }
 
-//  
-////////////////////////////////////////////////////////////////////////////
-t_irc t_reqcAnalyze::t_allObs::addObs(const t_satObs& obs, int slotNum) { 
+//
+////////////////////////////////////////////////////////////////////////////
+t_irc t_reqcAnalyze::t_allObs::addObs(const t_satObs& obs, int slotNum) {
 
   t_oneObs* newObs = new t_oneObs(obs._time.gpsw(), obs._time.gpssec());
@@ -360,8 +368,8 @@
       }
       if (frqObs->_codeValid) {
-        P1 = frqObs->_code;   
+        P1 = frqObs->_code;
       }
       if (frqObs->_snrValid) {
-        newObs->_SNR1 = frqObs->_snr;   
+        newObs->_SNR1 = frqObs->_snr;
       }
     }
@@ -374,8 +382,8 @@
       }
       if (frqObs->_codeValid) {
-        P2 = frqObs->_code;   
+        P2 = frqObs->_code;
       }
       if (frqObs->_snrValid) {
-        newObs->_SNR2 = frqObs->_snr;   
+        newObs->_SNR2 = frqObs->_snr;
       }
     }
@@ -425,5 +433,5 @@
 }
 
-//  
+//
 ////////////////////////////////////////////////////////////////////////////
 void t_reqcAnalyze::prepareObsStat(unsigned iEpo, double obsInterval,
@@ -443,15 +451,15 @@
 }
 
-//  
-////////////////////////////////////////////////////////////////////////////
-void t_reqcAnalyze::preparePlotData(const QString& prn, 
+//
+////////////////////////////////////////////////////////////////////////////
+void t_reqcAnalyze::preparePlotData(const QString& prn,
                                     const ColumnVector& xyzSta,
                                     double obsInterval,
-                                    QVector<t_polarPoint*>* dataMP1, 
+                                    QVector<t_polarPoint*>* dataMP1,
                                     QVector<t_polarPoint*>* dataMP2,
-                                    QVector<t_polarPoint*>* dataSNR1, 
+                                    QVector<t_polarPoint*>* dataSNR1,
                                     QVector<t_polarPoint*>* dataSNR2) {
 
-  const int chunkStep = int( 30.0 / obsInterval); // chunk step (30 sec)  
+  const int chunkStep = int( 30.0 / obsInterval); // chunk step (30 sec)
   const int numEpo    = int(600.0 / obsInterval); // # epochs in one chunk (10 min)
 
@@ -488,5 +496,5 @@
     }
 
-    // Chunk-Specific Variables 
+    // Chunk-Specific Variables
     // ------------------------
     bncTime currTime;
@@ -534,5 +542,5 @@
             }
           }
-          
+
           if (eph) {
             ColumnVector xc(4);
@@ -548,5 +556,5 @@
         }
       }
- 
+
       // Check Interval
       // --------------
@@ -612,5 +620,5 @@
         double diff1 = oneObs->_MP1 - meanMP1;
         double diff2 = oneObs->_MP2 - meanMP2;
-      
+
         // Check Slip Threshold
         // --------------------
@@ -619,5 +627,5 @@
           break;
         }
-      
+
         MP1 += diff1 * diff1;
         MP2 += diff2 * diff2;
@@ -630,5 +638,5 @@
           _obsStat._prnStat[prn]._numSlipsFound += 1;
         }
-      } 
+      }
       else {
         MP1 = sqrt(MP1 / (numEpo-1));
@@ -679,7 +687,7 @@
 }
 
-//  
-////////////////////////////////////////////////////////////////////////////
-void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName, 
+//
+////////////////////////////////////////////////////////////////////////////
+void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName,
                                      const QByteArray& title) {
 
@@ -761,5 +769,5 @@
   AA = AA.Rows(1, nSatUsed);
 
-  SymmetricMatrix QQ; 
+  SymmetricMatrix QQ;
   QQ << AA.t() * AA;
   QQ = QQ.i();
@@ -779,5 +787,5 @@
   }
 
-  *_log << "Marker name:     " << _obsStat._markerName   << endl 
+  *_log << "Marker name:     " << _obsStat._markerName   << endl
         << "Receiver:        " << _obsStat._receiverType << endl
         << "Antenna:         " << _obsStat._antennaName  << endl
