radis.test.tools.test_slit module

Test slit methods

Examples

Run all tests:

pytest       (in command line, in project folder)

Run only fast tests (i.e: tests that have a ‘fast’ label):

pytest -m fast

dirac(w0, width=20, wstep=0.009)[source]

Return a Dirac in w0. Plus some space on the side

linear_dispersion(w, f=750, phi=- 6, m=1, gr=300)[source]

dlambda / dx Default values correspond to Acton 750i

Parameters
  • f (focal length (mm)) – default 750 (SpectraPro 2750i)

  • phi (angle in degrees (°)) – default 9

  • m (order of dispersion) – default 1

  • gr (grooves spacing (gr/mm)) – default 300

test_against_specair_convolution(plot=True, close_plots=True, verbose=True, debug=False, *args, **kwargs)[source]
test_all_slit_shapes(FWHM=0.4, verbose=True, plot=True, close_plots=True, *args, **kwargs)[source]

Test all slit generation functions and make sure we get the expected FWHM

test_auto_correct_dispersion(verbose=True, plot=True, close_plots=True, *args, **kwargs)[source]

A test case to show the effect of wavelength dispersion (cf spectrometer reciprocal function) on the slit function

Test succeeds if there is a difference between convoluted spectra (with and without slit dispersion)

test_convoluted_quantities_units(*args, **kwargs)[source]

Test that units are correctly convoluted after convolution

test_cut_slices(verbose=True, plot=True, close_plots=True, *args, **kwargs)[source]

A test case to verify that _cut_slices does cut the spectrum into slices

Test fails if a SlitDispersionWarning is triggered and succeeds if the spectrum is sliced into 8 segments.

test_linear_dispersion_effect(verbose=True, plot=True, close_plots=True, *args, **kwargs)[source]

A test case to show the effect of wavelength dispersion (cf spectrometer reciprocal function) on the slit function

Test succeeds if a SlitDispersionWarning is correctly triggered and if the FWHM is properly dilated.

test_normalisation_mode(plot=True, close_plots=True, verbose=True, *args, **kwargs)[source]

Test norm_by = ‘area’ vs norm_by = ‘max’

test_resampling(rtol=0.01, verbose=True, plot=True, warnings=True, *args, **kwargs)[source]

Test what happens when a spectrum in nm or cm-1, is convolved with a slit function in nm. In particular, slit function is generated in the spectrum unit, and spectrum is resampled if not evenly spaced

test_slit_energy_conservation(verbose=True, plot=True, close_plots=True, *args, **kwargs)[source]

Convoluted and non convoluted quantities should have the same area (difference arises from side effects if the initial spectrum is not 0 on the sides

test_slit_unit_conversions_spectrum_in_cm(verbose=True, plot=True, close_plots=True, *args, **kwargs)[source]

Test that slit is consistently applied for different units

Assert that:

  • calculated FWHM is the one that was applied

test_slit_unit_conversions_spectrum_in_nm(verbose=True, plot=True, close_plots=True, *args, **kwargs)[source]

Test that slit is consistently applied for different units

Assert that:

  • calculated FWHM is the one that was applied