POSEIDON.atmosphere =================== .. py:module:: POSEIDON.atmosphere .. autoapi-nested-parse:: Functions for calculating atmospheric temperature, mixing ratio, and other profiles. Functions --------- .. autoapisummary:: POSEIDON.atmosphere.compute_T_Madhu POSEIDON.atmosphere.compute_T_Madhu_2D POSEIDON.atmosphere.compute_T_slope POSEIDON.atmosphere.compute_T_Pelletier POSEIDON.atmosphere.compute_T_Guillot POSEIDON.atmosphere.compute_T_Guillot_dayside POSEIDON.atmosphere.compute_T_Line POSEIDON.atmosphere.compute_T_field_gradient POSEIDON.atmosphere.compute_T_field_two_gradients POSEIDON.atmosphere.compute_X_field_gradient POSEIDON.atmosphere.compute_X_field_two_gradients POSEIDON.atmosphere.Parmentier_dissociation_profile POSEIDON.atmosphere.compute_X_dissociation POSEIDON.atmosphere.compute_X_lever POSEIDON.atmosphere.add_bulk_component POSEIDON.atmosphere.radial_profiles_test POSEIDON.atmosphere.radial_profiles POSEIDON.atmosphere.radial_profiles_constant_g POSEIDON.atmosphere.mixing_ratio_categories POSEIDON.atmosphere.compute_mean_mol_mass POSEIDON.atmosphere.count_atoms POSEIDON.atmosphere.elemental_ratio POSEIDON.atmosphere.profiles Module Contents --------------- .. py:function:: compute_T_Madhu(P, a1, a2, log_P1, log_P2, log_P3, T_set, P_set) Computes the temperature profile for an atmosphere using a re-arranged form of the P-T profile parametrisation in Madhusudhan & Seager (2009). :param P: Atmosphere pressure array (bar). :type P: np.array of float :param a1: Alpha_1 parameter (encodes slope in layer 1). :type a1: float :param a2: Alpha_2 parameter encodes slope in layer 2). :type a2: float :param log_P1: Pressure of layer 1-2 boundary. :type log_P1: float :param log_P2: Pressure of inversion. :type log_P2: float :param log_P3: Pressure of layer 2-3 boundary. :type log_P3: float :param T_set: Atmosphere temperature reference value at P = P_set (K). :type T_set: float :param P_set: Pressure whether the temperature parameter T_set is defined (bar). :type P_set: float :returns: Temperature of each layer as a function of pressure (K). Only the first axis is used for this 1D profile. :rtype: T (3D np.array of float) .. py:function:: compute_T_Madhu_2D(P, a1_1, a2_1, log_P1_1, log_P2_1, a1_2, a2_2, log_P1_2, log_P2_2, T_deep, P_ref, N_sectors, N_zones, alpha, beta, phi, theta) Computes a 2D temperature field using two Madhusudhan & Seager (2009) P-T profiles: one for each side of the atmosphere (e.g. dayside/nightside or evening/morning). Both profiles share a common deep temperature T_deep at the reference pressure P_ref (i.e. log_P3 = log10(P_ref) for both). For a D-N 2D model: profile 1 = dayside, profile 2 = nightside. For an E-M 2D model: profile 1 = evening, profile 2 = morning. The angular interpolation between the two profiles follows the same scheme used by the gradient profiles in MacDonald & Lewis (2022). :param P: Atmosphere pressure array (bar). :type P: np.array of float :param a1_1: Alpha_1 parameter for profile 1. :type a1_1: float :param a2_1: Alpha_2 parameter for profile 1. :type a2_1: float :param log_P1_1: Layer 1-2 boundary pressure for profile 1 (log10 bar). :type log_P1_1: float :param log_P2_1: Inversion pressure for profile 1 (log10 bar). :type log_P2_1: float :param a1_2: Alpha_1 parameter for profile 2. :type a1_2: float :param a2_2: Alpha_2 parameter for profile 2. :type a2_2: float :param log_P1_2: Layer 1-2 boundary pressure for profile 2 (log10 bar). :type log_P1_2: float :param log_P2_2: Inversion pressure for profile 2 (log10 bar). :type log_P2_2: float :param T_deep: Shared deep temperature at P_ref (K). :type T_deep: float :param P_ref: Reference pressure (bar). Sets log_P3 for both profiles. :type P_ref: float :param N_sectors: Number of azimuthal sectors. :type N_sectors: int :param N_zones: Number of zenith zones. :type N_zones: int :param alpha: Terminator opening angle (degrees). :type alpha: float :param beta: Day-night opening angle (degrees). :type beta: float :param phi: Mid-sector angles (radians). :type phi: np.array of float :param theta: Mid-zone angles (radians). :type theta: np.array of float :returns: Temperature of each layer as a function of pressure, sector, and zone (K). :rtype: T (3D np.array of float) .. py:function:: compute_T_slope(P, T_phot, Delta_T_arr, log_P_phot=0.5, log_P_arr=[-3.0, -2.0, -1.0, 0.0, 1.0, 1.5, 2.0]) Computes the temperature profile for an atmosphere using the 'slope' P-T profile parametrisation defined in Piette & Madhusudhan (2021). Note: The number of temperature difference parameters is the same as the number of pressure points (including the photosphere). For the default values, we have: [Delta_T (10-1mb), Delta_T (100-10mb), Delta_T (1-0.1b), Delta_T (3.2-1b), Delta_T (10-3.2b), Delta_T (32-10b), Delta_T (100-32b)], where 'b' = bar. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T_phot: Temperature at the photosphere (located at log_P_phot) (K). :type T_phot: float :param Delta_T_arr: Temperature differences between each pressure point (K). :type Delta_T_arr: np.array of float :param log_P_phot: Photosphere pressure (default: 3.16 bar). :type log_P_phot: float :param log_P_arr: Pressures where the temperature difference parameters are defined (log bar). :type log_P_arr: list :returns: Temperature of each layer as a function of pressure (K). Only the first axis is used for this 1D profile. :rtype: T (3D np.array of float) .. py:function:: compute_T_Pelletier(P, T_points) Computes the temperature profile for an atmosphere using the 'spline' P-T profile parametrisation defined in Pelletier (2021). :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T_points: Array of temperatures specified at the knots :type T_points: np.array of float :returns: Temperature of each layer as a function of pressure (K). Only the first axis is used for this 1D profile. :rtype: T (3D np.array of float) .. py:function:: compute_T_Guillot(P, g, log_kappa_IR, log_gamma, T_int, T_equ) Computes the temperature profile for an atmosphere using the P-T profile parametrisation defined in Guillot (2010). Specifically, the pRT implementation ('guillot_global') : https://petitradtrans.readthedocs.io/en/latest/content/notebooks/nat_cst_utility.html#Guillot-temperature-model https://gitlab.com/mauricemolli/petitRADTRANS/-/blob/master/petitRADTRANS/physics.py?ref_type=heads Sets f = 0.25, which is the value for the terminator and directly imaged brown dwarfs :param P: Atmosphere pressure array (bar). :type P: np.array of float :param g: gravity at each pressure point in m/s :type g: np.array of float :param log_kappa_IR: The infrared opacity in units of m^2/kg :type log_kappa_IR: float :param log_gamma: The ratio between the visual and infrared opacity. :type log_gamma: float :param T_int: The planetary internal temperature (in units of K). :type T_int: float :param T_equ: The planetary equilibrium temperature (in units of K). (is a free parameter) :type T_equ: float :returns: Temperature of each layer as a function of pressure (K). Only the first axis is used for this 1D profile. :rtype: T (3D np.array of float) .. py:function:: compute_T_Guillot_dayside(P, g, log_kappa_IR, log_gamma, T_int, T_equ) Computes the temperature profile for an atmosphere using the P-T profile parametrisation defined in Guillot (2010). Specifically, the pRT implementation ('guillot_global') : https://petitradtrans.readthedocs.io/en/latest/content/notebooks/nat_cst_utility.html#Guillot-temperature-model https://gitlab.com/mauricemolli/petitRADTRANS/-/blob/master/petitRADTRANS/physics.py?ref_type=heads Sets f = 0.5, which is the value for the dayside :param P: Atmosphere pressure array (bar). :type P: np.array of float :param g: gravity at each pressure point in m/s :type g: np.array of float :param log_kappa_IR: The infrared opacity in units of m^2/kg :type log_kappa_IR: float :param log_gamma: The ratio between the visual and infrared opacity. :type log_gamma: float :param T_int: The planetary internal temperature (in units of K). :type T_int: float :param T_equ: The planetary equilibrium temperature (in units of K). (is a free parameter) :type T_equ: float :returns: Temperature of each layer as a function of pressure (K). Only the first axis is used for this 1D profile. :rtype: T (3D np.array of float) .. py:function:: compute_T_Line(P, g, T_eq, log_kappa_IR, log_gamma, log_gamma_2, alpha, beta, T_int) From Line et al. 2013: http://adsabs.harvard.edu/abs/2013ApJ...775..137L, Equation 13 - 16' Computes the temperature profile for an atmosphere using the P-T profile parametrisation defined in Line et al (2013). http://adsabs.harvard.edu/abs/2013ApJ...775..137L, Equation 13 - 16' Specifically, the PLATON implementation ('set_from_radiative_solution') : https://platon.readthedocs.io/en/latest/source/platon.html?highlight=line#platon.TP_profile.Profile.set_from_radiative_solution :param P: Atmosphere pressure array (bar). :type P: np.array of float :param g: gravity at each pressure point in m/s :type g: np.array of float :param T_eq: The planetary equilibrium temperature (in units of K). (is NOT a free parameter, like in Guillot) :type T_eq: float :param log_kappa_IR: The infrared opacity in units of m^2/kg :type log_kappa_IR: float :param log_gamma: The ratio between the visual and infrared opacity (channel 1) (kappa_vis_1 is baked into this) :type log_gamma: float :param log_gamma_2: The ratio between the visual and infrared opacity (channel 2) (kappa_vis_2 is baked into this) :type log_gamma_2: float :param alpha: Ranges 0-1. Partitions flux between two visible streams :type alpha: float :param beta: Catch all term that accounts for :type beta: float :param T_int: The planetary internal temperature (in units of K). :type T_int: float :returns: Temperature of each layer as a function of pressure (K). Only the first axis is used for this 1D profile. :rtype: T (3D np.array of float) .. py:function:: compute_T_field_gradient(P, T_bar_term, Delta_T_term, Delta_T_DN, T_deep, N_sectors, N_zones, alpha, beta, phi, theta, P_deep=10.0, P_high=1e-05) Creates the 3D temperature profile defined in MacDonald & Lewis (2022). Note: This profile assumes a linear in log-pressure temperature gradient between P_deep and P_high (these anchor points are fixed such that the photosphere generally lies within them). For pressures above and below the considered range, the temperature is isothermal. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T_bar_term: Average terminator plane temperature at P_high. :type T_bar_term: float :param Delta_T_term: Temperature difference between the evening and morning terminators at P_high(K). :type Delta_T_term: float :param Delta_T_DN: Temperature difference between the dayside and nightside at P_high (K). :type Delta_T_DN: float :param T_deep: Global deep temperature at P_deep. :type T_deep: float :param N_sectors: Number of azimuthal sectors. :type N_sectors: int :param N_zones: Number of zenith zones. :type N_zones: int :param alpha: Terminator opening angle (degrees). :type alpha: float :param beta: Day-night opening angle (degrees). :type beta: float :param phi: Mid-sector angles (radians). :type phi: np.array of float :param theta: Mid-zone angles (radians). :type theta: np.array of float :param P_deep: Anchor point in deep atmosphere below which the atmosphere is homogenous. :type P_deep: float :param P_high: Anchor point high in the atmosphere above which all columns are isothermal. :type P_high: float :returns: Temperature of each layer as a function of pressure, sector, and zone (K). :rtype: T (3D np.array of float) .. py:function:: compute_T_field_two_gradients(P, T_bar_term_high, T_bar_term_mid, Delta_T_term_high, Delta_T_term_mid, Delta_T_DN_high, Delta_T_DN_mid, log_P_mid, T_deep, N_sectors, N_zones, alpha, beta, phi, theta, P_deep=10.0, P_high=1e-05) Extension of 'compute_T_field_gradient' with a second gradient in the photosphere region. The two gradients connect at a new parameter: P_mid. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T_bar_term_high: Average terminator plane temperature at P_high. :type T_bar_term_high: float :param T_bar_term_mid: Average terminator plane temperature at P_mid. :type T_bar_term_mid: float :param Delta_T_term_high: Temperature difference between the evening and morning terminators at P_high (K). :type Delta_T_term_high: float :param Delta_T_term_mid: Temperature difference between the evening and morning terminators at P_mid (K). :type Delta_T_term_mid: float :param Delta_T_DN_high: Temperature difference between the dayside and nightside at P_high (K). :type Delta_T_DN_high: float :param Delta_T_DN_mid: Temperature difference between the dayside and nightside at P_mid (K). :type Delta_T_DN_mid: float :param log_P_mid: log10 of pressure where the two gradients switch (bar). :type log_P_mid: float :param T_deep: Global deep temperature at P_deep. :type T_deep: float :param N_sectors: Number of azimuthal sectors. :type N_sectors: int :param N_zones: Number of zenith zones. :type N_zones: int :param alpha: Terminator opening angle (degrees). :type alpha: float :param beta: Day-night opening angle (degrees). :type beta: float :param phi: Mid-sector angles (radians). :type phi: np.array of float :param theta: Mid-zone angles (radians). :type theta: np.array of float :param P_deep: Anchor point in deep atmosphere below which the atmosphere is homogenous. :type P_deep: float :param P_high: Anchor point high in the atmosphere above which all columns are isothermal. :type P_high: float :returns: Temperature of each layer as a function of pressure, sector, and zone (K). :rtype: T (3D np.array of float) .. py:function:: compute_X_field_gradient(P, log_X_state, N_sectors, N_zones, param_species, species_has_profile, alpha, beta, phi, theta, P_deep=10.0, P_high=1e-05) Creates the 4D abundance profile array storing X(species, layer, sector, zone). The functional dependence is the same as defined above in the function 'compute_T_field_gradient' (see also MacDonald & Lewis (2022)), with the exception that not all chemical species have a vertical profile. Any chemical species not in the array 'species_has_profile' have constant mixing ratios with altitude. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param log_X_state: Mixing ratio state array. :type log_X_state: 2D np.array of float :param N_sectors: Number of azimuthal sectors. :type N_sectors: int :param N_zones: Number of zenith zones. :type N_zones: int :param param_species: Chemical species with parametrised mixing ratios. :type param_species: np.array of str :param species_has_profile: Array with an integer '1' if a species in 'param_species' has a gradient profile, or '0' for an constant mixing ratio with altitude. :type species_has_profile: np.array of int :param alpha: Terminator opening angle (degrees). :type alpha: float :param beta: Day-night opening angle (degrees). :type beta: float :param phi: Mid-sector angles (radians). :type phi: np.array of float :param theta: Mid-zone angles (radians). :type theta: np.array of float :param P_deep: Anchor point in deep atmosphere below which all columns are isochemical. :type P_deep: float :param P_high: Anchor point high in the atmosphere above which all columns are isochemical. :type P_high: float :returns: Mixing ratios in each layer as a function of pressure, sector, and zone. :rtype: X_profiles (4D np.array of float) .. py:function:: compute_X_field_two_gradients(P, log_X_state, N_sectors, N_zones, param_species, species_has_profile, alpha, beta, phi, theta, P_deep=10.0, P_high=1e-05) Extension of 'compute_X_field_gradient' with a second gradient in the photosphere region. The two gradients connect at P_mid. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param log_X_state: Mixing ratio state array. :type log_X_state: 2D np.array of float :param N_sectors: Number of azimuthal sectors. :type N_sectors: int :param N_zones: Number of zenith zones. :type N_zones: int :param param_species: Chemical species with parametrised mixing ratios. :type param_species: np.array of str :param species_has_profile: Array with an integer '1' if a species in 'param_species' has a gradient profile, or '0' for an constant mixing ratio with altitude. :type species_has_profile: np.array of int :param alpha: Terminator opening angle (degrees). :type alpha: float :param beta: Day-night opening angle (degrees). :type beta: float :param phi: Mid-sector angles (radians). :type phi: np.array of float :param theta: Mid-zone angles (radians). :type theta: np.array of float :param P_deep: Anchor point in deep atmosphere below which all columns are isochemical. :type P_deep: float :param P_high: Anchor point high in the atmosphere above which all columns are isochemical. :type P_high: float :returns: Mixing ratios in each layer as a function of pressure, sector, and zone. :rtype: X_profiles (4D np.array of float) .. py:function:: Parmentier_dissociation_profile(P, T, A_0, alpha, beta, gamma, A_0_ref) Thermal dissociation profile from Parmentier et al. 2018. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T: Atmosphere temperature array (K). :type T: np.array of float :param A_0: Deep abundance without dissociation. :type A_0: float :param alpha: Power-law index for pressure dependence. :type alpha: float :param beta: Exponential coefficient for temperature dependence. :type beta: float :param gamma: Logarithmic offset coefficient. :type gamma: float :param A_0_ref: Reference deep abundance without dissociation. :type A_0_ref: float :returns: Volume mixing ratio profile. :rtype: A (np.array of float) .. py:function:: compute_X_dissociation(P, T, log_X_state, N_sectors, N_zones, param_species, species_has_profile, alpha, beta, phi, theta) Determines if a thermal dissociation profile should be used, and then calculates the appropriate profile using the Parmentier et al. 2018 formulation. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T: Atmosphere temperature array (K) :type T: np.array of float :param log_X_state: Mixing ratio state array. :type log_X_state: 2D np.array of float :param param_species: Chemical species with parametrised mixing ratios. :type param_species: np.array of str :param species_has_profile: Array with an integer '1' if a species in 'param_species' has a gradient profile, or '0' for an constant mixing ratio with altitude. :type species_has_profile: np.array of int :param N_sectors: Number of azimuthal sectors. :type N_sectors: int :param N_zones: Number of zenith zones. :type N_zones: int :returns: the mixing ratio of the ith element as a function of pressure. :rtype: log_X .. py:function:: compute_X_lever(P, log_X_state, species_has_profile, N_sectors, N_zones) The function takes in four parameters and returns an array of values called log_X that represent the output of the function, which is an array of numbers that would be used to plot the profile of the chemical species. This is done by taking the difference in the logarithm of the pressures and the original array, log_xi and multiplying it by the slope of the isochemical line (angle between the isochemical line and the array log_xi). The volume mixing ratio log_xi is the number density / the total volume. The function takes in five parameters: log_xi: Logarithm of the mixing ratio at element i. log_pi: Logarithm of the pressure at element i. upsilon_i: The angle between the local vertical and the slope for element i. log_p: An array of logarithm of the pressures. :returns: the the mixing ratio of the ith element as a function of pressure. :rtype: log_X .. py:function:: add_bulk_component(P, T, X_param, N_species, N_sectors, N_zones, bulk_species, He_fraction) Concatenates mixing ratios of the bulk species to the parametrised mixing ratios, forming the full mixing ratio array (i.e. sums to 1). Note: For H2 and He as bulk species, the output array has the mixing ratio profile of H2 as the first element and He second. For other bulk species (e.g. N2), that species occupies the first element. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T: Atmosphere temperature array (K). :type T: np.array of float :param X_param: Mixing ratios of the parametrised chemical species in each layer as a function of pressure, sector, and zone. :type X_param: 4D np.array of float :param N_sectors: Number of azimuthal sectors. :type N_sectors: int :param N_zones: Number of zenith zones. :type N_zones: int :param bulk_species: Bulk species dominating atmosphere (e.g. ['H2', 'He']). :type bulk_species: np.array of str :param He_fraction: Assumed H2/He ratio (0.17 default corresponds to the solar ratio). :type He_fraction: float :returns: Same as X_param, but with the bulk species appended. :rtype: X (4D np.array of float) .. py:function:: radial_profiles_test(P, T, g_0, R_p, P_ref, R_p_ref, mu, N_sectors, N_zones) Solves the equation of hydrostatic equilibrium [ dP/dr = -G*M*rho/r^2 ] to compute the radius in each atmospheric layer. Note: g is taken as an inverse square law with radius by assuming the enclosed planet mass at a given radius is M_p. This assumes most mass is in the interior (negligible atmosphere mass). :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T: Temperature profile (K). :type T: 3D np.array of float :param g_0: Gravitational field strength at white light radius (m/s^2). :type g_0: float :param R_p: Observed white light planet radius (m). :type R_p: float :param P_ref: Reference pressure (bar). :type P_ref: float :param R_p_ref: Planet radius corresponding to reference pressure (m). :type R_p_ref: float :param mu: Mean molecular mass (kg). :type mu: 3D np.array of float :param N_sectors: Number of azimuthal sectors comprising the background atmosphere. :type N_sectors: int :param N_zones: Number of zenith zones comprising the background atmosphere. :type N_zones: int :returns: Number density profile (m^-3). r (3D np.array of float): Radial distance profile (m). r_up (3D np.array of float): Upper layer boundaries (m). r_low (3D np.array of float): Lower layer boundaries (m). dr (3D np.array of float): Layer thicknesses (m). :rtype: n (3D np.array of float) .. py:function:: radial_profiles(P, T, g_0, R_p, P_ref, R_p_ref, mu, N_sectors, N_zones) Solves the equation of hydrostatic equilibrium [ dP/dr = -G*M*rho/r^2 ] to compute the radius in each atmospheric layer. Note: g is taken as an inverse square law with radius by assuming the enclosed planet mass at a given radius is M_p. This assumes most mass is in the interior (negligible atmosphere mass). :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T: Temperature profile (K). :type T: 3D np.array of float :param g_0: Gravitational field strength at white light radius (m/s^2). :type g_0: float :param R_p: Observed white light planet radius (m). :type R_p: float :param P_ref: Reference pressure (bar). :type P_ref: float :param R_p_ref: Planet radius corresponding to reference pressure (m). :type R_p_ref: float :param mu: Mean molecular mass (kg). :type mu: 3D np.array of float :param N_sectors: Number of azimuthal sectors comprising the background atmosphere. :type N_sectors: int :param N_zones: Number of zenith zones comprising the background atmosphere. :type N_zones: int :returns: Number density profile (m^-3). r (3D np.array of float): Radial distance profile (m). r_up (3D np.array of float): Upper layer boundaries (m). r_low (3D np.array of float): Lower layer boundaries (m). dr (3D np.array of float): Layer thicknesses (m). :rtype: n (3D np.array of float) .. py:function:: radial_profiles_constant_g(P, T, g_0, P_ref, R_p_ref, mu, N_sectors, N_zones) Solves the equation of hydrostatic equilibrium [ dP/dr = -G*M*rho/r^2 ] to compute the radius in each atmospheric layer. Note: This version of the solver assumes the gravitational field strength is constant with altitude (for testing purposes). The standard 'radial_profiles' function should be used for any real calculation. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param T: Temperature profile (K). :type T: 3D np.array of float :param g_0: Gravitational field strength at white light radius (m/s^2). :type g_0: float :param P_ref: Reference pressure (bar). :type P_ref: float :param R_p_ref: Planet radius corresponding to reference pressure (m). :type R_p_ref: float :param mu: Mean molecular mass (kg). :type mu: 3D np.array of float :param N_sectors: Number of azimuthal sectors comprising the background atmosphere. :type N_sectors: int :param N_zones: Number of zenith zones comprising the background atmosphere. :type N_zones: int :returns: Number density profile (m^-3). r (3D np.array of float): Radial distant profile (m). r_up (3D np.array of float): Upper layer boundaries (m). r_low (3D np.array of float): Lower layer boundaries (m). dr (3D np.array of float): Layer thicknesses (m). :rtype: n (3D np.array of float) .. py:function:: mixing_ratio_categories(P, X, N_sectors, N_zones, included_species, active_species, CIA_pairs, ff_pairs, bf_species) Sort mixing ratios into those of active species, collision-induced absorption (CIA), free-free opacity, and bound-free opacity. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param X: Mixing ratio profile :type X: 4D np.array of float :param N_sectors: Number of azimuthal sectors comprising the background atmosphere. :type N_sectors: int :param N_zones: Number of zenith zones comprising the background atmosphere. :type N_zones: int :param included_species: List of chemical species included in the model (including bulk species). :type included_species: np.array of str :param active_species: Spectroscopically active chemical species (see supported_opac.py). :type active_species: np.array of str :param CIA_pairs: Collisionally-induced absorption (CIA) pairs. :type CIA_pairs: np.array of str :param ff_pairs: Free-free absorption pairs. :type ff_pairs: np.array of str :param bf_species: Bound-free absorption species. :type bf_species: np.array of str :returns: Mixing ratios of active species. X_CIA (5D np.array of float): Mixing ratios of CIA pairs X_ff (5D np.array of float): Mixing ratios of free-free pairs. X_bf (4D np.array of float): Mixing ratios of bound-free species. :rtype: X_active (4D np.array of float) .. py:function:: compute_mean_mol_mass(P, X, N_species, N_sectors, N_zones, masses_all) Computes the mean molecular mass in each atmospheric column. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param X: Mixing ratio profile. :type X: 4D np.array of float :param N_species: Number of chemical species. :type N_species: int :param N_sectors: Number of azimuthal sectors comprising the background atmosphere. :type N_sectors: int :param N_zones: Number of zenith zones comprising the background atmosphere. :type N_zones: int :param masses_all: Masses of each chemical species (atomic mass units, u) :type masses_all: np.array of float :returns: Mean molecular mass (kg). :rtype: mu (3D np.array of float) .. py:function:: count_atoms(molecule) Count how many atoms of each element are contained in a molecule. :param molecule: Name of the molecule (e.g. 'H2O', 'CaOH', 'HC(CH3)3'). :type molecule: str :returns: Dictionary containing element counts (e.g. for H2O: {'H': 2, 'O': 1}). :rtype: counts (dict) .. py:function:: elemental_ratio(included_species, X, element_1, element_2) Calculate the abundance ratio between any two elements in the atmosphere. Example: to compute the C/O ratio, use element_1 = 'C' and element_2 = 'O'. :param included_species: List of all chemical species included in the model. :type included_species: np.array of str :param X: Mixing ratio profiles. :type X: 4D np.array of float :param element_1: First element in ratio. :type element_1: str :param element_2: First element in ratio. :type element_2: str :returns: Abundance ratio in each layer, sector, and zone. :rtype: element_ratio (3D np.array of float) .. py:function:: profiles(P, R_p, g_0, PT_profile, X_profile, PT_state, P_ref, R_p_ref, log_X_state, included_species, bulk_species, param_species, active_species, CIA_pairs, ff_pairs, bf_species, N_sectors, N_zones, alpha, beta, phi, theta, species_vert_gradient, He_fraction, T_input, X_input, P_param_set, log_P_slope_phot, log_P_slope_arr, Na_K_fixed_ratio, constant_gravity=False, chemistry_grid=None, PT_penalty=False, T_eq=None, mu_back=None, disable_atmosphere=False) Main function to calculate the vertical profiles in each atmospheric column. The profiles cover the temperature, number density, mean molecular mass, layer radial extents, and mixing ratio arrays. Notes: Most profiles are 3D arrays with format (N_layers, N_sectors, N_zones). The mixing ratio profiles are 4D (separate profiles for each species) or 5D (CIA or free-free pairs). The layer index starts from the base of the atmosphere. The sector index starts from the evening terminator. The zone index starts from the dayside. :param P: Atmosphere pressure array (bar). :type P: np.array of float :param R_p: Observed white light planet radius (m). :type R_p: float :param g_0: Gravitational field strength at white light radius (m/s^2). :type g_0: float :param PT_profile: Chosen P-T profile parametrisation (Options: isotherm / gradient / two-gradients / Madhu / slope / file_read). :type PT_profile: str :param X_profile: Chosen mixing ratio profile parametrisation (Options: isochem / gradient / two-gradients / file_read). :type X_profile: str :param PT_state: P-T profile state array. :type PT_state: np.array of float :param P_ref: Reference pressure (bar). :type P_ref: float :param R_p_ref: Planet radius corresponding to reference pressure (m). :type R_p_ref: float :param log_X_state: Mixing ratio state array. :type log_X_state: 2D np.array of float :param included_species: List of chemical species included in the model (including bulk species). :type included_species: np.array of str :param bulk_species: Bulk species dominating atmosphere (e.g. ['H2', 'He']). :type bulk_species: np.array of str :param param_species: Chemical species with parametrised mixing ratios. :type param_species: np.array of str :param active_species: Spectroscopically active chemical species (see supported_opac.py). :type active_species: np.array of str :param CIA_pairs: Collisionally-induced absorption (CIA) pairs. :type CIA_pairs: np.array of str :param ff_pairs: Free-free absorption pairs. :type ff_pairs: np.array of str :param bf_species: Bound-free absorption species. :type bf_species: np.array of str :param N_sectors: Number of azimuthal sectors comprising the background atmosphere. :type N_sectors: int :param N_zones: Number of zenith zones comprising the background atmosphere. :type N_zones: int :param alpha: Terminator opening angle (degrees). :type alpha: float :param beta: Day-night opening angle (degrees). :type beta: float :param phi: Mid-sector angles (radians). :type phi: np.array of float :param theta: Mid-zone angles (radians). :type theta: np.array of float :param species_vert_gradient: Chemical species with a vertical mixing ratio gradient. :type species_vert_gradient: np.array of str :param He_fraction: Assumed H2/He ratio (0.17 default corresponds to the solar ratio). :type He_fraction: float :param T_input: Temperature profile (only if provided directly by the user). :type T_input: np.array of float :param X_input: Mixing ratio profiles (only if provided directly by the user). :type X_input: 2D np.array of float :param P_param_set: Only used for the Madhusudhan & Seager (2009) P-T profile. Sets the pressure where the reference temperature parameter is defined (P_param_set = 1.0e-6 corresponds to that paper's choice). :type P_param_set: float :param log_P_phot_slope: Photosphere log pressure for the Piette & Madhusudhan (2020) P-T profile. :type log_P_phot_slope: float :param log_P_slope_array: Log pressures where the Piette & Madhusudhan (2020) temperature difference parameters are defined (log bar). :type log_P_slope_array: np.array of float :param Na_K_fixed_ratio: If True, sets log_K = 0.1 * log_Na. :type Na_K_fixed_ratio: bool :param constant_gravity: If True, disable inverse square law gravity (only for testing). :type constant_gravity: bool :param chemistry_grid: For models with a pre-computed chemistry grid only, this dictionary is produced in chemistry.py. :type chemistry_grid: dict :param PT_penalty: For Pelletier profile. Only here so that PT input works. :type PT_penalty: bool :param T_eq: Equilibrium temperature of planet. For the Line PT profile. Note: not the same as T_equ, the free parameter in Guillot profile. :type T_eq: float :param mu_back: Mean molecular mass of background gas, if bulk_species = ['ghost'] (AMU). :type mu_back: float :param disable_atmosphere: If True, returns a flat planetary transmission spectrum @ (Rp/R*)^2 :type disable_atmosphere: bool :returns: Temperature profile (K). n (3D np.array of float): Number density profile (m^-3). r (3D np.array of float): Radial distant profile (m). r_up (3D np.array of float): Upper layer boundaries (m). r_low (3D np.array of float): Lower layer boundaries (m). dr (3D np.array of float): Layer thicknesses (m). mu (3D np.array of float): Mean molecular mass (kg). X (4D np.array of float): Mixing ratio profile. X_active (4D np.array of float): Mixing ratios of active species. X_CIA (5D np.array of float): Mixing ratios of CIA pairs. X_ff (5D np.array of float): Mixing ratios of free-free pairs. X_bf (4D np.array of float): Mixing ratios of bound-free species. Bool: True if atmosphere physical, otherwise False. :rtype: T (3D np.array of float)