diff --git a/changelog/293.bugfix.rst b/changelog/293.bugfix.rst new file mode 100644 index 000000000..272b33aec --- /dev/null +++ b/changelog/293.bugfix.rst @@ -0,0 +1 @@ +Change name of NDCube.axis_world_coord_values to NDCube.axis_world_coords_values to be consistent with NDCube.axis_world_coords diff --git a/ndcube/ndcube.py b/ndcube/ndcube.py index 8504ecba3..63bf08b7a 100644 --- a/ndcube/ndcube.py +++ b/ndcube/ndcube.py @@ -450,7 +450,7 @@ def axis_world_coords(self, *axes, edges=False): else: return tuple(axes_coords) - def axis_world_coord_values(self, *axes, edges=False): + def axis_world_coords_values(self, *axes, edges=False): """ Returns WCS coordinate values of all pixels for desired axes. diff --git a/ndcube/tests/test_ndcube.py b/ndcube/tests/test_ndcube.py index 7b30e2478..c6ae498ec 100644 --- a/ndcube/tests/test_ndcube.py +++ b/ndcube/tests/test_ndcube.py @@ -884,22 +884,22 @@ def test_ndcubeordered(test_input, expected): @pytest.mark.parametrize("test_input,expected", [ - ((cubem, [2]), u.Quantity([1.02e-09, 1.04e-09, 1.06e-09, 1.08e-09], unit=u.m)), - ((cubem, ['em']), u.Quantity([1.02e-09, 1.04e-09, 1.06e-09, 1.08e-09], unit=u.m)) + ((cubem, [2]), (u.Quantity([1.02e-09, 1.04e-09, 1.06e-09, 1.08e-09], unit=u.m),)), + ((cubem, ['em']), (u.Quantity([1.02e-09, 1.04e-09, 1.06e-09, 1.08e-09], unit=u.m),)) ]) def test_all_world_coords_with_input(test_input, expected): - all_coords = test_input[0].axis_world_coords(*test_input[1]) + all_coords = test_input[0].axis_world_coords_values(*test_input[1]) for i in range(len(all_coords)): np.testing.assert_allclose(all_coords[i].value, expected[i].value) assert all_coords[i].unit == expected[i].unit @pytest.mark.parametrize("test_input,expected", [ - ((cubem, [2]), u.Quantity([1.01e-09, 1.03e-09, 1.05e-09, 1.07e-09, 1.09e-09], unit=u.m)), - ((cubem, ['em']), u.Quantity([1.01e-09, 1.03e-09, 1.05e-09, 1.07e-09, 1.09e-09], unit=u.m)) + ((cubem, [2]), (u.Quantity([1.01e-09, 1.03e-09, 1.05e-09, 1.07e-09, 1.09e-09], unit=u.m),)), + ((cubem, ['em']), (u.Quantity([1.01e-09, 1.03e-09, 1.05e-09, 1.07e-09, 1.09e-09], unit=u.m),)) ]) -def test_all_world_coords_with_input_and_kwargs(test_input, expected): - all_coords = test_input[0].axis_world_coords(*test_input[1], **{"edges": True}) +def test_all_world_coord_values_with_input_and_kwargs(test_input, expected): + all_coords = test_input[0].axis_world_coords_values(*test_input[1], **{"edges": True}) for i in range(len(all_coords)): np.testing.assert_allclose(all_coords[i].value, expected[i].value) assert all_coords[i].unit == expected[i].unit @@ -915,10 +915,11 @@ def test_all_world_coords_with_input_and_kwargs(test_input, expected): [1., 1., 1.]], unit=u.deg), u.Quantity([[1.26915033e-05, 4.99987815e-01, 9.99962939e-01], [1.26918126e-05, 5.00000000e-01, 9.99987308e-01]], - unit=u.deg))) + unit=u.deg), + u.Quantity([1.02e-09], unit=u.m))) ]) -def test_axis_world_coords_without_input(test_input, expected): - all_coords = test_input.axis_world_coords() +def test_axis_world_coords_values_without_input(test_input, expected): + all_coords = test_input.axis_world_coords_values() for i in range(len(all_coords)): np.testing.assert_allclose(all_coords[i].value, expected[i].value) assert all_coords[i].unit == expected[i].unit