Skip to content

Commit

Permalink
Merge c539e33 into dff97f9
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich committed Jun 11, 2020
2 parents dff97f9 + c539e33 commit cfa62ba
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions spectral_cube/dask_spectral_cube.py
Expand Up @@ -597,7 +597,7 @@ def std(self, axis=None, ddof=0, **kwargs):

@projection_if_needed
@ignore_warnings
def mad_std(self, axis=None, **kwargs):
def mad_std(self, axis=None, ignore_nan=True, **kwargs):
"""
Use astropy's mad_std to compute the standard deviation
"""
Expand All @@ -608,11 +608,14 @@ def mad_std(self, axis=None, **kwargs):
# In this case we have to load the full data - even dask's
# nanmedian doesn't work efficiently over the whole array.
self._warn_slow('mad_std')
return stats.mad_std(data, **kwargs)
return stats.mad_std(data, ignore_nan=ignore_nan, **kwargs)
else:
# Rechunk so that there is only one chunk along the desired axis
data = data.rechunk([-1 if i == axis else 'auto' for i in range(3)])
return self._compute(data.map_blocks(stats.mad_std, drop_axis=axis, axis=axis, **kwargs))
return self._compute(data.map_blocks(stats.mad_std, drop_axis=axis,
axis=axis,
ignore_nan=ignore_nan,
**kwargs))

@projection_if_needed
@ignore_warnings
Expand Down

0 comments on commit cfa62ba

Please sign in to comment.