• Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

ocsHistogram2D.hh

Go to the documentation of this file.
00001 // $Id: ocsHistogram2D.hh,v 1.3 2008/08/08 02:20:44 zweck Exp $
00002 
00003 
00004 //###################################################################
00005 //
00006 //           Optical Communication Systems Simulator
00007 //
00008 //       Copyright (2000):
00009 //       Optical Fiber Communications Laboratory (OFCL)
00010 //       Computer Science & Electrical Engineering Department (CSEE)
00011 //       University of Maryland Baltimore County (UMBC)
00012 //
00013 //###################################################################
00014 
00015 #ifndef _OCS_HISTOGRAM_2D_HH_
00016 #define  _OCS_HISTOGRAM_2D_HH_
00017 
00018 #include "ocsOptSignal.hh"
00019 #include "ocsPhotodetector.hh"
00020 
00063 class Histogram2D
00064 {
00065 
00066 public:
00067 
00069 
00074   Histogram2D(string InFileName,float x_min2,float x_max2,
00075                                 float y_min2, float y_max2);
00076 
00078 
00079   void InitializeParameters(void);
00080 
00082 
00083   Histogram2D(string InFileName);
00084 
00085   // Note: The following method should really belong to a derived 
00086   // EyeDiagram class of the Histogram2D class.
00087 
00089 
00090   Histogram2D(string InFileName,OptSignal *oOptSignal);
00091 
00093 
00094   Histogram2D(Histogram2D & OrigHist);
00095 
00097 
00098   Histogram2D & operator=(Histogram2D & RHSHist);
00099 
00101 
00102   ~Histogram2D();
00103 
00109   void Clear();
00110 
00112 
00113   void SetMaxX(double x_max2); 
00114  
00116 
00117   void SetMaxY(double y_max2); 
00118  
00119   void SetMinMaxXY(double x_min2, double x_max2,
00120                    double y_min2, double y_max2);
00121   
00122  float GetMaxX(void) {return x_max;};
00123    
00124  float GetMaxY(void) {return y_max;};
00125 
00126  float GetMinX(void) {return x_min;};
00127  float GetMinY(void) {return y_min;};
00128 
00129  float GetDeltaX(void) {return delta_x;};
00130  float GetDeltaY(void) {return delta_y;};
00131  int GetNumBinsX(void) {return NumBinsX;};
00132  int GetNumBinsY(void) {return NumBinsX;};
00133 
00135 
00136   float GetSamplesMaxX(void) {return SamplesMaxX;};
00137 
00139 
00140   float GetSamplesMaxY(void) {return SamplesMaxY;}; 
00141 
00143 
00144   void SetBin(int x_index, int y_index, double value);
00145   
00146   double GetBin(int x_index, int y_index);
00147   double GetBinSquare(int x_index, int y_index);  
00148   int GetIndex(int x_index, int y_index)
00149      { return   y_index + NumBinsY*x_index;};   
00150 
00152 
00153   double Get_pdfConfidence(int x_index, int y_index);
00154 
00157 
00158   void ObtainConfidence(void);
00159   
00160   int GetQtSamplesBin(int x_index, int y_index);
00161 
00162   void IncrementBin(int x_index, int y_index, double LikelihoodRatio);
00163 
00165 
00166   int GetQtSamples(void) {return NumSamplesTotal;}; 
00167 
00169 
00170   void AddSample(double x, double y);
00171 
00173 
00174   void AddSample(double x, double y, double LikelihoodRatio);  
00175 
00176 
00178   
00192   void WriteFile_pdf2D(string OutFileName);
00193 
00198   double GetMeanX(void);
00199 
00204   double GetMeanY(void);
00205 
00206 
00208 
00211   void UpdateEyeDiagram(OptSignal *oOptSignal,Photodetector *oPhotodetector);
00212 
00213 
00218   void WriteEyeDiagramHistogram(string OutFileName);
00219 
00220 
00221   void MultipleSelectMaxRelNumHitsImport(string InFileName,
00222                                          int Convert2dB_Scale);                                  
00223   void GetLevelCurvesMultipleSelectMaxRelNumHitsImport(string InFileName,
00224                                                int Convert2dB_Scale,
00225                                                int CosnvertParam2dB_Scale);
00226 
00228 
00229   void MultipleHeuristicBalanceImport(string InFileName,
00230                                        int Convert2dB_Scale);
00231 
00241   void MergeMultipleConditionalHeuristicBalance(string InFileName,
00242                                                 double z_min, double z_max,
00243                                                 int Convert2dB_Scale);
00244 
00253   void MergeMultipleConditionalHeuristicBalance(string InFileName,
00254                                                 double z_min, double z_max,
00255                                                 double w_min, double w_max,
00256                                                 int Convert2dB_Scale);
00257 
00258 
00259    void GetLevelCurvesMultipleHeuristicBalanceImport(string InFileName,
00260                                                   int Convert2dB_Scale,
00261                                                   int ConvertParam2dB_Scale);
00262                                                   
00263    void GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(
00264                                                   string InFileName,
00265                                                   int Convert2dB_Scale,
00266                                                   int ConvertParam2dB_Scale);
00267 
00268 
00271 
00276    void ComputePDFfromHistogram(void);
00277 
00280 
00281    void NormalizePDF(void);
00282 
00284 
00285    void SetPDF(int x_index, int y_index, double value);
00286 
00288 
00289    double GetPDF(int x_index, int y_index);
00290 
00291    void ComputeXMarginalPDF(void);
00292    void ComputeYMarginalPDF(void);
00293 
00294    double ComputeIntegralPDF(void);
00295    double ComputeMeanX_PDF(void);
00296    double ComputeMeanY_PDF(void);
00297 
00300 
00301    double GetMaxPDF(void);
00302  
00305 
00306    double SetPDFToZeroBelowThreshold(double Threshold);
00307 
00309 
00310    void GaussianPDF(double mean_x, double mean_y, double std);
00311 
00313 
00314    void WritePDF(string OutFileName);
00315 
00316    double BilinearInterpolationPDF(double x, double y);
00317 
00320 
00326    void RotatePDF(double CenterX, double CenterY, double Angle, 
00327                   double *OutData);
00328 
00329 public:
00330 
00332 
00333   double * PDF;
00334 
00335 private:
00336 
00337   // Parameters describing physical domain of pdf
00338 
00340 
00341   float x_min;
00342 
00344 
00345 
00346   float x_max;
00347 
00349 
00350   float y_min;
00351 
00353 
00354   float y_max;
00355  
00356   float x_window_size,y_window_size;
00357 
00359 
00360   int NumBinsX;
00361 
00362 
00364 
00365   int  NumBinsY;
00366 
00367   float delta_x, delta_y;
00368   
00370 
00371   double * Bin;
00372   int *qtSamplesBin;
00373   
00374   double * BinSquare;
00375   double * pdfConfidence;
00376   bool PreviouslyComputed_pdfConfidenceFlag;
00377 
00378   // Data to manipulate PDFs
00379 
00380   double * XData;
00381   double * YData;
00382   double * XMarginal;
00383   double * YMarginal;
00384 
00385 
00386   // Parameters relating to statistics of pdf
00387 
00388   int NumSamplesTotal;
00389   int NumSamplesInRange;
00390   int NumSamplesWithOutOfRangeX;
00391   int NumSamplesWithOutOfRangeY;
00392 
00393   // Used to determine size of physical grid for later runs
00394 
00396 
00397   float SamplesMinX; 
00398 
00400 
00401   float SamplesMaxX;
00402 
00404 
00405   float SamplesMinY; 
00406 
00408 
00409   float SamplesMaxY;
00410 
00412   
00413   string HistInFileName; 
00414 
00415   double MeanX;
00416   double MeanY;
00417 
00418 };
00419 
00420 #endif /*  _OCS_HISTOGRAM_2D_HH_ */
00421 

Generated on Fri Jul 2 2010 12:57:46 for OCS by  doxygen 1.7.1