Skip to content

Commit

Permalink
fix __str__ for wcs with a None transform (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Feb 27, 2024
1 parent eb9d316 commit e108dde
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

- Add a minimum version requirement for ``asdf-wcs-schemas``. [#488]

- Fix ``WCS.__str__`` for instances without transforms. [#489]

0.20.0 (2023-11-29)
-------------------

Expand Down
5 changes: 5 additions & 0 deletions gwcs/tests/test_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,3 +1316,8 @@ def test_spatial_spectral_stokes():
assert_allclose(gw_sky.data.lat, aw_sky.data.lat)
assert_allclose(gw_spec.value, aw_spec.value)
assert_allclose(gw_stokes.value, aw_stokes.value)


def test_wcs_str():
w = wcs.WCS(output_frame="icrs")
assert 'icrs' in str(w)
6 changes: 3 additions & 3 deletions gwcs/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,13 +1338,13 @@ def _get_axes_indices(self):
def __str__(self):
from astropy.table import Table

#col1 = [item[0] for item in self._pipeline]
col1 = [step.frame for step in self._pipeline]
col2 = []
for item in self._pipeline[: -1]:
#model = item[1]
model = item.transform
if model.name is not None:
if model is None:
col2.append(None)
elif model.name is not None:
col2.append(model.name)
else:
col2.append(model.__class__.__name__)
Expand Down

0 comments on commit e108dde

Please sign in to comment.