mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-14 15:29:05 -05:00
Merge branch 'feature/iSWA' of github.com:OpenSpace/OpenSpace-Development into feature/iSWA
This commit is contained in:
@@ -28,12 +28,11 @@ namespace {
|
||||
const std::string _loggerCat = "DataProcessor";
|
||||
const int NumBins = 512;
|
||||
}
|
||||
// const float normVal = 1.0;
|
||||
|
||||
namespace openspace {
|
||||
DataProcessor::DataProcessor()
|
||||
:_useLog(false)
|
||||
,_useHistogram(false)
|
||||
// ,_normValues(glm::vec2(normVal))
|
||||
,_normValues(glm::vec2(1.0))
|
||||
,_filterValues(glm::vec2(0.0))
|
||||
{
|
||||
@@ -83,7 +82,6 @@ float DataProcessor::processDataPoint(float value, int option){
|
||||
float v;
|
||||
if(_useHistogram){
|
||||
v = histogram->equalize(normalizeWithStandardScore(value, mean, sd, glm::vec2(_fitValues[option])))/(float)NumBins;
|
||||
// v = histogram->equalize(value)/(float)512;
|
||||
}else{
|
||||
v = normalizeWithStandardScore(value, mean, sd, _normValues);
|
||||
}
|
||||
@@ -106,7 +104,6 @@ float DataProcessor::unnormalizeWithStandardScore(float standardScore, float mea
|
||||
float zScoreMax = normalizationValues.y;
|
||||
|
||||
float value = standardScore*(zScoreMax+zScoreMin)-zScoreMin;
|
||||
// standardScore -= standardScore*(zScoreMax+zScoreMin)-zScoreMin;
|
||||
value = value*sd+mean;
|
||||
|
||||
return value;
|
||||
|
||||
+6
-25
@@ -319,17 +319,16 @@ float Histogram::entropy() const {
|
||||
}
|
||||
|
||||
void Histogram::print() const {
|
||||
// std::cout << "number of bins: " << _numBins << std::endl
|
||||
// << "range: " << _minValue << " - " << _maxValue << std::endl << std::endl;
|
||||
std::cout << "number of bins: " << _numBins << std::endl
|
||||
<< "range: " << _minValue << " - " << _maxValue << std::endl << std::endl;
|
||||
for (int i = 0; i < _numBins; i++) {
|
||||
float low = _minValue + float(i) / _numBins * (_maxValue - _minValue);
|
||||
float high = low + (_maxValue - _minValue) / float(_numBins);
|
||||
// std::cout << i << " [" << low << ", " << high << "]"
|
||||
// << " " << _data[i] << std::endl;
|
||||
std::cout << _data[i]/(float)_numValues << ", ";
|
||||
std::cout << i << " [" << low << ", " << high << "]"
|
||||
<< " " << _data[i] << std::endl;
|
||||
// std::cout << _data[i]/(float)_numValues << ", ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
// std::cout << std::endl << std::endl << std::endl<< "==============" << std::endl;
|
||||
std::cout << std::endl << std::endl << std::endl<< "==============" << std::endl;
|
||||
}
|
||||
|
||||
float Histogram::highestBinValue(bool equalized, int overBins){
|
||||
@@ -352,7 +351,6 @@ float Histogram::highestBinValue(bool equalized, int overBins){
|
||||
|
||||
value += _data[i];
|
||||
value /= (float)++num;
|
||||
//value = _data[i];
|
||||
|
||||
if(value > highestValue){
|
||||
highestBin = i;
|
||||
@@ -366,7 +364,6 @@ float Histogram::highestBinValue(bool equalized, int overBins){
|
||||
return (high+low)/2.0;
|
||||
}else{
|
||||
return highestBin/(float)_numBins;
|
||||
// return equalize((high+low)/2.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,20 +371,4 @@ float Histogram::binWidth(){
|
||||
return (_maxValue-_minValue)/float(_numBins);
|
||||
}
|
||||
|
||||
void operator<<(std::ostream& os, const Histogram& hist){
|
||||
const float* data = hist.data();
|
||||
float max = hist.maxValue();
|
||||
float min = hist.minValue();
|
||||
int numBins = hist.numBins();
|
||||
int numValues = hist.numValues();
|
||||
|
||||
for (int i = 0; i < numBins; i++) {
|
||||
float low = min + float(i) / numBins * (max - min);
|
||||
float high = low + (max - min) / float(numBins);
|
||||
// std::cout << i << " [" << low << ", " << high << "]"
|
||||
// << " " << _data[i] << std::endl;
|
||||
os << data[i]/numValues << ", ";
|
||||
}
|
||||
os << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user