:py:mod:`exo_k.util.radiation` ============================== .. py:module:: exo_k.util.radiation .. autoapi-nested-parse:: Created on Jun 20 2019 @author: jeremy leconte Library of useful functions for radiative transfer calculations Module Contents --------------- .. py:data:: PLANCK_CST1MKS .. py:data:: PLANCK_CST1 .. py:data:: PLANCK_CST2 .. py:data:: PLANCK_CST3 .. py:data:: PLANCK_CST1_lamb .. py:function:: Bnu(nu, T) Computes the Planck law in wavenumber domain. :param nu: The wavenumber in cm^-1. :type nu: :class:`float` :param T: Temperature (K). :type T: :class:`float` :returns: * float Bnu in W/m^2/str/cm^-1 (not SI units). * :class:`sigma*T^4/PI=Int(Bnu dnu) where nu is expressed in cm^-1` .. py:function:: Bnu_integral(nu_edges, T) Computes the integral of the Planck function in wavenumber bins. Uses scipy.integrate.quad. Quite slow. :param nu_edges: Edges of the wavenumber bins in cm^-1. :type nu_edges: :class:`array`, :class:`np.ndarray` :param T: Temperature (K). :type T: :class:`float` :returns: * array Bnu_integral in W/m^2/str. * :class:`sigma*T^4/PI=sum` of :class:`Bnu_integral` .. py:function:: Bnu_integral_num(nu_edges, T, n=30) Computes the integral of the Planck function in wavenumber bins. Uses a series expansion of the integral derived in "PLANCK FUNCTIONS AND INTEGRALS; METHODS OF COMPUTATION by Thomas E. Michels Goddard Space Flight Center Greenbelt, Md. MARCH 1968" :param nu_edges: Edges of the wavenumber bins in cm^-1. :type nu_edges: :class:`array`, :class:`np.ndarray` :param T: Temperature (K). :type T: :class:`float` :param n: number of terms to take into account in the black body calculation. :type n: :class:`int` :returns: * Array of shape (T_array.size,nu_edges.size-1) Bnu_integral_num: Integral of the source function at temperatures T_array inside the bins in W/m^2/str * :class:`sigma*T^4/PI=sum` of :class:`Bnu_integral_num` .. py:function:: Bnu_integral_array(nu_edges, T_array, Nw, Nt, n=30) Computes the integral of the Planck function in wavenumber bins. Uses a series expansion of the integral derived in "PLANCK FUNCTIONS AND INTEGRALS; METHODS OF COMPUTATION by Thomas E. Michels Goddard Space Flight Center Greenbelt, Md. MARCH 1968" :param nu_edges: Edges of the wavenumber bins in cm^-1. :type nu_edges: :class:`array`, :class:`np.ndarray` :param T: Array of temperature (K). :type T: :class:`array`, :class:`np.ndarray` :param Nw: Number of spectral bins. :type Nw: :class:`int` :param Nt: Number of temperatures. :type Nt: :class:`int` :param n: number of terms to take into account in the black body calculation. :type n: :class:`int`, *optional* :returns: * Array of shape (T_array.size,nu_edges.size-1) Bnu_integral_num: Integral of the source function at temperatures T_array inside the bins in W/m^2/str * :class:`sigma*T^4/PI=sum` of :class:`Bnu_integral_num` .. py:function:: dBnudT_array(nu, T_array, Nw, Nt) Computes the derivative of the Planck function with respect to temperature. :param nu: Wavenumbers in cm^-1. :type nu: :class:`array`, :class:`np.ndarray` :param T: Array of temperature (K). :type T: :class:`array`, :class:`np.ndarray` :param Nw: Number of spectral bins. :type Nw: :class:`int` :param Nt: Number of temperatures. :type Nt: :class:`int` :returns: Array of shape (T_array.size,nu.size) dBnudT: derivative of the Planck function at temperatures T_array. .. py:function:: Bmicron(lamb, T) Computes the Planck law in wavelength domain. :param lamb: The wavelength in microns. :type lamb: :class:`float` :param T: Temperature (K). :type T: :class:`float` :returns: float Bmicron in W/m^2/str/micron (not SI units). sigma*T^4/PI=Int(Bmicron d lamb) where lamb is expressed in microns .. py:function:: BBnu_Stellar_Spectrum(nu, T, Flux) Computes the outgoing spectral flux of a black body at temperature T so that its bolometric flux is equal to the input 'Flux' :param nu: The wavenumber in cm^-1. :type nu: :class:`float` :param T: Temperature (K). :type T: :class:`float` :param Flux: bolometric flux for rescaling. :type Flux: :class:`float` :returns: * float BBnu_Stellar_Spectrum is in W/m^2/cm^-1 (not SI units). * :class:`sigma*T^4=Int(Bnu dnu) where nu is expressed in cm^-1` .. py:function:: BBmicron_Stellar_Spectrum(lamb, T, Flux) Computes the outgoing spectral flux of a black body at temperature T so that its bolometric flux is equal to the input 'Flux' :param lamb: The wavelength in microns. :type lamb: :class:`float` :param T: Temperature (K). :type T: :class:`float` :param Flux: bolometric flux for rescaling. :type Flux: :class:`float` :returns: * float BBmicron_Stellar_Spectrum is in W/m^2/micron (not SI units). * :class:`sigma*T^4=Int(Bmicron d lamb) where lamb is expressed in microns.` .. py:function:: wavelength_grid_R(lambda_min, lambda_max, R) Creates a wavelength grid starting from lambda_min and ending at lambda_max with a resolution of R (roughly). :param lambda_min/lambda_max: Min/max wavelength (in micron). :type lambda_min/lambda_max: :class:`int` or :class:`float` :param R: Resolution. :type R: :class:`int` or :class:`float` :returns: array Grid of wavelength. .. py:function:: wavenumber_grid_R(nu_min, nu_max, R) Creates a wavenumber grid starting from nu_min and ending at nu_max with a resolution of R (roughly). :param nu_min/nu_max: Min/max wavenumber (in cm^-1). :type nu_min/nu_max: :class:`int` or :class:`float` :param R: Resolution. :type R: :class:`int` or :class:`float` :returns: array Grid of wavenumber. .. py:function:: rad_prop_corrk(dcol_density, opacity_prof, mu0) Computes the optical depth of each of the radiative layers for the opacity given for every wavelength and g point. :param dcol_density: Column density per radiative layer (molecules/m^2/layer). :type dcol_density: :class:`array`, :class:`np.ndarray` :param opacity_prof: effective cross section per molecule (m^2/molecule). :type opacity_prof: :class:`array`, :class:`np.ndarray` :param mu0: e.g. Cos(60deg)=0.5 is chosen (See, for example, chap 4 of Pierrehumbert 2010) :type mu0: :class:`cosine` of :class:`the equivalent zenith angle for the rays.` :returns: tau: Array cumulative optical depth from the top (with zeros at the top of the first radiative layer) dtau: Array optical depth of each radiative layer for each wavenumber. .. py:function:: rad_prop_xsec(dcol_density, opacity_prof, mu0) Computes the optical depth of each of the radiative layers for the opacity given for every wavelength. :param dcol_density: Column density per radiative layer (molecules/m^2/layer). :type dcol_density: :class:`array`, :class:`np.ndarray` :param opacity_prof: effective cross section per molecule (m^2/molecule). :type opacity_prof: :class:`array`, :class:`np.ndarray` :param mu0: e.g. Cos(60deg)=0.5 is chosen (See, for example, chap 4 of Pierrehumbert 2010) :type mu0: :class:`cosine` of :class:`the equivalent zenith angle for the rays.` :returns: * tau: Array cumulative optical depth from the top (with zeros at the top of the first layer). dtau: Array optical depth of each radiative layer for each wavenumber. * :class:`The 1/mu0 factor is taken account so that these are the depths along the ray.` .. py:function:: path_integral_corrk(Nlay, Nw, Ng, tangent_path, density_prof, opacity_prof, weights) Computes the transmittance for each layer of the atmosphere for k-coefficients. :param Nlay: Number of layers. :type Nlay: :class:`int` :param Nw: Number of wavenumber bins. :type Nw: :class:`int` :param Ng: Number of gauss points. :type Ng: :class:`int` :param tangent_path: Triangular array of tangent path for each layer. :type tangent_path: :class:`List` of :class:`arrays` :param density_prof: Array with the number density of molecules in the atmosphere. :type density_prof: :class:`array`, :class:`np.ndarray` :param opacity_prof: Effective cross section of the atmsophere for each (layer,wavenumber,g-point). :type opacity_prof: :class:`array`, :class:`np.ndarray` :param weights: Weights for the quadrature in g-space. :type weights: :class:`array`, :class:`np.ndarray` :returns: transmittance: array, np.ndarray Transmittance for each layer and wavenumber bin (Exp(-tau_sigma)). .. py:function:: path_integral_xsec(Nlay, Nw, tangent_path, density_prof, opacity_prof) Computes the transmittance for each layer of the atmosphere from cross sections. :param Nlay: Number of layers. :type Nlay: :class:`int` :param Nw: Number of wavenumber bins. :type Nw: :class:`int` :param tangent_path: Triangular array of tangent path for each layer. :type tangent_path: :class:`List` of :class:`arrays` :param density_prof: Array with the number density of molecules in the atmosphere. :type density_prof: :class:`array`, :class:`np.ndarray` :param opacity_prof: Effective cross section of the atmsophere for each (layer,wavenumber). :type opacity_prof: :class:`array`, :class:`np.ndarray` :returns: transmittance: array, np.ndarray Transmittance for each layer and wavenumber bin (Exp(-tau_sigma)).