mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-14 07:30:07 -06:00
add comments and removed unnesesary code
This commit is contained in:
@@ -101,15 +101,15 @@ float DataProcessor::normalizeWithStandardScore(float value, float mean, float s
|
||||
return ( standardScore + zScoreMin )/(zScoreMin + zScoreMax );
|
||||
}
|
||||
|
||||
float DataProcessor::unnormalizeWithStandardScore(float standardScore, float mean, float sd, glm::vec2 normalizationValues){
|
||||
float zScoreMin = normalizationValues.x;
|
||||
float zScoreMax = normalizationValues.y;
|
||||
// float DataProcessor::unnormalizeWithStandardScore(float standardScore, float mean, float sd, glm::vec2 normalizationValues){
|
||||
// float zScoreMin = normalizationValues.x;
|
||||
// float zScoreMax = normalizationValues.y;
|
||||
|
||||
float value = standardScore*(zScoreMax+zScoreMin)-zScoreMin;
|
||||
value = value*sd+mean;
|
||||
// float value = standardScore*(zScoreMax+zScoreMin)-zScoreMin;
|
||||
// value = value*sd+mean;
|
||||
|
||||
return value;
|
||||
}
|
||||
// return value;
|
||||
// }
|
||||
|
||||
void DataProcessor::initializeVectors(int numOptions){
|
||||
if(_min.empty()) _min = std::vector<float>(numOptions, std::numeric_limits<float>::max());
|
||||
@@ -141,16 +141,16 @@ void DataProcessor::calculateFilterValues(std::vector<int> selectedOptions){
|
||||
filterMid = histogram->highestBinValue(_useHistogram);
|
||||
filterWidth = histogram->binWidth();
|
||||
|
||||
//at least one pixel value width. 1/numBins above mid and 1/numBins below mid => 1/(numBins/2) filtered
|
||||
// filterWidth = std::max(filterWidth, 1.0f/(float)NumBins);
|
||||
|
||||
filterMid = normalizeWithStandardScore(filterMid, mean, standardDeviation, _normValues);
|
||||
filterWidth = fabs(0.5-normalizeWithStandardScore(mean+filterWidth, mean, standardDeviation, _normValues));
|
||||
|
||||
// at least one pixel value width. 1/512 above mid and 1/512 below mid => 1/(numBins/2) filtered
|
||||
// filterWidth = std::max(filterWidth, 1.0f / 512.0f);
|
||||
|
||||
}else{
|
||||
Histogram hist = _histograms[option]->equalize();
|
||||
filterMid = hist.highestBinValue(true);
|
||||
filterWidth = std::min(1.f / (float)NumBins, 1.0f/(float)NumBins);
|
||||
filterWidth = std::min(1.0f / (float)NumBins, 1.0f / 512.0f);
|
||||
}
|
||||
_filterValues += glm::vec2(filterMid-filterWidth, filterMid+filterWidth);
|
||||
|
||||
@@ -203,7 +203,7 @@ void DataProcessor::add(std::vector<std::vector<float>>& optionValues, std::vect
|
||||
_numValues[i] += numValues;
|
||||
mean = (1.0f/_numValues[i])*_sum[i];
|
||||
|
||||
const float* histData = _unNormalizedhistograms[i]->data();
|
||||
//const float* histData = _unNormalizedhistograms[i]->data();
|
||||
float histMin = _unNormalizedhistograms[i]->minValue();
|
||||
float histMax = _unNormalizedhistograms[i]->maxValue();
|
||||
int numBins = _unNormalizedhistograms[i]->numBins();
|
||||
@@ -215,7 +215,6 @@ void DataProcessor::add(std::vector<std::vector<float>>& optionValues, std::vect
|
||||
float fit = _unNormalizedhistograms[i]->entropy();
|
||||
_fitValues[i] = fit;
|
||||
|
||||
|
||||
float max = normalizeWithStandardScore(histMax, mean, _standardDeviation[i], glm::vec2(_fitValues[i]));
|
||||
float min = normalizeWithStandardScore(histMin, mean, _standardDeviation[i], glm::vec2(_fitValues[i]));
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ protected:
|
||||
//glm::vec2 _histNormValues;
|
||||
private:
|
||||
float normalizeWithStandardScore(float value, float mean, float sd, glm::vec2 normalizationValues = glm::vec2(1.0f, 1.0f));
|
||||
float unnormalizeWithStandardScore(float value, float mean, float sd, glm::vec2 normalizationValues = glm::vec2(1.0f, 1.0f));
|
||||
//float unnormalizeWithStandardScore(float value, float mean, float sd, glm::vec2 normalizationValues = glm::vec2(1.0f, 1.0f));
|
||||
|
||||
bool _useLog;
|
||||
bool _useHistogram;
|
||||
@@ -101,6 +101,7 @@ private:
|
||||
glm::vec2 _normValues;
|
||||
glm::vec2 _filterValues;
|
||||
|
||||
// Using vectors to store each data option seperatly
|
||||
std::vector<float> _sum;
|
||||
std::vector<float> _standardDeviation;
|
||||
std::vector<float> _numValues;
|
||||
|
||||
@@ -67,6 +67,7 @@ void DataProcessorJson::addDataValues(const std::string& data, const properties:
|
||||
int numOptions = dataOptions.options().size();
|
||||
initializeVectors(numOptions);
|
||||
|
||||
// parse json and calculate min, max and sum
|
||||
if(!data.empty()){
|
||||
json j = json::parse(data);
|
||||
json variables = j["variables"];
|
||||
|
||||
@@ -334,6 +334,7 @@ void IswaManager::createIswaCygnet(std::shared_ptr<MetadataFuture> metadata){
|
||||
}
|
||||
}
|
||||
metadata->name = metadata->group + "_" + metadata->name;
|
||||
|
||||
// create the luaTable for script
|
||||
std::string luaTable = _luaConverter.toLuaTable(metadata);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user