Source code for taurex.data.profiles.temperature.isothermal
"""Isothermal temperature profile."""importtypingastimportnumpyasnpimportnumpy.typingasnptfromastropyimportunitsasufromtaurex.data.fittableimportfitparamfromtaurex.outputimportOutputGroupfromtaurex.typesimportget_float_dtypefromtaurex.utilimportconvert_to_unit_valuefrom.tprofileimportTemperatureProfile
[docs]classIsothermal(TemperatureProfile):"""An isothermal temperature-pressure profile."""def__init__(self,T:t.Optional[t.Union[float,u.Quantity]]=1500# noqa: N803)->None:"""Initialize isothermal class. Parameters ---------- T : float or astropy.units.Quantity Isothermal temperature in K when unitless. """super().__init__("Isothermal")self._iso_temp=convert_to_unit_value(T,u.K,default_unit=u.K,equivalencies=u.temperature())@fitparam(param_name="T",param_latex="$T$",default_fit=False,default_bounds=[300.0,2000.0],)defisoTemperature(self)->float:# noqa: N802"""Isothermal temperature in Kelvin."""returnself._iso_temp@isoTemperature.setterdefisoTemperature(self,value:t.Union[float,u.Quantity])->None:# noqa: N802"""Set the isothermal temperature in K when unitless."""self._iso_temp=convert_to_unit_value(value,u.K,default_unit=u.K,equivalencies=u.temperature())@propertydefprofile(self)->npt.NDArray[np.float64]:"""Returns an isothermal temperature profile."""returnnp.full(self.nlayers,self._iso_temp,dtype=get_float_dtype())
[docs]defwrite(self,output:OutputGroup)->OutputGroup:"""Write isothermal temperature profile to output group."""temperature=super().write(output)temperature.write_scalar("T",self._iso_temp)returntemperature
[docs]@classmethoddefinput_keywords(cls)->t.Tuple[str]:"""Return all input keywords."""return("isothermal",)