### Install Build Dependencies Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Install essential packages if third-party installation fails. ```bash pip install -U setuptools cython ``` -------------------------------- ### Verify Installation Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Test the installation by initializing a Radtrans object, which triggers the automatic download of required opacity data. ```python from petitRADTRANS.radtrans import Radtrans radtrans = Radtrans(line_species=['CH4']) ``` -------------------------------- ### Install Pre-installation Dependencies Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Install required Python packages before proceeding with the main installation. ```bash pip install numpy meson-python ninja ``` -------------------------------- ### Initialize Retrieval Model Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/retrieval_models.ipynb Example of setting up a retrieval model instance. ```python from petitRADTRANS import Retrieval retrieval = Retrieval(line_species=['H2O', 'CH4'], cloud_species=['Mg2SiO4(c)'], rayleigh_species=['H2', 'He']) ``` -------------------------------- ### Example Utility Function Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/utility_functions.ipynb A placeholder example demonstrating the structure of utility functions in the project. ```python def example_utility(data): """Example utility function.""" return data * 2 ``` -------------------------------- ### Example Utility Function Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/utility_functions.ipynb A placeholder example demonstrating the structure of utility functions. ```python def example_utility(x): return x * 2 ``` -------------------------------- ### Generate High Resolution Spectra Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/high_resolution_spectra.ipynb Example demonstrating the setup and generation of a high-resolution spectrum. ```python import numpy as np from petitRADTRANS import Radtrans # Setup the atmosphere atmosphere = Radtrans(line_species=['CO2', 'H2O'], rayleigh_species=['H2', 'He']) atmosphere.setup_opa_structure(pressures=np.logspace(-6, 2, 100)) # Calculate spectrum atmosphere.calc_flux(temperature=1500, mass_fractions={'CO2': 1e-4, 'H2O': 1e-4}, gravity=1e3) # Access the high resolution spectrum wavelengths = atmosphere.wavelength flux = atmosphere.flux ``` -------------------------------- ### Setup Atmosphere Parameters Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/rebinning_opacities.ipynb Initializes temperature and mass fraction arrays for atmospheric modeling. ```python from petitRADTRANS import physical_constants as cst temperatures = 1200.0 * np.ones_like(atmosphere.pressures) # note that pressures is in cgs units now, multiply by 1e-6 to get bars. mass_fractions = { 'H2': 0.74 * np.ones_like(temperatures), 'He': 0.24 * np.ones_like(temperatures), 'H2O': 1e-3 * np.ones_like(temperatures), 'CO-NatAbund': 1e-2 * np.ones_like(temperatures), ``` -------------------------------- ### Install dependencies on Linux Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Use apt-get to install the necessary Python, pip, Fortran compiler, and Chromium packages. ```bash sudo apt-get install python python-pip gfortran chromium ``` -------------------------------- ### Install Fortran compiler on Mac OS Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Install the GCC compiler suite using Homebrew. ```bash brew install gcc ``` -------------------------------- ### Install development dependencies Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/contributing.rst Install the package in editable mode with test dependencies. ```bash pip install -e .[test] --no-build-isolation ``` -------------------------------- ### Setup Temperature Profile and Atmospheric Parameters Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/rebinning_opacities.ipynb Initializes the temperature profile and atmospheric parameters required for rebinning opacities. ```python from petitRADTRANS.physics import temperature_profile_function_guillot_global planet_radius = 1.0*cst.r_jup_mean reference_gravity = 10**3.5 reference_pressure = 0.01 pressures_bar = atmosphere_high_res.pressures*1e-6 # cgs to bar kappa_IR = 0.01 gamma = 0.4 T_int = 200. ``` -------------------------------- ### Initialize Retrieval Model Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/retrieval_models.ipynb Example of initializing a retrieval model instance. ```python AAAAA9mAPA6CONlVYjmhAy2Q2vAYAAAAAAADQ6FEYAHW06WTFwiDFoSQAAAAAAAAAYB8KA6COKAwAAAAAAAAARCIKA6AO8koD2pNbaBkb0IrCAAAAAAAAAEDjR2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SXdGVxvIDZQ4kAQAAAAAAAIDQozAAqpEcU7kwyAsEHEgCAAAAAAAAAKHnOvsliARut1sul/XH7fF45PF4HEoU/pJclf95MMMAAAAAAAAAQDjyer3yer3B40A9vvxsmCY7uUYav9+v9PR0y5jP51NaWppDiRon0zQV+8onls2O108erkGpzRxMBQAAAAAAAABnV5/nxCxJBFTDMIxKyxLlMcMAAAAAAAAAQISiMABqkFxhWaK8UvYwAAAAAAAAABCZKAyAGlScYZBbygwDAAAAAAAAAJGJwgCoQWpcjOXYV1TsUBIAAAAAAAAACC0KA6AG7RLiLMeHCigMAAAAAAAAAEQmCgOgBu0SrYXB4UIKAwAAAAAAAACRyXX2SxAJ3G63XBU28PV4PPJ4PA4lahzaV5hhcJgZBgAAAAAAAADCkNfrldfrDR4HAoE634PCoIlYvny50tLSnI7R6DDDAAAAAAAAAEBjUPEL4n6/X+np6XW6R60Lg88++6xON7ZTq1at1L9/f8c+H01XxT0MDheWOJQEAAAAAAAAAEKr1oXB6NGjZRhGKLNUa+LEiXr//fcd+Ww0bRVnGPiLSlRaXq6YKLb/AAAAAAAAABBZ6rwkkWmaocgBhKWKexhI0pHCYnVKSnAgDQAAAAAAAACIC ``` -------------------------------- ### Run Retrieval Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/retrieval_models.ipynb Example of executing the retrieval process. ```python retrieval.run(n_live_points=500, output_dir='output_dir', resume=False) ``` -------------------------------- ### Initialize High Resolution Spectra Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/high_resolution_spectra.ipynb Basic setup for high-resolution spectral calculations. ```python from petitRADTRANS import Radtrans import numpy as np # Define the atmosphere atmosphere = Radtrans(line_species=['H2O', 'CO2'], rayleigh_species=['H2', 'He'], continuum_opacities=['H2-H2', 'H2-He'], wlen_bords_micron=[0.3, 15.0]) ``` -------------------------------- ### Compile petitRADTRANS from Source Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Clone the repository and install from the local directory. ```bash git clone https://gitlab.com/mauricemolli/petitRADTRANS.git ``` ```bash pip install . --no-build-isolation ``` ```bash pip install ".[retrieval]" --no-build-isolation ``` -------------------------------- ### Handle opacity file selection prompt Source: https://petitradtrans.readthedocs.io/en/latest/content/installation.html Example of the prompt displayed when multiple opacity files are detected and user input is required. ```text More than one file detected in and no default file set for this path in petitRADTRANS' configuration Please select one of the files in the list below by typing the corresponding integer: ``` -------------------------------- ### Initialize High Resolution Spectra Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/high_resolution_spectra.ipynb Setup the necessary environment and imports to begin working with high-resolution spectra. ```python from petitRADTRANS import Radtrans import numpy as np import matplotlib.pyplot as plt ``` -------------------------------- ### Rebinning Opacities Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/rebinning_opacities.ipynb Example demonstrating how to rebin opacity data to a lower resolution. ```python import numpy as np from petitRADTRANS import Radtrans # Define the atmosphere and rebin the opacities rt = Radtrans(line_species=['H2O'], rayleigh_species=['H2'], continuum_species=['H2-H2', 'H2-He']) rt.rebin_opacities(1000) ``` -------------------------------- ### Run tests with tox and conda Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/contributing.rst Example commands to set up a conda environment and execute specific tox test environments. ```bash conda create --name toxfun python=3.11 conda activate toxfun pip install tox pip install tox-conda conda install numba tox -e flake8 tox -e py311 ``` -------------------------------- ### Example Output Keys Source: https://petitradtrans.readthedocs.io/en/latest/content/notebooks/retrieval_multiple_data.html Displays the keys returned by the model generating function after enabling the output parameters. ```text opacities continuum_opacities_scattering transmission_contribution ``` -------------------------------- ### Initial Radtrans opacity loading output Source: https://petitradtrans.readthedocs.io/en/latest/content/notebooks/rebinning_opacities.html Example console output showing the loading process for line and CIA opacities. ```text Loading Radtrans opacities... Loading line opacities of species 'H2O.R100' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/H2O/1H2-16O/1H2-16O__HITEMP.R100_0.1-250mu.ktable.petitRADTRANS.h5'... Done. Done.ng line opacities of species 'CO-NatAbund.R100' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/CO/C-O-NatAbund/C-O-NatAbund__HITEMP.R100_0.1-250mu.ktable.petitRADTRANS.h5'... Done.ng line opacities of species 'CH4.R100' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/CH4/12C-1H4/12C-1H4__YT34to10.R100_0.3-50mu.ktable.petitRADTRANS.h5'... Done.ng line opacities of species 'CO2.R100' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/CO2/12C-16O2/12C-16O2__UCL-4000.R100_0.3-50mu.ktable.petitRADTRANS.h5'... Loading line opacities of species 'Na.R100' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/Na/23Na/23Na__Allard.R100_0.1-250mu.ktable.petitRADTRANS.h5'... Done. Loading line opacities of species 'K.R100' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/K/39K/39K__Allard.R100_0.1-250mu.ktable.petitRADTRANS.h5'... Done. Successfully loaded all line opacities Loading CIA opacities for H2--H2 from file '/home/dblain/petitRADTRANS/input_data/opacities/continuum/collision_induced_absorptions/H2--H2/H2--H2-NatAbund/H2--H2-NatAbund__BoRi.R831_0.6-250mu.ciatable.petitRADTRANS.h5'... Done. Loading CIA opacities for H2--He from file '/home/dblain/petitRADTRANS/input_data/opacities/continuum/collision_induced_absorptions/H2--He/H2--He-NatAbund/H2--He-NatAbund__BoRi.DeltaWavenumber2_0.5-500mu.ciatable.petitRADTRANS.h5'... Done. Successfully loaded all CIA opacities Successfully loaded all opacities ``` -------------------------------- ### Prepare Homebrew on Mac OS Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Update and check the Homebrew environment before installing dependencies. ```bash brew update brew upgrade brew doctor ``` -------------------------------- ### Load Opacities for Emission Spectra Source: https://petitradtrans.readthedocs.io/en/latest/content/notebooks/including_clouds.html Example output showing the successful loading of line, CIA, and cloud opacities for a petitRADTRANS simulation. ```text Loading Radtrans opacities... Loading line opacities of species 'H2O' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/H2O/1H2-16O/1H2-16O__HITEMP.R1000_0.1-250mu.ktable.petitRADTRANS.h5'... Done. Done.ng line opacities of species 'CO-NatAbund' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/CO/C-O-NatAbund/C-O-NatAbund__HITEMP.R1000_0.1-250mu.ktable.petitRADTRANS.h5'... Done.ng line opacities of species 'CH4' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/CH4/12C-1H4/12C-1H4__YT34to10.R1000_0.3-50mu.ktable.petitRADTRANS.h5'... Loading line opacities of species 'CO2' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/CO2/12C-16O2/12C-16O2__UCL-4000.R1000_0.3-50mu.ktable.petitRADTRANS.h5'... Done. Loading line opacities of species 'Na' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/Na/23Na/23Na__Allard.R1000_0.1-250mu.ktable.petitRADTRANS.h5'... Done. Done.ng line opacities of species 'K' from file '/home/dblain/petitRADTRANS/input_data/opacities/lines/correlated_k/K/39K/39K__Allard.R1000_0.1-250mu.ktable.petitRADTRANS.h5'... Successfully loaded all line opacities Loading CIA opacities for H2--H2 from file '/home/dblain/petitRADTRANS/input_data/opacities/continuum/collision_induced_absorptions/H2--H2/H2--H2-NatAbund/H2--H2-NatAbund__BoRi.R831_0.6-250mu.ciatable.petitRADTRANS.h5'... Done. Loading CIA opacities for H2--He from file '/home/dblain/petitRADTRANS/input_data/opacities/continuum/collision_induced_absorptions/H2--He/H2--He-NatAbund/H2--He-NatAbund__BoRi.DeltaWavenumber2_0.5-500mu.ciatable.petitRADTRANS.h5'... Done. Successfully loaded all CIA opacities Loading opacities of cloud species 'Mg2SiO4(s)_crystalline__DHS' from file '/home/dblain/petitRADTRANS/input_data/opacities/continuum/clouds/Mg2SiO4(s)_crystalline_000/Mg2-Si-O4-NatAbund(s)_crystalline_000/Mg2-Si-O4-NatAbund(s)_crystalline_000__DHS.R39_0.1-250mu.cotable.petitRADTRANS.h5' (crystalline_000, using DHS scattering)... Done. Loading opacities of cloud species 'Fe(s)_amorphous__Mie' from file '/home/dblain/petitRADTRANS/input_data/opacities/continuum/clouds/Fe(s)_amorphous/Fe-NatAbund(s)_amorphous/Fe-NatAbund(s)_amorphous__Mie.R39_0.1-250mu.cotable.petitRADTRANS.h5' (amorphous, using Mie scattering)... Done. Successfully loaded all clouds opacities Successfully loaded all opacities ``` -------------------------------- ### Configure Species Pressure Broadening Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/adding_opacities.rst Example configuration for species pressure broadening using specific broadening files for H2 and He. ```bash species 0 gamma 0.06 n 0.5 t0 296 file path_toH2_broadening_information_file model J ratio 0.860000 1 gamma 0.06 n 0.5 t0 296 file path_toHe_broadening_information_file model J ratio 0.140000 end ``` -------------------------------- ### setup_exoatmos Source: https://petitradtrans.readthedocs.io/en/latest/_sources/autoapi/petitRADTRANS/chemistry/prt_easychem/index.rst Initializes the exoatmos environment. ```APIDOC ## setup_exoatmos() ### Description Performs the necessary setup operations for exoatmos calculations. ``` -------------------------------- ### setup_data(scaling=10, width=3) Source: https://petitradtrans.readthedocs.io/en/latest/_sources/autoapi/petitRADTRANS/retrieval/retrieval/index.rst Creates a pRT object for each data set and prepares low resolution c-k models if necessary. ```APIDOC ## setup_data(scaling=10, width=3) ### Description Initializes pRT objects for data sets and ensures low-resolution c-k models are available. The scaling and width parameters configure the AMR grid. ### Parameters - **scaling** (int) - Optional - Multiplicative factor for the high-resolution pressure grid size. - **width** (int) - Optional - Number of cells in the low-pressure grid to replace with the high-resolution grid. ``` -------------------------------- ### setup_data(scaling=10, width=3) Source: https://petitradtrans.readthedocs.io/en/latest/autoapi/petitRADTRANS/retrieval/index.html Creates pRT objects for data sets and prepares AMR grids. ```APIDOC ## setup_data(scaling=10, width=3) ### Description Creates a pRT object for each data set and checks for low resolution c-k models, creating them if necessary. The scaling and width parameters adjust the AMR grid. ### Parameters - **scaling** (int) - Optional - Multiplicative factor for the high resolution pressure grid size. - **width** (int) - Optional - Number of cells in the low pressure grid to replace with the high resolution grid. ``` -------------------------------- ### Initialize Planet Atmosphere Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/planet.ipynb Sets up the atmospheric structure for a planet, including pressure levels and atmospheric composition. ```python import numpy as np from petitRADTRANS import Radtrans # Define pressure levels pressures = np.logspace(-6, 2, 100) # Initialize Radtrans object atmosphere = Radtrans(line_species=['H2O', 'CH4'], rayleigh_species=['H2', 'He'], continuum_opacities=['H2-H2', 'H2-He'], pressure_grid=pressures, r_pl=1.0, p_n_range=[1e-6, 1e2]) ``` -------------------------------- ### Install mpi4py via Conda Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Install the conda-specific version of mpi4py to resolve library linking issues. ```bash conda install mpi4py ``` -------------------------------- ### Install petitRADTRANS via pip Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Install the package using pip with the required build isolation flag. ```bash pip install petitRADTRANS --no-build-isolation ``` ```bash pip install "petitRADTRANS[retrieval]" --no-build-isolation ``` -------------------------------- ### setup_clouds(pressures, parameters, cloud_species) Source: https://petitradtrans.readthedocs.io/en/latest/autoapi/petitRADTRANS/chemistry/clouds/index.html Provides the set of cloud parameters used in the model. ```APIDOC ## setup_clouds(pressures, parameters, cloud_species) ### Description This function provides the set of cloud parameters used in the model. ### Parameters - **pressures** - The pressure array for the model. - **parameters** - The dictionary of model parameters. - **cloud_species** - A list of cloud species to include. ``` -------------------------------- ### Identify Installation Errors Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Common error messages encountered when Fortran extensions are incorrectly installed in temporary directories. ```python # For a pip install ModuleNotFoundError: No module named 'petitRADTRANS.' # For an editable pip install FileNotFoundError: [Errno 2] No such file or directory: '/a/temporary/directory/overlay/bin/ninja' ``` -------------------------------- ### Initialize Environment and Imports Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/retrieval_models.ipynb Sets up the necessary environment by importing required libraries and configuring the plotting style. ```python # Let's start by importing everything we need import os import matplotlib.pyplot as plt import numpy as np import petitRADTRANS as prt from petitRADTRANS import physical_constants as cst from petitRADTRANS.retrieval.parameter import Parameter from petitRADTRANS.plotlib.style import set_petitradtrans_plot_style set_petitradtrans_plot_style() ``` -------------------------------- ### setup_simple_clouds_hazes(parameters) Source: https://petitradtrans.readthedocs.io/en/latest/_sources/autoapi/petitRADTRANS/chemistry/clouds/index.rst Sets up clouds for transmission spectrum calculations. ```APIDOC ### Function: setup_simple_clouds_hazes(parameters) #### Description Setup clouds for transmission spectrum. #### Parameters - **parameters** (dict) - Dictionary of atmospheric parameters. ``` -------------------------------- ### Instantiate SpectralModel with SysRem Source: https://petitradtrans.readthedocs.io/en/latest/content/notebooks/spectral_model.html Configure the SpectralModel by mapping the preparation step to the custom wrapper and providing SysRem-specific parameters. ```python spectral_model = SpectralModel( # Preparation parameters spectral_modification_functions_map={ 'prepare': sysrem_wrapper # modify the preparation step }, n_passes=10, n_iterations_max=300, convergence_criterion=1e-15, tellurics_mask_threshold=0.8, # mask the fitted transmittances if it is below this value polynomial_fit_degree=2, # degree of the polynomial fit uncertainties=data_uncertainties, # Radtrans parameters pressures=np.logspace(-6, 2, 100), line_species=[ 'CO-NatAbund', 'H2O' ], rayleigh_species=['H2', 'He'], gas_continuum_contributors=['H2--H2', 'H2--He'], line_opacity_mode='lbl', line_by_line_opacity_sampling=4, # SpectralModel parameters # Planet parameters planet_radius=planet.radius, reference_gravity=planet.reference_gravity, reference_pressure=1e-2, star_radius=planet.star_radius, transit_duration=planet.transit_duration, orbital_period=planet.orbital_period, # Velocity paramters star_mass=planet.star_mass, orbit_semi_major_axis=planet.orbit_semi_major_axis, orbital_inclination=planet.orbital_inclination, rest_frame_velocity_shift=-5e5, # (cm.s-1) V_rest system_observer_radial_velocities=star_radial_velocity - barycentric_velocities, # Temperature profile parameters temperature_profile_mode='isothermal', temperature=planet.equilibrium_temperature, # Cloud parameters opaque_cloud_top_pressure=1e-2, # added opaque cloud # Mass fractions use_equilibrium_chemistry=False, imposed_mass_fractions={ 'CO-NatAbund': 1e-2, 'H2O': 1e-3, }, filling_species={ 'H2': 37, 'He': 12 }, # Observation parameters rebinned_wavelengths=data_wavelengths, # (cm) used for the rebinning, and also to set the wavelengths boundaries rebin_range_margin_power=4, # used to set the wavelengths boundaries, adding a margin of ~1 Angstrom (1e-4 * ~1 µm) convolve_resolving_power=8e4, # used for the convolution mid_transit_time=mid_transit_time, times=times ) ``` -------------------------------- ### Install Python via Deadsnakes on Linux Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/installation.rst Commands to add the deadsnakes PPA and install a specific Python version and its development headers. ```bash sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update sudo apt-get install pkg-config sudo apt-get install python3.x sudo apt-get install python3.x-dev ``` -------------------------------- ### Initialize SpectralModel with Cloud Parameters Source: https://petitradtrans.readthedocs.io/en/latest/content/notebooks/including_clouds.html Configure a SpectralModel instance with physical cloud parameters, gas species, and planet properties. ```python spectral_model = SpectralModel( # Cloud parameters eddy_diffusion_coefficients=eddy_diffusion_coefficients, cloud_f_sed=cloud_f_sed, cloud_particle_radius_distribution_std=cloud_particle_radius_distribution_std, complete_coverage_clouds=['Fe(s)_amorphous__Mie'], cloud_fraction=1.0, # Other cloud parameters #opaque_cloud_top_pressure=1e-2, #haze_factor=10, #power_law_opacity_350nm=power_law_opacity_350nm, #power_law_opacity_coefficient=power_law_opacity_coefficient, #additional_absorption_opacities_function=cloud_opas, # Radtrans parameters pressures=np.logspace(-6, 2, 100), line_species=[ 'H2O', 'CO-NatAbund', 'CH4', 'CO2', 'Na', 'K' ], rayleigh_species=['H2', 'He'], gas_continuum_contributors=['H2--H2', 'H2--He'], cloud_species = [ 'Mg2SiO4(s)_crystalline__DHS', 'Fe(s)_amorphous__Mie' ], wavelength_boundaries=[0.3, 15], # Model parameters # Planet parameters planet_radius=planet_radius, reference_gravity=reference_gravity, reference_pressure=reference_pressure, # Temperature profile parameters temperature_profile_mode='guillot', temperature=equilibrium_temperature, intrinsic_temperature=intrinsic_temperature, guillot_temperature_profile_infrared_mean_opacity_solar_metallicity=infrared_mean_opacity, guillot_temperature_profile_gamma=gamma, # Mass fractions imposed_mass_fractions={ 'H2O': 1e-3, 'CO-NatAbund': 1e-2, 'CH4': 1e-6, 'CO2': 1e-5, 'Na': 1e-5, 'K': 1e-6, 'Mg2SiO4(s)_crystalline__DHS': 5e-7, 'Fe(s)_amorphous__Mie': 5e-7 }, filling_species={ 'H2': 37, 'He': 12 } ) ``` -------------------------------- ### petitRADTRANS.retrieval.preparing.__sysrem_iteration_orders_a Source: https://petitradtrans.readthedocs.io/en/latest/autoapi/petitRADTRANS/retrieval/preparing/index.html Performs a SYSREM iteration for all orders starting with the 'a' parameter. ```APIDOC ## petitRADTRANS.retrieval.preparing.__sysrem_iteration_orders_a(spectrum_uncertainties_squared, uncertainties_squared_inverted, a) ### Description Performs a SYSREM iteration for all orders at once, starting with 'a'. For the first iteration, 'a' should be 1. The inputs are chosen to maximize speed. ### Parameters - **spectrum_uncertainties_squared** (array) - Spectral data to correct over the uncertainties squared (..., exposure, wavelength). - **uncertainties_squared_inverted** (array) - Inverse of the squared uncertainties on the data (..., exposure, wavelength). - **a** (array) - 2-D matrix (..., exposures, wavelengths) containing the a-priori 'airmass'. ### Returns - **tuple** - The lower-rank estimation of the spectrum (systematics) and the estimated 'extinction coefficients'. ``` -------------------------------- ### Check petitRADTRANS Version Source: https://petitradtrans.readthedocs.io/en/latest/_sources/content/notebooks/getting_started.ipynb Verify the installed version of the petitRADTRANS package. ```python import petitRADTRANS print(f"petitRADTRANS version: {petitRADTRANS.__version__}") ``` -------------------------------- ### Initialize SpectralModel Source: https://petitradtrans.readthedocs.io/en/latest/content/notebooks/analysis_tools.html Imports and configures a SpectralModel instance with atmospheric parameters, species, and physical properties. ```python from petitRADTRANS.spectral_model import SpectralModel ``` ```python spectral_model = SpectralModel( # Radtrans parameters pressures=np.logspace(-6, 3, 100), line_species=[ 'H2O', 'CO-NatAbund', 'CH4', 'CO2', 'Na__Burrows', 'K__Burrows' ], rayleigh_species=['H2', 'He'], gas_continuum_contributors=['H2--H2', 'H2--He'], cloud_species=['MgSiO3(s)_crystalline__DHS'], wavelength_boundaries=[0.3, 15], # Model parameters temperature=temperatures, imposed_mass_fractions={ # using constant mass fractions with pressure 'H2O': 1e-3, 'CO-NatAbund': 1e-2, 'CO2': 1e-4, 'CH4': 1e-5, 'Na__Burrows': 1e-4, 'K__Burrows': 1e-6, 'MgSiO3(s)_crystalline__DHS': 1e-6 }, filling_species={'H2': 37, 'He': 12}, cloud_particles_mean_radii={'MgSiO3(s)_crystalline__DHS': 1e-4}, # (cm) cloud_particle_radius_distribution_std=2, # 1 for a delta function reference_gravity=reference_gravity, planet_radius=planet_radius, reference_pressure=reference_pressure ) ``` -------------------------------- ### Data Class Placeholder Source: https://petitradtrans.readthedocs.io/en/latest/content/notebooks/retrieval_basic.html Placeholder for Data class configuration examples. ```python [5]: ``` -------------------------------- ### petitRADTRANS.retrieval.preparing.__sysrem_iteration_orders_c Source: https://petitradtrans.readthedocs.io/en/latest/autoapi/petitRADTRANS/retrieval/preparing/index.html Performs a SYSREM iteration for all orders starting with the 'c' parameter. ```APIDOC ## petitRADTRANS.retrieval.preparing.__sysrem_iteration_orders_c(spectrum_uncertainties_squared, uncertainties_squared_inverted, c) ### Description Performs a SYSREM iteration for all orders at once, starting with 'c'. For the first iteration, 'c' should be 1. The inputs are chosen to maximize speed. ### Parameters - **spectrum_uncertainties_squared** (array) - Spectral data to correct over the uncertainties squared (..., exposure, wavelength). - **uncertainties_squared_inverted** (array) - Inverse of the squared uncertainties on the data (..., exposure, wavelength). - **c** (array) - 2-D matrix (..., exposures, wavelengths) containing the a-priori 'extinction coefficients'. ### Returns - **tuple** - The lower-rank estimation of the spectrum (systematics) and the estimated 'extinction coefficients'. ``` -------------------------------- ### list_available_cia_species() Source: https://petitradtrans.readthedocs.io/en/latest/_sources/autoapi/petitRADTRANS/retrieval/index.rst Lists the currently installed opacity tables available for CIA species. ```APIDOC ### Method `list_available_cia_species()` ### Description Returns a list of currently installed opacity tables available for CIA species. ``` -------------------------------- ### list_available_cloud_species() Source: https://petitradtrans.readthedocs.io/en/latest/_sources/autoapi/petitRADTRANS/retrieval/index.rst Lists the currently installed opacity tables available for cloud species. ```APIDOC ### Method `list_available_cloud_species()` ### Description Returns a list of currently installed opacity tables available for cloud species. ```