[docs]classRayleighContribution(Contribution):"""Computes contribution from Rayleigh scattering."""def__init__(self):"""Initialise contribution."""super().__init__("Rayleigh")
[docs]defprepare_each(self,model:OneDForwardModel,wngrid:npt.NDArray[np.float64])->t.Generator[t.Tuple[str,npt.NDArray[np.float64]],None,None]:"""Compute opacity due to rayleigh scattering. Scattering is weighted by the mixing ratio of the gas from chemistry. Parameters ---------- model: :class:`~taurex.model.model.ForwardModel` Forward model wngrid: :obj:`array` Wavenumber grid Yields ------ component: :obj:`tuple` of type (str, :obj:`array`) Name of scattering molecule and the weighted rayeligh opacity. """fromtaurex.util.scatteringimportrayleigh_sigma_from_nameself._ngrid=wngrid.shape[0]self._nmols=1self._nlayers=model.nLayersmolecules=list(model.chemistry.activeGases)+list(model.chemistry.inactiveGases)forgasnameinmolecules:ifnp.max(model.chemistry.get_gas_mix_profile(gasname))==0.0:continuesigma=rayleigh_sigma_from_name(gasname,wngrid)ifsigmaisnotNone:final_sigma=(sigma[None,:]*model.chemistry.get_gas_mix_profile(gasname)[:,None])self.sigma_xsec=final_sigmayieldgasname,final_sigma
[docs]@classmethoddefinput_keywords(cls)->t.Tuple[str]:"""Return list of keywords for contribution."""return("Rayleigh",)