def test_index_coords_non_centeral(diffraction_pattern_one_dimension): xc, yc = _index_coords(diffraction_pattern_one_dimension.data, origin=(0, 0)) assert xc[0, 0] == 0 assert yc[0, 0] == 0 assert xc[0, 5] == 5 assert yc[0, 5] == 0
def test_index_coords(dp_single): x = np.array( [ [-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0], [-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0], [-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0], [-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0], [-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0], [-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0], [-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0], [-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0], ] ) y = np.array( [ [-4.0, -4.0, -4.0, -4.0, -4.0, -4.0, -4.0, -4.0], [-3.0, -3.0, -3.0, -3.0, -3.0, -3.0, -3.0, -3.0], [-2.0, -2.0, -2.0, -2.0, -2.0, -2.0, -2.0, -2.0], [-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0], [3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0], ] ) xc, yc = _index_coords(dp_single.data) np.testing.assert_almost_equal(xc, x) np.testing.assert_almost_equal(yc, y)
def test_index_coords(diffraction_pattern_one_dimension): x = np.array([[-4., -3., -2., -1., 0., 1., 2., 3.], [-4., -3., -2., -1., 0., 1., 2., 3.], [-4., -3., -2., -1., 0., 1., 2., 3.], [-4., -3., -2., -1., 0., 1., 2., 3.], [-4., -3., -2., -1., 0., 1., 2., 3.], [-4., -3., -2., -1., 0., 1., 2., 3.], [-4., -3., -2., -1., 0., 1., 2., 3.], [-4., -3., -2., -1., 0., 1., 2., 3.]]) y = np.array([[-4., -4., -4., -4., -4., -4., -4., -4.], [-3., -3., -3., -3., -3., -3., -3., -3.], [-2., -2., -2., -2., -2., -2., -2., -2.], [-1., -1., -1., -1., -1., -1., -1., -1.], [0., 0., 0., 0., 0., 0., 0., 0.], [1., 1., 1., 1., 1., 1., 1., 1.], [2., 2., 2., 2., 2., 2., 2., 2.], [3., 3., 3., 3., 3., 3., 3., 3.]]) xc, yc = _index_coords(diffraction_pattern_one_dimension.data) np.testing.assert_almost_equal(xc, x) np.testing.assert_almost_equal(yc, y)
def test_index_coords_non_centeral(dp_single): xc, yc = _index_coords(dp_single.data, origin=(0, 0)) assert xc[0, 0] == 0 assert yc[0, 0] == 0 assert xc[0, 5] == 5 assert yc[0, 5] == 0
def test_function(diffraction_pattern): ref = ScalableReferencePattern(diffraction_pattern) x, y = _index_coords(diffraction_pattern.data) func = ref.function(x=x, y=y) np.testing.assert_almost_equal(func, diffraction_pattern.data)