def test_squeeze(self): x = np.linspace(0, 4 * np.pi, 101) ** (1.3) h = np.sin(x) surface = NonuniformLineScan(x, h).scale(2.0) surface2 = surface.squeeze() self.assertTrue(isinstance(surface2, NonuniformLineScan)) np.testing.assert_allclose(surface.positions(), surface2.positions()) np.testing.assert_allclose(surface.heights(), surface2.heights())
def test_positions_and_heights(self): x = np.array((0, 1, 1.5, 2, 3)) h = 2 * x t = NonuniformLineScan(x, h) assert_array_equal(t.heights(), h) assert_array_equal(t.positions(), x) x2, h2 = t.positions_and_heights() assert_array_equal(x2, x) assert_array_equal(h2, h)