Exemple #1
0
def test_intensity_conversion(verbose=True, *args, **kwargs):
    """Test conversion of intensity cm-1 works:

    - conversion of mW/sr/cm2/nm -> mW/sr/cm2/cm-1

    """

    from radis import planck, planck_wn

    w_nm = linspace(300, 3000)
    w_cm = nm2cm(w_nm)
    I_nm = planck(w_nm, T=6000, unit="mW/sr/cm2/nm")

    s = calculated_spectrum(
        w_nm,
        I_nm,
        wunit="nm_vac",
        Iunit="mW/sr/cm2/nm",
    )
    # mW/sr/cm2/nm -> mW/sr/cm2/cm-1
    w, I = s.get("radiance_noslit", Iunit="mW/sr/cm2/cm-1")
    I_cm = planck_wn(w_cm, T=6000, unit="mW/sr/cm2/cm-1")
    assert allclose(I_cm, I, rtol=1e-3)
Exemple #2
0
def test_intensity_conversion(verbose=True, *args, **kwargs):
    ''' Test conversion of intensity cm-1 works:
        
    - conversion of mW/sr/cm2/nm -> mW/sr/cm2/cm-1
    
    '''

    from radis import planck, planck_wn

    w_nm = linspace(300, 3000)
    w_cm = nm2cm(w_nm)
    I_nm = planck(w_nm, T=6000, unit='mW/sr/cm2/nm')

    s = calculated_spectrum(w_nm,
                            I_nm,
                            wunit='nm',
                            Iunit='mW/sr/cm2/nm',
                            conditions={'medium': 'vacuum'})

    # mW/sr/cm2/nm -> mW/sr/cm2/cm-1
    w, I = s.get('radiance_noslit', Iunit='mW/sr/cm2/cm_1')
    I_cm = planck_wn(w_cm, T=6000, unit='mW/sr/cm2/cm_1')
    assert allclose(I_cm, I, rtol=1e-3)