Some updates to specutils.analysis functions #937
Merged
+12
−8
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.
_normalize_for_template_matching()
: changednp.sum
tonp.nansum
on lines 60 and 61. Due to resampling of the spectra (resampling methods fill arrays with NaNs to have points beyond the edges set to NaN), all redshifts compared intemplate_redshift()
were producing achi2
of NaN (even for a test case using the correct redshift)._chi_square_for_templates()
: changednp.sum
tonp.nansum
on line 137 for the same reason as above.template_redshift()
: Addedfinal_spectrum = redshifted_spectrum
on line 292 and addedfinal_spectrum
to return instead ofredshifted spectrum
. This is important specifically for if you feed a list of redshifts - the function was not returning the spectrum redshifted by the best-fitting redshift (i.e. the one corresponding tochi2_min
), but rather was returning the spectrum redshifted by the last redshift in the list (not necessarily the best-fitting one).