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

Bug report: Slit size depends on the wave range that it is applied on #581

Open
saradelahaie opened this issue Jul 19, 2023 · 8 comments
Open
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@saradelahaie
Copy link

馃悰 Describe the bug

When I apply a slit by giving its FWHM in nm, I get a slit size that changes depending on the used wave range.
image

from radis import calc_spectrum
for w_min in [900, 1600]:
	s = calc_spectrum(w_min * u.nm, 2500 * u.nm,
					  molecule=molecule,
					  isotope='1',
					  pressure=1.01325,  # bar
					  Tgas=T,
					  path_length=1 * u.cm,  # cm
					  mole_fraction=1,
					  databank='hitran'
					  )
	s.apply_slit(slit_size, unit="nm")
	s.take('radiance').plot(nfig=1)
plt.show()

馃挕 Possible solutions

It seems that the problem is solved when translating the slit size to cm-1 (but then, it's not constant over the wave range in cm-1).

馃幉 Radis version

0.14

馃捇 Operating system

Windows

@saradelahaie saradelahaie added the bug Something isn't working label Jul 19, 2023
@saradelahaie saradelahaie changed the title Slit size depends on the wave range that it is applied on Bug report: Slit size depends on the wave range that it is applied on Jul 19, 2023
@erwanp
Copy link
Member

erwanp commented Aug 1, 2023

Possible fixes :

Method 1 :

  • Interpolate the spectrum from the calculated waverange (here: cm-1) to the slit waverange (here : wavelengths)
  • Apply sit
  • Interpolate back to the first waverange

We'll induce small interpolation errors.

Method 2:

  • divide the spectrum in ranges where the slit expressed in cm-1 is approximately constant
  • apply slit on each range, merge

Method 1 sounds easier

@erwanp erwanp added this to the 0.15 milestone Aug 1, 2023
@minouHub
Copy link
Collaborator

minouHub commented Aug 4, 2023

@saradelahaie I hope this issue is not hindering your progress. Let me know if this is the case. Otherwise I'll come back later on this issue (and secretly hope someone will apply Erwan's fix).

@minouHub minouHub added the good first issue Good for newcomers label Mar 30, 2024
@minouHub
Copy link
Collaborator

Labeled "Good first issue" since Erwan provided a method to solve the problem

@minouHub minouHub modified the milestones: 0.15, 0.16 Mar 30, 2024
@tactipus
Copy link

i wanna take a stab at this

@tactipus
Copy link

tactipus commented Apr 4, 2024

I'm looking at this now. Does this bug require knowledge of any advanced mathematics? I confess I only got up to Calc 2...

@minouHub
Copy link
Collaborator

minouHub commented Apr 4, 2024

If you can understand the steps described by Erwan, it means you're good enough at maths :)

@tactipus
Copy link

tactipus commented May 9, 2024

would you kindly explain the "slit_size" variable? cuz the docstring states that there are different ways to handle the "slit_size" parameter depending on the data type.

@minouHub
Copy link
Collaborator

In the example, the slit_size is a float. For instance, you can set it to slit_size=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants