GUIBRUSHR.Retrieval.ModelCalculation.ModelSetup module

ModelSetup Module

This module contains the ModelSetup class, extracted from ModelData.py as part of the codebase decomposition. It handles initialization and setup of core state objects for atmospheric retrieval, including reading configuration files, extracting night observation data, and setting up the atmosphere/retrieval/bestpars objects.

class GUIBRUSHR.Retrieval.ModelCalculation.ModelSetup.ModelSetup(param_handler, lbl_sampling_hr, lbl_sampling_lr, path_default, model_type, initial_param_array, start_molec)[source]

Bases: object

Handles initialization and setup of core state objects for atmospheric retrieval.

This class extracts the setup methods from ModelData, responsible for reading configuration files, parsing instrument and target parameters, and initializing the Atmosphere, Retrieval, Bestpars, and Random objects that drive the retrieval.

Variables:
  • param_handler – ParameterHandler instance for parameter management

  • lbl_sampling_hr – Line-by-line sampling override for high resolution

  • lbl_sampling_lr – Line-by-line sampling override for low resolution

  • path_default – Default path for file operations

  • model_type – String identifying the run mode (e.g. ‘Retrieval’, ‘Model’)

  • initial_param_array – Initial parameter values array

  • start_molec – Starting molecule configuration

  • atmosphere – Atmosphere object (populated by setup methods)

  • retrieval_data – Retrieval object (populated by setup methods)

  • bestpars_data – Bestpars object (populated by setup methods)

  • random_obj – Random object (populated by setup methods)

  • wlen_list_overplot – Wavelength lists for overplotting (populated by night_data_extraction)

  • table_output_file – Path to output log file

__init__(param_handler, lbl_sampling_hr, lbl_sampling_lr, path_default, model_type, initial_param_array, start_molec)[source]

Initialize ModelSetup with configuration parameters.

Parameters:
  • param_handler – ParameterHandler instance for parameter management

  • lbl_sampling_hr – Line-by-line sampling override for high resolution

  • lbl_sampling_lr – Line-by-line sampling override for low resolution

  • path_default – Default path for file operations

  • model_type – String identifying the run mode (e.g. ‘Retrieval’, ‘Model’)

  • initial_param_array – Initial parameter values array

  • start_molec – Starting molecule configuration

populate_from_manual_model(manual_model_obj, load_new_opacities, minwlen_lr, maxwlen_lr, minwlen_hr, maxwlen_hr, range_min_press=None, range_max_press=None, nlayers=None)[source]

Populate model data from a manual model object.

This method initializes the model using parameters from a manual model object instead of reading from parameter files. It processes both parameter arrays and molecule lists to set up the atmospheric model.

Parameters:
  • manual_model_obj – Manual model object containing parameters and molecules

  • load_new_opacities – Whether to load new opacity data

  • minwlen_lr – Minimum wavelength for low resolution

  • maxwlen_lr – Maximum wavelength for low resolution

  • minwlen_hr – Minimum wavelength for high resolution

  • maxwlen_hr – Maximum wavelength for high resolution

  • range_min_press – Minimum pressure range

  • range_max_press – Maximum pressure range

  • nlayers – Number of atmospheric layers

read_df_information(path_df_information, df_parameters, id_process, table_output_file, minwlen_lr, maxwlen_lr, minwlen_hr, maxwlen_hr, range_min, range_max, nlayers)[source]

Read and process general information from configuration CSV file.

This method reads the main configuration file containing instrument setup, atmospheric parameters, target properties, and retrieval settings. It initializes all core objects needed for the atmospheric retrieval including instruments, atmosphere, target, and retrieval configuration.

Parameters:
  • path_df_information – Path to the general information CSV file

  • df_parameters – Processed parameter data from read_df_parameters

  • id_process – Process ID for parallel operations

  • table_output_file – Output file for logging

  • minwlen_lr – Minimum wavelength for low resolution

  • maxwlen_lr – Maximum wavelength for low resolution

  • minwlen_hr – Minimum wavelength for high resolution

  • maxwlen_hr – Maximum wavelength for high resolution

  • range_min – Minimum pressure range override (overrides CSV value if provided)

  • range_max – Maximum pressure range override (overrides CSV value if provided)

  • nlayers – Number of atmospheric layers for retrieval

night_data_extraction()[source]

Extract and process night observation data for each instrument.

This method handles the extraction and organization of night observation data, including path setup, file archiving (for retrieval mode), and creation of Night objects for each observation date. The method handles different processing modes (Model, Manual, Retrieval) with appropriate file handling.