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

use astropy modeling units in fit_lines #891

Merged
merged 6 commits into from
Nov 2, 2021

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Oct 22, 2021

This pull request makes use of the new support for units within astropy modeling (introduced in astropy 4.0, specutils already requires 4.1+) and in doing so removes the need for significant code that handled stripping and re-adding units internally.

Edit: apparently not all models in astropy support being fitted with units, so perhaps we can't entirely get rid of the internal stripping/re-adding for all cases.

* units in models were added in astropy 4.0 and specutils now requires astropy 4.1+
* no longer need to strip and re-add units or have a custom QuantityModel
* if model in astropy does not support units, then use previous specutils implementation of stripping units, re-adding units, and returning a QuantityModel,
@kecnry kecnry marked this pull request as ready for review October 22, 2021 17:19
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.

Looks good, thanks!

window_indices = np.nonzero((spectrum.spectral_axis >= center-window) &
(spectrum.spectral_axis < center+window))
window_indices = np.nonzero((dispersion >= center-window) &
(dispersion < center+window))
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

@rosteen rosteen merged commit 7de67c8 into astropy:main Nov 2, 2021
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