Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/293.bugfix.rst
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion ndcube/ndcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
21 changes: 11 additions & 10 deletions ndcube/tests/test_ndcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down