Bugfix: ensure flux dtype passed to medfilt is supported #1156
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
specutils'
median_smooth
method passes theSpectrum1D.flux
attribute to scipy'smedfilt
method.medfilt
only supports a few dtypes, but theSpectrum1D
parser doesn't normalize the dtype of the fluxes.astropy/astropy-workshop#241 is failing on calling
median_smooth
because the SDSS spectrum at this URL gets read into a numpy array with dtype>f4
, which is not one of the supported dtypes inmedfilt
.This PR tries to catch fluxes that are not supported and cast them to floats before passing them to
medfilt
. I've added a test that makes sure a few dtypes are supported.