-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Added in spectrum_from_model #338
Added in spectrum_from_model #338
Conversation
@@ -152,3 +152,42 @@ def excise_region(spectrum, region, exciser=linear_exciser): | |||
# | |||
|
|||
return exciser(spectrum, region) | |||
|
|||
|
|||
def spectrum_from_model(model_input, spectrum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be added to __all__
if it's intended for the public API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
specutils/manipulation/utils.py
Outdated
The input model or compound model from which flux is calculated. | ||
|
||
spectrum : `~specutils.Spectrum1D` | ||
The `~specutils.Spectrum1D` object to which the smoothing will be applied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy-and-paste error? Probably should be "The ~specutils.Spectrum1D
object to use as the model template" or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
specutils/manipulation/utils.py
Outdated
|
||
return Spectrum1D(flux=flux, | ||
spectral_axis=spectrum.spectral_axis, | ||
uncertainty=spectrum.uncertainty, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it makes sense to copy over the uncertainty here - the uncertainty is not the same for the model (in one interpretation it's zeros, and in another it's undefined).
(Should also note this in the docstring)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
A bit more context: this provides an alternative solution to #333 from having the model itself know what to do. We may want this anyway, but its proximate reason is that. |
Since this isn't critical functionality and we're very close, I'm pushing this to 0.5 |
@brechmos Can you rebase this? |
a12efa0
to
d9f96c0
Compare
This is a bit of a helper/utility method that creates a Spectrum1D object from a model given an input spectrum. The output Spectrum1D object will have all the same values as the input Spectrum1D except the flux will be based on the input model.
Fixes #337