Skip to content

Commit

Permalink
Refs #5224. Ignoring nans in algorithm for both paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed May 3, 2012
1 parent e0b3e80 commit 2569369
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/Rebin2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The algorithms currently requires the second axis on the workspace to be a numer
#include "MantidGeometry/Math/Quadrilateral.h"
#include "MantidGeometry/Math/LaszloIntersection.h"

#include <boost/math/special_functions/fpclassify.hpp>

namespace Mantid
{
namespace Algorithms
Expand Down Expand Up @@ -198,11 +200,16 @@ namespace Mantid
const V2D ul(X[ei], vhi);
const Quadrilateral outputQ(ll, lr, ur, ul);

double yValue = inputWS->readY(i)[j];
if (boost::math::isnan(yValue))
{
continue;
}
try
{
ConvexPolygon overlap = intersectionByLaszlo(outputQ, inputQ);
const double weight = overlap.area()/inputQ.area();
double yValue = inputWS->readY(i)[j] * weight;
yValue *= weight;
double eValue = inputWS->readE(i)[j] * weight;
const double overlapWidth = overlap.largestX() - overlap.smallestX();
if(inputWS->isDistribution())
Expand Down Expand Up @@ -254,11 +261,16 @@ namespace Mantid
const V2D ul(X[ei], vhi);
const Quadrilateral outputQ(ll, lr, ur, ul);

double yValue = inputWS->readY(i)[j];
if (boost::math::isnan(yValue))
{
continue;
}
try
{
ConvexPolygon overlap = intersectionByLaszlo(outputQ, inputQ);
const double weight = overlap.area()/inputQ.area();
double yValue = inputWS->readY(i)[j] * weight;
yValue *= weight;
double eValue = inputWS->readE(i)[j] * weight;
const double overlapWidth = overlap.largestX() - overlap.smallestX();
if(inputWS->isDistribution())
Expand Down

0 comments on commit 2569369

Please sign in to comment.