Skip to content

Commit

Permalink
Re #6267 & Re #6152. Fix stop time for left-aligned time boundaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellTaylor committed Dec 4, 2012
1 parent 0aa7d3d commit 12e197a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
22 changes: 5 additions & 17 deletions Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp
Expand Up @@ -484,26 +484,14 @@ namespace Mantid

if (isGood)
{
//Start of a good section
if (centre)
start = t - tol;
else
start = t;
// Start of a good section. Subtract tolerance from the time if boundaries are centred.
start = centre ? t - tol : t;
}
else
{
//End of the good section
if (numgood == 1 || centre )
{
// If there was only one point with the value, or values represent bin centres,
// use the last good time, + the tolerance, as the end time
stop = lastTime + tol;
}
else
{
// At least 2 good values for left boundary aligned logs. Save the end time.
stop = t;
}
// End of the good section. Add tolerance to the LAST GOOD time if boundaries are centred.
// Otherwise, use the first 'bad' time.
stop = centre ? lastTime + tol : t;
split.push_back( SplittingInterval(start, stop, 0) );
//Reset the number of good ones, for next time
numgood = 0;
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Kernel/test/TimeSeriesPropertyTest.h
Expand Up @@ -373,7 +373,7 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite
s = splitter[0];
t = DateAndTime("2007-11-30T16:17:10");
TS_ASSERT_DELTA( s.start(), t, 1e-3);
t = DateAndTime("2007-11-30T16:17:11");
t = DateAndTime("2007-11-30T16:17:20");
TS_ASSERT_DELTA( s.stop(), t, 1e-3);

s = splitter[1];
Expand Down

0 comments on commit 12e197a

Please sign in to comment.