def test_positions_and_heights(self): h = np.array((0, 1, 2, 3, 4)) t = UniformLineScan(h, 4) assert_array_equal(t.heights(), h) expected_x = np.array((0., 0.8, 1.6, 2.4, 3.2)) np.testing.assert_allclose(t.positions(), expected_x) x2, h2 = t.positions_and_heights() np.testing.assert_allclose(x2, expected_x) assert_array_equal(h2, h)
def test_detrend_same_positions(self): """asserts that the detrended topography has the same x """ n = 10 dx = 0.5 h = np.random.normal(size=n) t = UniformLineScan(h, dx * n) for mode in ["curvature", "slope", "height"]: detrended = t.detrend(detrend_mode=mode) np.testing.assert_allclose(detrended.positions(), t.positions()) np.testing.assert_allclose(detrended.positions_and_heights()[0], t.positions_and_heights()[0])