Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: ensure flux dtype passed to medfilt is supported #1156

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

bmorris3
Copy link
Contributor

@bmorris3 bmorris3 commented Jul 22, 2024

specutils' median_smooth method passes the Spectrum1D.flux attribute to scipy's medfilt method. medfilt only supports a few dtypes, but the Spectrum1D 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 in medfilt.

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.

Copy link
Contributor

@rosteen rosteen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failures are unrelated, thanks for the fix!

@rosteen rosteen merged commit f5e708c into astropy:main Jul 23, 2024
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants