Skip to content

Commit

Permalink
Fix failing newview (#886)
Browse files Browse the repository at this point in the history
* fix parameter syntax error introduced in PR 883

* pass kwargs to avoid _new_view kwarg error

---------

Co-authored-by: Trey Wenger <[email protected]>
  • Loading branch information
keflavich and tvwenger authored Jun 23, 2023
1 parent 89b742e commit c4f70e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions spectral_cube/lower_dimensional_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ class LowerDimensionalObject(u.Quantity, BaseNDClass, HeaderMixinClass):
Generic class for 1D and 2D objects.
"""

def _new_view(self, obj=None, unit=None, finalize=True):
def _new_view(self, obj=None, unit=None, finalize=True, **kwargs):
"""
kwargs are passed to _new_view of other object; only known keyword as of June 2023 is ``propagate_info``
"""
# FORCE finalization to hack around https://github.com/astropy/astropy/issues/14514#issuecomment-1463935711
try:
return super(LowerDimensionalObject, self)._new_view(obj=obj, unit=unit, finalize=True)
return super(LowerDimensionalObject, self)._new_view(obj=obj, unit=unit, finalize=True, **kwargs)
except TypeError:
return super(LowerDimensionalObject, self)._new_view(obj=obj, unit=unit)
return super(LowerDimensionalObject, self)._new_view(obj=obj, unit=unit, **kwargs)

@property
def hdu(self):
Expand Down
2 changes: 1 addition & 1 deletion spectral_cube/masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def _filled(self, data, wcs=None, fill=np.nan, view=(), use_memmap=False,
"""
# Must convert to floating point, but should not change from inherited
# type otherwise
dt = np.result_type([data.dtype, 0.0])
dt = np.result_type(data.dtype, 0.0)

if use_memmap and data.size > 0:
ntf = tempfile.NamedTemporaryFile()
Expand Down

0 comments on commit c4f70e3

Please sign in to comment.