Class to construct histogram of a pair of random variables. More...
#include <ocsHistogram2D.hh>
Public Member Functions | |
Histogram2D (string InFileName, float x_min2, float x_max2, float y_min2, float y_max2) | |
Constructor. | |
void | InitializeParameters (void) |
Internal method called by constructors. | |
Histogram2D (string InFileName) | |
Constructor. | |
Histogram2D (string InFileName, OptSignal *oOptSignal) | |
Constructor to be used when making eye diagram. | |
Histogram2D (Histogram2D &OrigHist) | |
Copy constructor. | |
Histogram2D & | operator= (Histogram2D &RHSHist) |
Assignment operator. | |
~Histogram2D () | |
Destructor. | |
void | Clear () |
Sets all dynamic variables to their initial state. For use when want to output multiple independent histograms during course of a simulation. | |
void | SetMaxX (double x_max2) |
void | SetMaxY (double y_max2) |
void | SetMinMaxXY (double x_min2, double x_max2, double y_min2, double y_max2) |
float | GetMaxX (void) |
float | GetMaxY (void) |
float | GetMinX (void) |
float | GetMinY (void) |
float | GetDeltaX (void) |
float | GetDeltaY (void) |
int | GetNumBinsX (void) |
int | GetNumBinsY (void) |
float | GetSamplesMaxX (void) |
float | GetSamplesMaxY (void) |
void | SetBin (int x_index, int y_index, double value) |
Internal method. | |
double | GetBin (int x_index, int y_index) |
double | GetBinSquare (int x_index, int y_index) |
int | GetIndex (int x_index, int y_index) |
double | Get_pdfConfidence (int x_index, int y_index) |
Internal method. | |
void | ObtainConfidence (void) |
int | GetQtSamplesBin (int x_index, int y_index) |
void | IncrementBin (int x_index, int y_index, double LikelihoodRatio) |
int | GetQtSamples (void) |
Returns total number of samples. | |
void | AddSample (double x, double y) |
Method to add a sample in a standard Monte Carlo simulation. | |
void | AddSample (double x, double y, double LikelihoodRatio) |
Method to add sample in a Monte Carlo simulation with importance sampling. | |
void | WriteFile_pdf2D (string OutFileName) |
Writes out pdf computed by the histogram to a file. | |
double | GetMeanX (void) |
Returns mean of X calculated from samples that are in range. | |
double | GetMeanY (void) |
Returns mean of Y calculated from samples that are in range. | |
void | UpdateEyeDiagram (OptSignal *oOptSignal, Photodetector *oPhotodetector) |
For applications to eye diagrams in Monte Carlo simulations. | |
void | WriteEyeDiagramHistogram (string OutFileName) |
void | MultipleSelectMaxRelNumHitsImport (string InFileName, int Convert2dB_Scale) |
void | GetLevelCurvesMultipleSelectMaxRelNumHitsImport (string InFileName, int Convert2dB_Scale, int CosnvertParam2dB_Scale) |
void | MultipleHeuristicBalanceImport (string InFileName, int Convert2dB_Scale) |
Use this function for merging 2D histograms named in InFileName. | |
void | MergeMultipleConditionalHeuristicBalance (string InFileName, double z_min, double z_max, int Convert2dB_Scale) |
void | MergeMultipleConditionalHeuristicBalance (string InFileName, double z_min, double z_max, double w_min, double w_max, int Convert2dB_Scale) |
void | GetLevelCurvesMultipleHeuristicBalanceImport (string InFileName, int Convert2dB_Scale, int ConvertParam2dB_Scale) |
void | GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted (string InFileName, int Convert2dB_Scale, int ConvertParam2dB_Scale) |
void | ComputePDFfromHistogram (void) |
void | NormalizePDF (void) |
void | SetPDF (int x_index, int y_index, double value) |
double | GetPDF (int x_index, int y_index) |
void | ComputeXMarginalPDF (void) |
void | ComputeYMarginalPDF (void) |
double | ComputeIntegralPDF (void) |
double | ComputeMeanX_PDF (void) |
double | ComputeMeanY_PDF (void) |
double | GetMaxPDF (void) |
double | SetPDFToZeroBelowThreshold (double Threshold) |
void | GaussianPDF (double mean_x, double mean_y, double std) |
Analytic formula for Gaussian PDF. For debugging purposes. | |
void | WritePDF (string OutFileName) |
Writes out data in array PDF. | |
double | BilinearInterpolationPDF (double x, double y) |
void | RotatePDF (double CenterX, double CenterY, double Angle, double *OutData) |
Public Attributes | |
double * | |
The 2D PDF array. | |
Private Attributes | |
float | x_min |
Minimum x value for 2D Histogram of x and y. | |
float | x_max |
Maximum x value for 2D Histogram of x and y. | |
float | y_min |
Minimum y value for 2D Histogram of x and y. | |
float | y_max |
Maximum y value for 2D Histogram of x and y. | |
float | x_window_size |
float | y_window_size |
int | NumBinsX |
Number of bins in X variable. | |
int | NumBinsY |
Number of bins in Y variable. | |
float | delta_x |
float | delta_y |
double * | Bin |
The 2D Histogram array. | |
int * | qtSamplesBin |
double * | BinSquare |
double * | pdfConfidence |
bool | PreviouslyComputed_pdfConfidenceFlag |
double * | XData |
double * | YData |
double * | XMarginal |
double * | YMarginal |
int | NumSamplesTotal |
int | NumSamplesInRange |
int | NumSamplesWithOutOfRangeX |
int | NumSamplesWithOutOfRangeY |
float | SamplesMinX |
Minimum X value of all samples (even if lie outside Histogram). | |
float | SamplesMaxX |
Maximum X value of all samples (even if lie outside Histogram). | |
float | SamplesMinY |
Minimum Y value of all samples (even if lie outside Histogram). | |
float | SamplesMaxY |
Maximum Y value of all samples (even if lie outside Histogram). | |
string | HistInFileName |
Used by merge algorithms in importance sampling applications. | |
double | MeanX |
double | MeanY |
Class to construct histogram of a pair of random variables.
For use in computing two-dimensional histograms, particularly in Monte Carlo sampling. The main applications the code was written for include construction of eye diagrams in optical communications systems and quantification of statistics related to random polarization effects using importance sampling. However the class is generic enough to be used in other situations.
For simple applications call as follows:
For applications to eyediagrams call as
The two random variables are refered to as x and y throughout the code.
If we think of x and y as being on a 2D coordinate system as usual then the bins are indexed by a pair of integers that describes the position of the lower left corner of each bin, with the indices starting at (0,0).
So x-index goes from 0 to NumBinsX - 1.
Samples out of range are discarded and their number is tracked.
For importance sampling applications the pdfs for each bias choice are first written to files using WriteFile_pdf2D in one application. Then in a second aplication they are read back in and merged together usually using the balanaced heuristic method by calling a method like MultipleHeuristicBalanceImport. Finally the merged pdf is written out once more using WriteFile_pdf2D
Histogram2D::Histogram2D | ( | string | InFileName, | |
float | x_min2, | |||
float | x_max2, | |||
float | y_min2, | |||
float | y_max2 | |||
) |
Constructor.
References HistInFileName, InitializeParameters(), LogFile, LogFileSeparator(), LOWER_ONLY, NumBinsX, NumBinsY, ReadInt(), x_max, x_min, y_max, and y_min.
Referenced by GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), and MultipleSelectMaxRelNumHitsImport().
Histogram2D::Histogram2D | ( | string | InFileName | ) |
Constructor.
References HistInFileName, InitializeParameters(), LogFile, LogFileSeparator(), LOWER_ONLY, NO_BOUNDS, NumBinsX, NumBinsY, ReadDouble(), ReadInt(), x_max, x_min, y_max, and y_min.
Histogram2D::Histogram2D | ( | string | InFileName, | |
OptSignal * | oOptSignal | |||
) |
Constructor to be used when making eye diagram.
References OptSignal::GetBitLength(), HistInFileName, InitializeParameters(), LogFile, LogFileSeparator(), LOWER_ONLY, NumBinsX, NumBinsY, ReadDouble(), ReadInt(), x_max, x_min, y_max, and y_min.
Histogram2D::Histogram2D | ( | Histogram2D & | OrigHist | ) |
Copy constructor.
References BinSquare, GetBin(), GetPDF(), HistInFileName, InitializeParameters(), MeanX, MeanY, NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, NumSamplesWithOutOfRangeX, NumSamplesWithOutOfRangeY, pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, qtSamplesBin, SamplesMaxX, SamplesMaxY, SamplesMinX, SamplesMinY, SetBin(), SetPDF(), x_max, x_min, y_max, and y_min.
Histogram2D::~Histogram2D | ( | ) |
Destructor.
References Bin, BinSquare, pdfConfidence, and qtSamplesBin.
Referenced by ReceiverSubsystem::~ReceiverSubsystem().
void Histogram2D::AddSample | ( | double | x, | |
double | y | |||
) |
Method to add a sample in a standard Monte Carlo simulation.
Referenced by GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleSelectMaxRelNumHitsImport(), and UpdateEyeDiagram().
void Histogram2D::AddSample | ( | double | x, | |
double | y, | |||
double | LikelihoodRatio | |||
) |
Method to add sample in a Monte Carlo simulation with importance sampling.
References delta_x, delta_y, IncrementBin(), MeanX, MeanY, NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, NumSamplesWithOutOfRangeX, NumSamplesWithOutOfRangeY, SamplesMaxX, SamplesMaxY, SamplesMinX, SamplesMinY, x_min, and y_min.
double Histogram2D::BilinearInterpolationPDF | ( | double | x, | |
double | y | |||
) |
void Histogram2D::Clear | ( | ) |
Sets all dynamic variables to their initial state. For use when want to output multiple independent histograms during course of a simulation.
References BinSquare, LogFile, LogFileSeparator(), MeanX, MeanY, NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, NumSamplesWithOutOfRangeX, NumSamplesWithOutOfRangeY, pdfConfidence, qtSamplesBin, SetBin(), SetPDF(), XData, XMarginal, YData, and YMarginal.
Referenced by GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), InitializeParameters(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleSelectMaxRelNumHitsImport(), ReceiverSubsystem::ReceiveSignalBackToBack(), ReceiverSemiAnalytical::ReceiveSignalBackToBackMonteCarlo(), SetMaxY(), and SetMinMaxXY().
double Histogram2D::ComputeIntegralPDF | ( | void | ) |
References ComputeXMarginalPDF(), delta_x, NumBinsX, Quadrature(), x_max, x_min, and XMarginal.
Referenced by NormalizePDF().
double Histogram2D::ComputeMeanX_PDF | ( | void | ) |
References ComputeXMarginalPDF(), delta_x, NumBinsX, Quadrature(), x_max, x_min, XData, and XMarginal.
double Histogram2D::ComputeMeanY_PDF | ( | void | ) |
References ComputeYMarginalPDF(), delta_y, NumBinsY, Quadrature(), y_max, y_min, YData, and YMarginal.
void Histogram2D::ComputePDFfromHistogram | ( | void | ) |
For applications where want to manipulate PDF rather than histogram first call this method to compute PDF from histogram.
PDF data is stored in separate 2D array double * PDF All integrals involving PDF data done using (iterated) Simpson's Rule
References GetBin(), NormalizePDF(), NumBinsX, NumBinsY, and SetPDF().
void Histogram2D::ComputeXMarginalPDF | ( | void | ) |
References delta_y, GetPDF(), NumBinsX, NumBinsY, Quadrature(), XMarginal, y_max, y_min, and YData.
Referenced by ComputeIntegralPDF(), and ComputeMeanX_PDF().
void Histogram2D::ComputeYMarginalPDF | ( | void | ) |
References delta_x, GetPDF(), NumBinsX, NumBinsY, Quadrature(), x_max, x_min, XData, and YMarginal.
Referenced by ComputeMeanY_PDF().
void Histogram2D::GaussianPDF | ( | double | mean_x, | |
double | mean_y, | |||
double | std | |||
) |
double Histogram2D::Get_pdfConfidence | ( | int | x_index, | |
int | y_index | |||
) |
Internal method.
References GetBin(), GetBinSquare(), NumSamplesTotal, sq(), and sqrt().
Referenced by GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), and ObtainConfidence().
double Histogram2D::GetBin | ( | int | x_index, | |
int | y_index | |||
) |
Referenced by ComputePDFfromHistogram(), Get_pdfConfidence(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), Histogram2D(), MultipleSelectMaxRelNumHitsImport(), operator=(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
double Histogram2D::GetBinSquare | ( | int | x_index, | |
int | y_index | |||
) |
References BinSquare, and NumBinsY.
Referenced by Get_pdfConfidence(), and GetLevelCurvesMultipleHeuristicBalanceImport().
float Histogram2D::GetDeltaX | ( | void | ) | [inline] |
References delta_x.
float Histogram2D::GetDeltaY | ( | void | ) | [inline] |
References delta_y.
int Histogram2D::GetIndex | ( | int | x_index, | |
int | y_index | |||
) | [inline] |
References NumBinsY.
Referenced by GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), ObtainConfidence(), and WriteFile_pdf2D().
void Histogram2D::GetLevelCurvesMultipleHeuristicBalanceImport | ( | string | InFileName, | |
int | Convert2dB_Scale, | |||
int | ConvertParam2dB_Scale | |||
) |
References AddSample(), Clear(), GetBin(), GetBinSquare(), GetIndex(), GetQtSamplesBin(), HistInFileName, Histogram2D(), Linear2dB(), Linear2dB_Limited(), LogFile, NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, SetBin(), sgn(), sq(), x_max, x_min, y_max, and y_min.
void Histogram2D::GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted | ( | string | InFileName, | |
int | Convert2dB_Scale, | |||
int | ConvertParam2dB_Scale | |||
) |
References AddSample(), Clear(), Get_pdfConfidence(), GetBin(), GetIndex(), GetQtSamples(), HistInFileName, Histogram2D(), Linear2dB(), Linear2dB_Limited(), LogFile, NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, SetBin(), sgn(), sq(), sqrt(), x_max, x_min, y_max, and y_min.
void Histogram2D::GetLevelCurvesMultipleSelectMaxRelNumHitsImport | ( | string | InFileName, | |
int | Convert2dB_Scale, | |||
int | CosnvertParam2dB_Scale | |||
) |
References AddSample(), Clear(), Get_pdfConfidence(), GetBin(), GetIndex(), GetQtSamples(), GetQtSamplesBin(), HistInFileName, Histogram2D(), Linear2dB(), Linear2dB_Limited(), LogFile, NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, pdfConfidence, SetBin(), sgn(), x_max, x_min, y_max, and y_min.
double Histogram2D::GetMaxPDF | ( | void | ) |
Returns the maximum value of the PDF obtained using
float Histogram2D::GetMaxX | ( | void | ) | [inline] |
References x_max.
float Histogram2D::GetMaxY | ( | void | ) | [inline] |
References y_max.
double Histogram2D::GetMeanX | ( | void | ) |
Returns mean of X calculated from samples that are in range.
References MeanX, and NumSamplesInRange.
double Histogram2D::GetMeanY | ( | void | ) |
Returns mean of Y calculated from samples that are in range.
References MeanY, and NumSamplesInRange.
float Histogram2D::GetMinX | ( | void | ) | [inline] |
References x_min.
float Histogram2D::GetMinY | ( | void | ) | [inline] |
References y_min.
int Histogram2D::GetNumBinsX | ( | void | ) | [inline] |
References NumBinsX.
int Histogram2D::GetNumBinsY | ( | void | ) | [inline] |
References NumBinsX.
double Histogram2D::GetPDF | ( | int | x_index, | |
int | y_index | |||
) |
References NumBinsX, NumBinsY, and PDF.
Referenced by BilinearInterpolationPDF(), ComputeXMarginalPDF(), ComputeYMarginalPDF(), GetMaxPDF(), Histogram2D(), NormalizePDF(), operator=(), SetPDFToZeroBelowThreshold(), and WritePDF().
int Histogram2D::GetQtSamples | ( | void | ) | [inline] |
Returns total number of samples.
References NumSamplesTotal.
Referenced by GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), and MultipleSelectMaxRelNumHitsImport().
int Histogram2D::GetQtSamplesBin | ( | int | x_index, | |
int | y_index | |||
) |
References NumBinsY, and qtSamplesBin.
Referenced by GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), and MultipleSelectMaxRelNumHitsImport().
float Histogram2D::GetSamplesMaxX | ( | void | ) | [inline] |
References SamplesMaxX.
float Histogram2D::GetSamplesMaxY | ( | void | ) | [inline] |
References SamplesMaxY.
void Histogram2D::IncrementBin | ( | int | x_index, | |
int | y_index, | |||
double | LikelihoodRatio | |||
) |
References Bin, BinSquare, NumBinsY, qtSamplesBin, and sq().
Referenced by AddSample().
void Histogram2D::InitializeParameters | ( | void | ) |
Internal method called by constructors.
References Bin, BinSquare, Clear(), delta_x, delta_y, LogFile, NumBinsX, NumBinsY, PDF, pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, qtSamplesBin, x_max, x_min, x_window_size, XData, XMarginal, y_max, y_min, y_window_size, YData, and YMarginal.
Referenced by Histogram2D().
void Histogram2D::MergeMultipleConditionalHeuristicBalance | ( | string | InFileName, | |
double | z_min, | |||
double | z_max, | |||
double | w_min, | |||
double | w_max, | |||
int | Convert2dB_Scale | |||
) |
Use this function for merging 2D histograms named in InFileName Computes the 2D probability density function f(X=x,Y=y| z_min < Z < z_max, w_min < W < w_max), Samples of the random variables X,Y,Z,W have been obtained from an importance sampling simulation, and that the names of the files containing the samples are stored in the file InFileName.
Computes the 2D probability density function f(X=x,Y=y| z_min < Z < z_max, w_min < W < w_max), Samples of the random variables X,Y,Z,W have been obtained from an importance sampling simulation, and that the names of the files containing the samples are stored in the file InFileName.
The input parameter Convert2dB_Scale converts the pdfs of X and Y to a plus/minus dB scale before adding them to this 2D histogram.
We only add a (X,Y) sample to this 2D histogram if z_min < Z < z_max and w_min < W < w_max
Note: I'm not sure whether or not the Confidence Interval is correctly computed.
By JZ, 23/2/2005 and adapted from code by Ivan T. Lima Jr. and Aurenice O. Lima (7/28/02)
References AddSample(), Clear(), Get_pdfConfidence(), GetIndex(), HistInFileName, Histogram2D(), Linear2dB(), LogFile, NumBinsX, NumBinsY, ObtainConfidence(), pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, sgn(), sq(), and sqrt().
void Histogram2D::MergeMultipleConditionalHeuristicBalance | ( | string | InFileName, | |
double | z_min, | |||
double | z_max, | |||
int | Convert2dB_Scale | |||
) |
Use this function for merging 2D histograms named in InFileName Computes the 2D probability density function f(X=x,Y=y| z_min < Z < z_max), the joint probability density for X and Y given that z_min < Z < z_max. It is assumed that samples of the random variables X,Y,Z have been obtained from an importance sampling simulation, and that the names of the files containing the samples are stored in the file InFileName.
Computes the 2D probability density function f(X=x,Y=y| z_min < Z < z_max), the joint probability density for X and Y given that z_min < Z < z_max. It is assumed that samples of the random variables X,Y,Z have been obtained from an importance sampling simulation, and that the names of the files containing the samples are stored in the file InFileName.
The input parameter Convert2dB_Scale converts the pdfs of X and Y to a plus/minus dB scale before adding them to this 2D histogram.
We only add a (X,Y) sample to this 2D histogram if z_min < Z < z_max.
Note: I'm not sure whether or not the Confidence Interval is correctly computed for the case that Prob(z_min < Z < z_max) != 1
By JZ, 15/11/2004, modified 23/2/2005 and adapted from code by Ivan T. Lima Jr. and Aurenice O. Lima (7/28/02)
References AddSample(), Clear(), Get_pdfConfidence(), GetIndex(), HistInFileName, Histogram2D(), Linear2dB(), LogFile, NumBinsX, NumBinsY, ObtainConfidence(), pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, sgn(), sq(), and sqrt().
void Histogram2D::MultipleHeuristicBalanceImport | ( | string | InFileName, | |
int | Convert2dB_Scale | |||
) |
Use this function for merging 2D histograms named in InFileName.
References AddSample(), Clear(), Get_pdfConfidence(), GetIndex(), HistInFileName, Histogram2D(), Linear2dB(), LogFile, NumBinsX, NumBinsY, ObtainConfidence(), pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, sgn(), sq(), and sqrt().
void Histogram2D::MultipleSelectMaxRelNumHitsImport | ( | string | InFileName, | |
int | Convert2dB_Scale | |||
) |
References AddSample(), Clear(), GetBin(), GetQtSamples(), GetQtSamplesBin(), HistInFileName, Histogram2D(), Linear2dB(), LogFile, NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, SetBin(), and sgn().
void Histogram2D::NormalizePDF | ( | void | ) |
Normalize so integrates to 1. Useful after numerical operations are performed on PDF
References ComputeIntegralPDF(), GetPDF(), NumBinsX, NumBinsY, and SetPDF().
Referenced by ComputePDFfromHistogram(), and SetPDFToZeroBelowThreshold().
void Histogram2D::ObtainConfidence | ( | void | ) |
Computes width of confidence interval for each bin and stores result in 2D array pdfConfidence
References Get_pdfConfidence(), GetIndex(), NumBinsX, NumBinsY, pdfConfidence, and PreviouslyComputed_pdfConfidenceFlag.
Referenced by MergeMultipleConditionalHeuristicBalance(), and MultipleHeuristicBalanceImport().
Histogram2D & Histogram2D::operator= | ( | Histogram2D & | RHSHist | ) |
Assignment operator.
References BinSquare, delta_x, delta_y, GetBin(), GetPDF(), HistInFileName, MeanX, MeanY, NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, NumSamplesWithOutOfRangeX, NumSamplesWithOutOfRangeY, pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, qtSamplesBin, SamplesMaxX, SamplesMaxY, SamplesMinX, SamplesMinY, SetBin(), SetPDF(), x_max, x_min, x_window_size, y_max, y_min, and y_window_size.
void Histogram2D::RotatePDF | ( | double | CenterX, | |
double | CenterY, | |||
double | Angle, | |||
double * | OutData | |||
) |
Rotates PDF about (CenterX,CenterY) throuhg angle Angle and stores result in OutData.
OutData should be the 1D data array double * PDF from another Histogram2D object. BilinearInterpolationPDF() is used to get a value at ecah rotated point
References BilinearInterpolationPDF(), delta_x, delta_y, NumBinsX, NumBinsY, x_min, and y_min.
void Histogram2D::SetBin | ( | int | x_index, | |
int | y_index, | |||
double | value | |||
) |
void Histogram2D::SetMaxX | ( | double | x_max2 | ) |
void Histogram2D::SetMaxY | ( | double | y_max2 | ) |
References Clear(), delta_x, delta_y, LogFile, LogFileSeparator(), NumBinsX, NumBinsY, x_max, x_min, x_window_size, y_max, y_min, and y_window_size.
void Histogram2D::SetMinMaxXY | ( | double | x_min2, | |
double | x_max2, | |||
double | y_min2, | |||
double | y_max2 | |||
) |
void Histogram2D::SetPDF | ( | int | x_index, | |
int | y_index, | |||
double | value | |||
) |
Referenced by Clear(), ComputePDFfromHistogram(), GaussianPDF(), Histogram2D(), NormalizePDF(), operator=(), and SetPDFToZeroBelowThreshold().
double Histogram2D::SetPDFToZeroBelowThreshold | ( | double | Threshold | ) |
Sets values of PDF that are below the Threshold to zero and renormalizes PDF.
References GetPDF(), NormalizePDF(), NumBinsX, NumBinsY, and SetPDF().
void Histogram2D::UpdateEyeDiagram | ( | OptSignal * | oOptSignal, | |
Photodetector * | oPhotodetector | |||
) |
For applications to eye diagrams in Monte Carlo simulations.
We use real part of current when making eye diagram
References AddSample(), delta_x, OptSignal::GetBitLength(), OptSignal::GetDeltaTime(), OptSignal::GetQtPoints(), OptSignal::GetStringLength(), LogFile, NumBinsX, Photodetector::sfftPM, and fftPowerMatrices::tPowerSignal.
Referenced by ReceiverSubsystem::ReceiveSignal(), ReceiverSubsystem::ReceiveSignalBackToBack(), ReceiverSemiAnalytical::ReceiveSignalBackToBackMonteCarlo(), and ReceiverSemiAnalytical::ReceiveSignalMonteCarlo().
void Histogram2D::WriteEyeDiagramHistogram | ( | string | OutFileName | ) |
Outputs 2D histogram for eye diagram applications
References GetBin(), LogFile, LogFileSeparator(), NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, NumSamplesWithOutOfRangeX, NumSamplesWithOutOfRangeY, SamplesMaxX, SamplesMaxY, SamplesMinX, SamplesMinY, x_window_size, y_max, and y_min.
Referenced by ReceiverSubsystem::PostProcessReceiverStats(), ReceiverSemiAnalytical::PostProcessReceiverStats(), ReceiverSubsystem::ReceiveSignalBackToBack(), and ReceiverSemiAnalytical::ReceiveSignalBackToBackMonteCarlo().
void Histogram2D::WriteFile_pdf2D | ( | string | OutFileName | ) |
Writes out pdf computed by the histogram to a file.
Each line of the files corresponds to a different bin. On each line we have the following entries
References delta_x, delta_y, GetBin(), GetIndex(), LogFile, LogFileSeparator(), NumBinsX, NumBinsY, NumSamplesInRange, NumSamplesTotal, NumSamplesWithOutOfRangeX, NumSamplesWithOutOfRangeY, pdfConfidence, SamplesMaxX, SamplesMaxY, SamplesMinX, SamplesMinY, x_max, x_min, y_max, and y_min.
void Histogram2D::WritePDF | ( | string | OutFileName | ) |
double* Histogram2D::Bin [private] |
The 2D Histogram array.
Referenced by GetBin(), IncrementBin(), InitializeParameters(), SetBin(), and ~Histogram2D().
double* Histogram2D::BinSquare [private] |
Referenced by Clear(), GetBinSquare(), Histogram2D(), IncrementBin(), InitializeParameters(), operator=(), and ~Histogram2D().
float Histogram2D::delta_x [private] |
float Histogram2D::delta_y [private] |
string Histogram2D::HistInFileName [private] |
Used by merge algorithms in importance sampling applications.
Referenced by GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), Histogram2D(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleSelectMaxRelNumHitsImport(), and operator=().
double Histogram2D::MeanX [private] |
Referenced by AddSample(), Clear(), GetMeanX(), Histogram2D(), and operator=().
double Histogram2D::MeanY [private] |
Referenced by AddSample(), Clear(), GetMeanY(), Histogram2D(), and operator=().
int Histogram2D::NumBinsX [private] |
Number of bins in X variable.
Referenced by AddSample(), Clear(), ComputeIntegralPDF(), ComputeMeanX_PDF(), ComputePDFfromHistogram(), ComputeXMarginalPDF(), ComputeYMarginalPDF(), GaussianPDF(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), GetMaxPDF(), GetNumBinsX(), GetNumBinsY(), GetPDF(), Histogram2D(), InitializeParameters(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleSelectMaxRelNumHitsImport(), NormalizePDF(), ObtainConfidence(), operator=(), RotatePDF(), SetMaxY(), SetMinMaxXY(), SetPDFToZeroBelowThreshold(), UpdateEyeDiagram(), WriteEyeDiagramHistogram(), WriteFile_pdf2D(), and WritePDF().
int Histogram2D::NumBinsY [private] |
Number of bins in Y variable.
Referenced by AddSample(), Clear(), ComputeMeanY_PDF(), ComputePDFfromHistogram(), ComputeXMarginalPDF(), ComputeYMarginalPDF(), GaussianPDF(), GetBin(), GetBinSquare(), GetIndex(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), GetMaxPDF(), GetPDF(), GetQtSamplesBin(), Histogram2D(), IncrementBin(), InitializeParameters(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleSelectMaxRelNumHitsImport(), NormalizePDF(), ObtainConfidence(), operator=(), RotatePDF(), SetBin(), SetMaxY(), SetMinMaxXY(), SetPDF(), SetPDFToZeroBelowThreshold(), WriteEyeDiagramHistogram(), WriteFile_pdf2D(), and WritePDF().
int Histogram2D::NumSamplesInRange [private] |
Referenced by AddSample(), Clear(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), GetMeanX(), GetMeanY(), Histogram2D(), MultipleSelectMaxRelNumHitsImport(), operator=(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
int Histogram2D::NumSamplesTotal [private] |
Referenced by AddSample(), Clear(), Get_pdfConfidence(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), GetQtSamples(), Histogram2D(), MultipleSelectMaxRelNumHitsImport(), operator=(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
int Histogram2D::NumSamplesWithOutOfRangeX [private] |
Referenced by AddSample(), Clear(), Histogram2D(), operator=(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
int Histogram2D::NumSamplesWithOutOfRangeY [private] |
Referenced by AddSample(), Clear(), Histogram2D(), operator=(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
double* Histogram2D::PDF |
The 2D PDF array.
Referenced by GetPDF(), InitializeParameters(), and SetPDF().
double* Histogram2D::pdfConfidence [private] |
Referenced by Clear(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), Histogram2D(), InitializeParameters(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), ObtainConfidence(), operator=(), WriteFile_pdf2D(), and ~Histogram2D().
bool Histogram2D::PreviouslyComputed_pdfConfidenceFlag [private] |
int* Histogram2D::qtSamplesBin [private] |
Referenced by Clear(), GetQtSamplesBin(), Histogram2D(), IncrementBin(), InitializeParameters(), operator=(), and ~Histogram2D().
float Histogram2D::SamplesMaxX [private] |
Maximum X value of all samples (even if lie outside Histogram).
Referenced by AddSample(), GetSamplesMaxX(), Histogram2D(), operator=(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
float Histogram2D::SamplesMaxY [private] |
Maximum Y value of all samples (even if lie outside Histogram).
Referenced by AddSample(), GetSamplesMaxY(), Histogram2D(), operator=(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
float Histogram2D::SamplesMinX [private] |
Minimum X value of all samples (even if lie outside Histogram).
Referenced by AddSample(), Histogram2D(), operator=(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
float Histogram2D::SamplesMinY [private] |
Minimum Y value of all samples (even if lie outside Histogram).
Referenced by AddSample(), Histogram2D(), operator=(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
float Histogram2D::x_max [private] |
Maximum x value for 2D Histogram of x and y.
Referenced by ComputeIntegralPDF(), ComputeMeanX_PDF(), ComputeYMarginalPDF(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), GetMaxX(), Histogram2D(), InitializeParameters(), operator=(), SetMaxY(), SetMinMaxXY(), and WriteFile_pdf2D().
float Histogram2D::x_min [private] |
Minimum x value for 2D Histogram of x and y.
Referenced by AddSample(), BilinearInterpolationPDF(), ComputeIntegralPDF(), ComputeMeanX_PDF(), ComputeYMarginalPDF(), GaussianPDF(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), GetMinX(), Histogram2D(), InitializeParameters(), operator=(), RotatePDF(), SetMaxY(), SetMinMaxXY(), WriteFile_pdf2D(), and WritePDF().
float Histogram2D::x_window_size [private] |
Referenced by InitializeParameters(), operator=(), SetMaxY(), SetMinMaxXY(), and WriteEyeDiagramHistogram().
double* Histogram2D::XData [private] |
Referenced by Clear(), ComputeMeanX_PDF(), ComputeYMarginalPDF(), and InitializeParameters().
double* Histogram2D::XMarginal [private] |
Referenced by Clear(), ComputeIntegralPDF(), ComputeMeanX_PDF(), ComputeXMarginalPDF(), and InitializeParameters().
float Histogram2D::y_max [private] |
Maximum y value for 2D Histogram of x and y.
Referenced by ComputeMeanY_PDF(), ComputeXMarginalPDF(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), GetMaxY(), Histogram2D(), InitializeParameters(), operator=(), SetMaxY(), SetMinMaxXY(), WriteEyeDiagramHistogram(), and WriteFile_pdf2D().
float Histogram2D::y_min [private] |
Minimum y value for 2D Histogram of x and y.
Referenced by AddSample(), BilinearInterpolationPDF(), ComputeMeanY_PDF(), ComputeXMarginalPDF(), GaussianPDF(), GetLevelCurvesMultipleHeuristicBalanceImport(), GetLevelCurvesMultipleHeuristicBalanceImportVarianceWeighted(), GetLevelCurvesMultipleSelectMaxRelNumHitsImport(), GetMinY(), Histogram2D(), InitializeParameters(), operator=(), RotatePDF(), SetMaxY(), SetMinMaxXY(), WriteEyeDiagramHistogram(), WriteFile_pdf2D(), and WritePDF().
float Histogram2D::y_window_size [private] |
Referenced by InitializeParameters(), operator=(), SetMaxY(), and SetMinMaxXY().
double* Histogram2D::YData [private] |
Referenced by Clear(), ComputeMeanY_PDF(), ComputeXMarginalPDF(), and InitializeParameters().
double* Histogram2D::YMarginal [private] |
Referenced by Clear(), ComputeMeanY_PDF(), ComputeYMarginalPDF(), and InitializeParameters().