Skip to content

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

Description

@TranHuuNhatHuy

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions