From 0d89371119be2ca5f42bf12458d9ce5f8bd484cf Mon Sep 17 00:00:00 2001 From: DanRyanIrish Date: Tue, 6 Oct 2020 09:38:22 -0400 Subject: [PATCH 1/3] Change NDCube method name to axis_world_coords_values. --- ndcube/ndcube.py | 2 +- ndcube/tests/test_ndcube.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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..a59e25606 100644 --- a/ndcube/tests/test_ndcube.py +++ b/ndcube/tests/test_ndcube.py @@ -888,7 +888,7 @@ def test_ndcubeordered(test_input, expected): ((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 @@ -898,8 +898,8 @@ def test_all_world_coords_with_input(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)) ]) -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 @@ -917,8 +917,8 @@ def test_all_world_coords_with_input_and_kwargs(test_input, expected): [1.26918126e-05, 5.00000000e-01, 9.99987308e-01]], unit=u.deg))) ]) -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 From dfc4035a36e3c4a54826a897e9837d757c8c465d Mon Sep 17 00:00:00 2001 From: DanRyanIrish Date: Fri, 9 Oct 2020 08:48:31 -0400 Subject: [PATCH 2/3] Add changelog to PR #293. --- changelog/293.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/293.bugfix.rst 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 From 262907c261595a00ef1b6548d86f54c42923a5ae Mon Sep 17 00:00:00 2001 From: DanRyanIrish Date: Fri, 9 Oct 2020 09:28:53 -0400 Subject: [PATCH 3/3] Fix expected output of unit test. --- ndcube/tests/test_ndcube.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ndcube/tests/test_ndcube.py b/ndcube/tests/test_ndcube.py index a59e25606..c6ae498ec 100644 --- a/ndcube/tests/test_ndcube.py +++ b/ndcube/tests/test_ndcube.py @@ -884,8 +884,8 @@ 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_values(*test_input[1]) @@ -895,8 +895,8 @@ def test_all_world_coords_with_input(test_input, expected): @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_coord_values_with_input_and_kwargs(test_input, expected): all_coords = test_input[0].axis_world_coords_values(*test_input[1], **{"edges": True}) @@ -915,7 +915,8 @@ def test_all_world_coord_values_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_values_without_input(test_input, expected): all_coords = test_input.axis_world_coords_values()