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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slit dispersion bug over large spectral range #218

Closed
CorentinGrimaldi opened this issue Apr 1, 2021 · 0 comments 路 Fixed by #219
Closed

Slit dispersion bug over large spectral range #218

CorentinGrimaldi opened this issue Apr 1, 2021 · 0 comments 路 Fixed by #219
Labels
bug Something isn't working
Milestone

Comments

@CorentinGrimaldi
Copy link
Collaborator

馃悰 Describe the bug

When applying a slit function with a slit dispersion function to a spectrum calculated over a large spectral range, there is a bug in the quantities modified by the (changing) slit.
This is specially visible for the transmittance plot.

This is probably due to an error with the gestion of the boundaries during the convolution of the slit function with the spectral quantity.

馃枼 Steps To Reproduce

Calculate a spectrum, for example H2O between 1000 and 1100 nm, apply a slit function whith a slit dispersion function and plot any quantity modified by the slit function. The bug is particularly visible for the transmittance.

from radis import calc_spectrum
import numpy as np

def slit_dispersion(w):
    phi = -6.33
    f = 750
    gr = 600
    m = 1
    phi *= -2*np.pi/360
    d = 1e-3/gr
    disp = w/(2*f)*(-np.tan(phi)+np.sqrt((2*d/m/(w*1e-9)*np.cos(phi))**2-1))
    return disp  # nm/mm


spec_h2o = calc_spectrum(wavelength_min=1000,
                         wavelength_max=1100,
                         Tgas=300,
                         molecule='H2O',
                         isotope='1',
                         )

spec_h2o.apply_slit(1, slit_dispersion=slit_dispersion)
spec_h2o.plot('transmittance')

馃挕 Possible solutions

Change the mode in the apply_slit() function.

@CorentinGrimaldi CorentinGrimaldi added the bug Something isn't working label Apr 1, 2021
CorentinGrimaldi added a commit to CorentinGrimaldi/radis that referenced this issue Apr 1, 2021
By transmitting the mode to the convolve function (default is valid) and removing boundaries only if the mode is different than valid.
@erwanp erwanp linked a pull request Apr 1, 2021 that will close this issue
CorentinGrimaldi added a commit to CorentinGrimaldi/radis that referenced this issue Apr 1, 2021
erwanp added a commit that referenced this issue Apr 1, 2021
Fix issue #218 (Slit dispersion bug over large spectral range)
@erwanp erwanp added this to the 0.9.30 milestone May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants