Ticket #9222 (closed)
Interpolation Bug
Reported by: | Owen Arnold | Owned by: | Owen Arnold |
---|---|---|---|
Priority: | critical | Milestone: | Release 3.2 |
Component: | Framework | Keywords: | PatchCandidate |
Cc: | Blocked By: | ||
Blocking: | Tester: |
Description
From Michael Wedel via mantid help:
Hi,
I was using Kernel::Interpolation and I think I discovered a small bug in Interpolation::value(), line 54. This line covers the case of values above the upper interpolation interval limit.
Currently the line reads:
return m_y[N-1]+(at-m_y[N-1])*(m_y[N-1]-m_y[N-2])/(m_x[N-1]-m_x[N-2]);
I think it should read:
return m_y[N-1]+(at-m_x[N-1])*(m_y[N-1]-m_y[N-2])/(m_x[N-1]-m_x[N-2]);
Making this change breaks InterpolationTest::test1():
Line 31: TS_ASSERT_DELTA( interpolation.value(3000), 260400.0 ,0.000000001);
The test should then be adjusted like this:
Line 31: TS_ASSERT_DELTA( interpolation.value(3000), 28000.0 ,0.000000001); Line 52: TS_ASSERT_DELTA( interpolation.value(3000), 28000.0 ,0.000000001);
I think this is just a typo, since subtracting a y-value from an x-value would not make much sense and in all other cases in that method, x values are subtracted from other x-values. Tomorrow I could write the changes and open a pull-request on github.
Change History
comment:2 Changed 7 years ago by Owen Arnold
- Status changed from assigned to closed
Merge branch 'feature/9222_interpolation_defect'
Full changeset: d1d28a9a33437c2588cc138ee175b78c754e2aa8