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

Truncate in template_comparison by default rather than nan_fill #1121

Merged
merged 9 commits into from
Feb 9, 2024

Conversation

rosteen
Copy link
Contributor

@rosteen rosteen commented Feb 2, 2024

Implements the suggestion given in #653. One thing I changed here, which I'm not sure of, is that the returned template is now resampled onto the observed spectrum's spectral axis, in addition to being normalized as previous. Opening as draft since I still need to update the docs, and I'll probably need to add a bit more test coverage.

@rosteen rosteen marked this pull request as ready for review February 5, 2024 19:19
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (17a6f6b) 70.93% compared to head (727b4b7) 71.07%.

Files Patch % Lines
specutils/analysis/template_comparison.py 88.46% 3 Missing ⚠️
specutils/manipulation/resample.py 92.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1121      +/-   ##
==========================================
+ Coverage   70.93%   71.07%   +0.14%     
==========================================
  Files          61       61              
  Lines        4221     4249      +28     
==========================================
+ Hits         2994     3020      +26     
- Misses       1227     1229       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rosteen rosteen added enhancement analysis Spectral analysis/measurement tools labels Feb 5, 2024
@rosteen rosteen added this to the v1.x milestone Feb 5, 2024
@pllim pllim requested a review from camipacifici February 6, 2024 14:22
Copy link

@camipacifici camipacifici left a comment

Choose a reason for hiding this comment

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

Tested now. I see it uses only the region of overlap between the template and the observed spectrum to calculate the chi^2, but it also returns the template only in the overlapping region, while it would be useful to get out the full original template properly redshifted and normalized. Here are two screenshots: one shows the observed spectrum and one of the template in its full range; the other shows the observed spectrum and the selected template after template_comparison.
Screenshot 2024-02-06 at 12 03 46 PM
Screenshot 2024-02-06 at 12 03 56 PM

@rosteen
Copy link
Contributor Author

rosteen commented Feb 6, 2024

@camipacifici Thanks for the comment, I reverted back to returning the full template. I also fixed an existing bug in the redshifting so that it will now work on any unit of spectral axis (e.g., frequency), not just wavelengths.

Copy link

@camipacifici camipacifici left a comment

Choose a reason for hiding this comment

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

Functionality looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analysis Spectral analysis/measurement tools enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants