Commit 3f3d60af authored by Julien Malik's avatar Julien Malik
Browse files

BUG: fix percentile computation for BOUND_UPPER mode

parent f29aff30
......@@ -102,11 +102,13 @@ HistogramModel
MeasurementType minI = histogram->GetBinMin( 0, index[ 0 ] );
MeasurementType maxI = histogram->GetBinMax( 0, index[ 0 ] );
// Min/max frequencies of
// Frequency of current bin
Histogram::FrequencyType frequency( histogram->GetFrequency( index ) );
// Initialize result.
double percent = frequency * ( intensity - minI ) / ( maxI - minI );
// Initialize result (contribution of current bin)
double percent = frequency
* ( intensity - (bound == BOUND_LOWER ? minI : maxI) )
/ ( maxI - minI );
// Number of bins of histogram.
Histogram::SizeType::SizeValueType binCount = histogram->Size();
......@@ -134,12 +136,12 @@ HistogramModel
break;
};
// Traverse lower/upper bound.
// Traverse lower/upper bound (contribution of other bins)
Histogram::SizeType::SizeValueType i;
for( i=i0; i<iN; ++i )
percent += histogram->GetFrequency( i, 0 );
// Calculate frequency rate.
percent /= histogram->GetTotalFrequency();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment