Skip to content
Snippets Groups Projects
Commit c29dd916 authored by Matt King's avatar Matt King
Browse files

Increased tolerance value to fix precision issue

Refs #13508
parent 0e5ce7fa
No related branches found
No related tags found
No related merge requests found
......@@ -30,34 +30,14 @@ createPBinStringVector(std::vector<Mantid::coord_t> minVector,
"maximum extent with non-zero signal"
<< std::endl;
}
// We are working with Centres and not Bin Edges so we know that we will
// always be half a bin width away from the closest bin edge.
// We will only crop when we set minimum pbin > minimum extent of that
// dimension
// otherwise we should not crop.
if (minVector[iter] - (inputWs->getDimension(iter)->getBinWidth() * 0.5) >
inputWs->getDimension(iter)->getMinimum()) {
minVector[iter] = Mantid::coord_t(
minVector[iter] - (inputWs->getDimension(iter)->getBinWidth() * 0.5));
}
// We will only crop when we set maximum pbin < maximum extent of that
// dimension
// otherwise we should not crop.
if (maxVector[iter] + (inputWs->getDimension(iter)->getBinWidth() * 0.5) <
inputWs->getDimension(iter)->getMaximum()) {
maxVector[iter] = Mantid::coord_t(
maxVector[iter] + (inputWs->getDimension(iter)->getBinWidth() * 0.5));
}
// when Min == Max we know that there is no signal inside that dimension
// so just use the original extents to copy that dimension.
if (minVector[iter] == maxVector[iter]) {
minVector[iter] = inputWs->getDimension(iter)->getMinimum();
maxVector[iter] = inputWs->getDimension(iter)->getMaximum();
}
// creating pbin string using Min and Max Centre positions
auto pBinStr = boost::lexical_cast<std::string>(minVector[iter]) + ",0," +
boost::lexical_cast<std::string>(maxVector[iter]);
auto pBinStr = boost::lexical_cast<std::string>(
minVector[iter] -
(inputWs->getDimension(iter)->getBinWidth() * 0.5)) +
",0," +
boost::lexical_cast<std::string>(
maxVector[iter] +
(inputWs->getDimension(iter)->getBinWidth() * 0.5));
pBinStrVector.push_back(pBinStr);
}
return pBinStrVector;
......
......@@ -104,7 +104,7 @@ Mantid::coord_t getPrecisionCorrectedCoordinate(Mantid::coord_t position,
// Check if the relative deviation is larger than 1e-6
const auto deviation = fabs((nearest - position) / binWidth);
const auto tolerance = 1e-6;
const auto tolerance = 1e-5;
Mantid::coord_t coordinate(position);
if (deviation < tolerance) {
coordinate = nearest;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment