def calc_radiance(wavenumber, emissivity, Tgas, unit="mW/sr/cm2/nm"): """Derive radiance (mW/cm2/sr/nm) from the emissivity. Returns ------- radiance: mW/sr/cm2/nm """ radiance = emissivity * planck(cm2nm(wavenumber), Tgas, unit=unit) return radiance
def calc_radiance(wavenumber, emissivity, Tgas, unit='mW/sr/cm2/nm'): ''' Derive radiance (mW/cm2/sr/nm) from the emissivity Returns ------- radiance: mW/sr/cm2/nm ''' radiance = emissivity * planck(cm2nm(wavenumber), Tgas, unit=unit) return radiance
def calc_radiance(wavenumber, emissivity, Tgas, unit="mW/sr/cm2/nm"): """Derive radiance (:math:`mW/cm^2/sr/nm`) from the emissivity. .. math:: I(\lambda) = \epsilon(\lambda) \cdot L_0(\lambda, T) Returns ------- radiance: array in :math:`mW/sr/cm2/nm` unless ``unit`` is different See Also -------- :py:func:`~radis.phys.blackbody.planck` """ radiance = emissivity * planck(cm2nm(wavenumber), Tgas, unit=unit) return radiance
def test_planck_nm(verbose=True, plot=True, *args, **kwargs): ''' Test blackbody with Wien's law, Stefan's law and tabulated data of maximum Reference --------- Tabulated intensity (75.987...) was checked to match SpectraPlot and manually calculated values ''' if plot: import matplotlib.pyplot as plt plt.ion() # dont get stuck with Matplotlib if executing through pytest T = 2200 eps = 0.36 s = sPlanck(wavelength_min=300, wavelength_max=8000, T=T, eps=eps, wstep=0.1) w_nm = s.get_wavelength(medium='vacuum') w_cm = s.get_wavenumber() Iunit_per_nm = 'W/sr/nm/m2' Iunit_per_cm = 'W/sr/cm_1/m2' if plot: s.plot('radiance_noslit', Iunit=Iunit_per_nm) I_nm = s.get_radiance_noslit(Iunit=Iunit_per_nm) I_cm = s.get_radiance_noslit(Iunit=Iunit_per_cm) # Check Wien's law w_nm_max = w_nm[I_nm.argmax()] assert np.isclose(2898/T*1e3, w_nm_max, rtol=1e-4) if verbose: print('Maximum emission at T={0}K: {1:.2f}nm'.format(T, w_nm_max)) print(".. test_planck_nm.py: Wien's law: OK") # Check Stefan's law sigma = 5.67e-8 # Stefan-Boltzmann constant (W/m2/K-4) P_theory = eps*sigma*T**4 # Stefan's law (W/m2) P_calc = pi*s.get_power('W/m2/sr') # Lambert's cosine law assert np.isclose(P_theory, P_calc, rtol=1e-1) if verbose: print( 'Blackbody radiant intensity (Stefan law): {0:.2f} W/m2'.format(P_theory)) print( 'Blackbody radiant intensity (calculated): {0:.2f} W/m2'.format(P_calc)) print(".. test_planck_nm.py: Stefan's law: OK") # Check that max is correct # hardcoded for 2200 K, epsilon = 0.36 (~1.3 µm) assert I_nm.max() == 75.98733181512608 # Test planck and planck_wn assert np.allclose(planck(w_nm, T, eps, unit=Iunit_per_nm), I_nm) assert np.allclose(planck_wn(w_cm, T, eps, unit=Iunit_per_cm), I_cm, rtol=1e-2) # higher tolerance because of numerical error # during conversion Iunit_per_nm to Iunit_per_cm return True