New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-10237: fix errors in blendedness calculation #80
Conversation
src/Blendedness.cc
Outdated
@@ -284,6 +279,22 @@ BlendednessAlgorithm::BlendednessAlgorithm(Control const & ctrl, std::string co | |||
} | |||
} | |||
|
|||
float BlendednessAlgorithm::computeAbsExpectation(float data, float variance) { | |||
float normalization = 0.5f*boost::math::erfc(-data/std::sqrt(2.0f*variance)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::erfc available with C++11?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It hadn't occurred to me to check, but it looks like it is. I'll update all the code using the boost version in this file.
tests/testBlendedness.py
Outdated
@@ -24,6 +24,8 @@ | |||
from contextlib import contextmanager | |||
import unittest | |||
|
|||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover import from debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From an older form of the test, yes.
8b7050e
to
3e3366c
Compare
This addresses three problems in the blendedness calculation:
I've also added some new unit tests.