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

apply_slit() returns error in co2-4080-4500 example #32

Open
TranHuuNhatHuy opened this issue Apr 1, 2022 · 2 comments
Open

apply_slit() returns error in co2-4080-4500 example #32

TranHuuNhatHuy opened this issue Apr 1, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@TranHuuNhatHuy
Copy link
Contributor

TranHuuNhatHuy commented Apr 1, 2022

In this example of Comparing line-of-sight CO2 with experiments, executed by a https://notebooks.gesis.org/ binder on radis-lab, when running this cell:

from radis.test.tools.test_slit import linear_dispersion
dispersion = lambda w: linear_dispersion(w, 756, phi=-6.91, m=1, gr=297.42) # Reciprocal linear dispersion of the Acton 750i
s_los.apply_slit("slit_function.txt", slit_dispersion=dispersion)

An AssertionError appears:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
/tmp/ipykernel_735/2481538297.py in <module>
      1 from radis.test.tools.test_slit import linear_dispersion
      2 dispersion = lambda w: linear_dispersion(w, 756, phi=-6.91, m=1, gr=297.42) # Reciprocal linear dispersion of the Acton 750i
----> 3 s_los.apply_slit("slit_function.txt", slit_dispersion=dispersion)

/srv/conda/envs/notebook/lib/python3.8/site-packages/radis/spectrum/spectrum.py in apply_slit(self, slit_function, unit, shape, center_wavespace, norm_by, mode, plot_slit, store, slit_dispersion, slit_dispersion_threshold, auto_recenter_crop, verbose, inplace, *args, **kwargs)
   2729                 self._q["wavespace"], w_conv
   2730             ):
-> 2731                 raise AssertionError(
   2732                     "Wavespace of convolved arrays is different, cannot store it in the same Spectrum. You can use Spectrum.apply_slit(inplace=False) to return a new spectrum with only the convolved arrays"
   2733                 )

AssertionError: Wavespace of convolved arrays is different, cannot store it in the same Spectrum. You can use Spectrum.apply_slit(inplace=False) to return a new spectrum with only the convolved arrays

It is worth mentioning that same AssertiveError message pops up when this cell, also uses apply_slit(), is being run:

s.apply_slit("slit_function.txt", slit_dispersion=dispersion)
s.plot(wunit='nm')
             
s_los.plot(wunit='nm', nfig='same')

#import matplotlib.pyplot as plt
#plt.xlim((4165, 4180))

Currently, adding argument inplace=False into the function seems to prevent the error from showing up and let the function run normally.

@erwanp
Copy link
Member

erwanp commented Apr 2, 2022

Thanks for finding this one ! Can you open an issue on https://github.com/radis/radis refering to here ?

@CorentinGrimaldi do you time to have a look ? Else I can !

@erwanp
Copy link
Member

erwanp commented Apr 2, 2022

Done there radis/radis#440, thank you @TranHuuNhatHuy

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

No branches or pull requests

2 participants