-
Notifications
You must be signed in to change notification settings - Fork 115
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
Updated convolve_with_slit with warnings if instrumental function has large near-zero wings #283
Conversation
@@ -714,15 +787,27 @@ def get_FWHM(w, I, return_index=False): | |||
""" | |||
# TODO: Linearly interpolate at the boundary? insignificant for large number of points | |||
|
|||
upper = np.argwhere(I >= I.max() / 2) | |||
half = I.max() / 2 | |||
I_offset = I - half |
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 do not understand why it's needed : the slit is zero on the sides.
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 steps makes interpolation easier conceptually to find the FWHM by solving the question "when do my graph crosses the y=0 axis". The function get_FWHM assumes the slit to have only 1 peak and to go to zero monotously away from the peak. You can modify it if you want, to find the y=half - but then you have to change the helper function get_zero as well (should be easy).
I don't think I understood your comment. This function doesn't look at the sides of the slit here. It looks at the FWHM, so close to the center of the slit.
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 have just implemented the TODO XD
TODO: Linearly interpolate at the boundary? insignificant for large number of points
Codecov Report
@@ Coverage Diff @@
## develop #283 +/- ##
========================================
Coverage 75.24% 75.25%
========================================
Files 119 119
Lines 14273 14284 +11
========================================
+ Hits 10740 10749 +9
- Misses 3533 3535 +2 |
…unction, modified doc of spectrum to point to the doc of convolve_with_wlit
Co-authored-by: Erwan Pannier <erwan.pannier@gmail.com>
updated warnings on convolve_with slit and the documentaiton of the function, modified doc of spectrum to point to the doc of convolve_with_wlit
Description
PR in order to update the documentation and the errors of radis.tools.slit.py convolve_with_slit.
Convolution intervene in mainly 2 places:
I did my best to explain to the user what to expect out of the convolution product in the case of intrumental functions.
It is important to tell users how convolution could affect data outside of the know spectral range.
I modified apply_slit to point to the Notes I wrote in convolve_with_slit.
I transformed the AssertError of convolve with slit with several warnings, that look both at the spectral range and the FWHM of the input experimental slit. IMO, it will better guide users to what they should do in order to improve the output of the convolution.