Skip to content

Commit

Permalink
Merge pull request #385 from spacetelescope/0.17.1x
Browse files Browse the repository at this point in the history
0.17.1x
  • Loading branch information
nden committed Nov 27, 2021
2 parents 55d5b8f + e747e34 commit e8a5ecf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
0.17.1 (2021-11-27)
-------------------

Bug Fixes
^^^^^^^^^

- Fixed a bug with StokesProfile and array types. [#384]


0.17.0 (2021-11-17)
-------------------
Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions gwcs/coordinate_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,11 +731,11 @@ def from_index(cls, indexes):
"""

nans = np.isnan(indexes)
indexes = np.asanyarray(indexes, dtype=int)
indexes = np.asarray(indexes, dtype=int)
out = np.empty_like(indexes, dtype=object)

for profile, index in cls.profiles.items():
out[indexes == index] = profile
out[indexes == index] = cls(profile)

out[nans] = np.nan

Expand Down
3 changes: 3 additions & 0 deletions gwcs/tests/test_coordinate_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ def test_stokes_frame():
assert sf.coordinate_to_quantity('I') == 0 * u.one
assert sf.coordinate_to_quantity(0) == 0

def test_stokes_profile():
assert (cf.StokesProfile.from_index(np.arange(-8, 4) * u.one) == np.array(['YX', 'XY', 'YY,', 'XX', 'LR', 'RL', 'LL', 'RR', 'I', 'Q', 'U', 'V'], dtype="U2")).all()


@pytest.mark.parametrize('inp', [
(211 * u.AA, 0 * u.s, 0 * u.one, 0 * u.one),
Expand Down

0 comments on commit e8a5ecf

Please sign in to comment.