Configuration

Contents

Configuration#

Configuration Dataclasses#

These dataclasses define the sections of a ForMoSA configuration file.

class ForMoSA.config.global_config.ConfigPath(observation_path=<factory>, adapt_store_path=<factory>, result_path=<factory>, model_path=<factory>)[source]#

Bases: object

Parameters:
observation_path: list[str | PathLike]#
adapt_store_path: str | PathLike#
result_path: str | PathLike#
model_path: str | PathLike#
__post_init__()[source]#

Check paths types.

Notes

Authors: Allan Denis

Return type:

None

set_params(**kwargs)[source]#

Update paths

Parameters:

**kwargs (dict) – Keyword arguments to override attributes of the config

Return type:

None

Notes

Authors: Allan Denis

class ForMoSA.config.global_config.ConfigAdapt(method='linear', emulator=<factory>, target_res_obs=<factory>, target_res_mod=<factory>, wav_cont=<factory>, res_cont=<factory>, backend='loky', n_jobs=4)[source]#

Bases: object

Parameters:
method: str = 'linear'#
emulator: list[str]#
target_res_obs: list[str | float]#
target_res_mod: list[str | float]#
wav_cont: list[str | float]#
res_cont: list[str | float]#
backend: str = 'loky'#
n_jobs: int = 4#
__post_init__()[source]#

Check adapt configuration parameters and normalize types.

Notes

Authors: Allan Denis

Return type:

None

set_params(**kwargs)[source]#

Update parameters of ConfigAdapt

Parameters:

**kwargs (dict) – Keyword arguments to override attributes of the config

Return type:

None

Notes

Authors: Allan Denis

class ForMoSA.config.global_config.ConfigInversion(logL_type=<factory>, wav_fit=<factory>, ns_algo=<factory>, npoints=<factory>, hc_lower_bounds_lsq=<factory>, hc_higher_bounds_lsq=<factory>)[source]#

Bases: object

Parameters:
logL_type: List[str]#
wav_fit: List[str]#
ns_algo: str#
npoints: int#
hc_lower_bounds_lsq: list[float | str]#
hc_higher_bounds_lsq: list[float | str]#
__post_init__()[source]#

Check inversion configuration parameters and normalize types.

Notes

Authors: Allan Denis

Return type:

None

property hc_bounds: list[tuple[float, float]]#
set_params(**kwargs)[source]#

Update parameters of ConfigInversion

Parameters:

**kwargs (dict) – Keyword arguments to override attributes of the config

Return type:

None

Notes

Authors: Allan Denis

class ForMoSA.config.global_config.ConfigParameters(par1=<factory>, par2=<factory>, par3=<factory>, par4=<factory>, r=<factory>, d=<factory>, alpha=<factory>, bb_T=<factory>, bb_R=<factory>, rv=<factory>, vsini=<factory>, ld=<factory>)[source]#

Bases: object

Parameters:
par1: list[str]#
par2: list[str]#
par3: list[str]#
par4: list[str]#
r: list[str]#
d: list[str]#
alpha: list[str]#
bb_T: list[str]#
bb_R: list[str]#
rv: list[str]#
vsini: list[str]#
ld: list[str]#
__post_init__()[source]#

Check parameters configuration.

Notes

Authors: Allan Denis

Return type:

None

property to_dict: dict#

Dictionary representation of ConfigParameters.

set_params(**kwargs)[source]#

Update parameters of ConfigParameters

Parameters:

**kwargs (dict) – Keyword arguments to override attributes of the config

Return type:

None

Notes

Authors: Allan Denis

class ForMoSA.config.global_config.ConfigNestle(method=<factory>, update_interval=<factory>, npdim=<factory>, maxiter=<factory>, maxcall=<factory>, dlogz=<factory>, decline_factor=<factory>, rstate=<factory>)[source]#

Bases: object

Parameters:
method: str#
update_interval: float#
npdim: int#
maxiter: int#
maxcall: int#
dlogz: float#
decline_factor: float#
rstate: Any#
__post_init__()[source]#

Check Nestle configuration parameters and normalize types.

Notes

Authors: Allan Denis

Return type:

None

property to_dict: dict#

Dictionary representation of ConfigNestle.

classmethod from_dict(data)[source]#

Build an instance of ConfigNestle from dictionary of Nestle parameters.

Parameters:

data (dict) – Dictionary of Nestle parameters

Return type:

ConfigNestle

Returns:

‘ConfigNestle’ – An instance of class ConfigNestle

Notes

Authors: Allan Denis

set_params(**kwargs)[source]#

Update parameters of ConfigNestle

Parameters:

**kwargs (dict) – Keyword arguments to override attributes of the config

Return type:

None

Notes

Authors: Allan Denis

class ForMoSA.config.global_config.ConfigPyMultiNest(importance_nested_sampling=<factory>, multimodal=<factory>, const_efficiency_mode=<factory>, evidence_tolerance=<factory>, sampling_efficiency=<factory>, n_iter_before_update=<factory>, null_log_evidence=<factory>, max_modes=<factory>, mode_tolerance=<factory>, seed=<factory>, verbose=<factory>, resume=<factory>, context=<factory>, log_zero=<factory>, max_iter=<factory>, init_MPI=<factory>, wrapped_params=<factory>, dump_callback=<factory>, use_MPI=<factory>)[source]#

Bases: object

Parameters:
  • importance_nested_sampling (bool)

  • multimodal (bool)

  • const_efficiency_mode (bool)

  • evidence_tolerance (float)

  • sampling_efficiency (float)

  • n_iter_before_update (int)

  • null_log_evidence (float)

  • max_modes (int)

  • mode_tolerance (float)

  • seed (int)

  • verbose (bool)

  • resume (bool)

  • context (int)

  • log_zero (float)

  • max_iter (int)

  • init_MPI (bool)

  • wrapped_params (int)

  • dump_callback (int)

  • use_MPI (bool)

importance_nested_sampling: bool#
multimodal: bool#
const_efficiency_mode: bool#
evidence_tolerance: float#
sampling_efficiency: float#
n_iter_before_update: int#
null_log_evidence: float#
max_modes: int#
mode_tolerance: float#
seed: int#
verbose: bool#
resume: bool#
context: int#
log_zero: float#
max_iter: int#
init_MPI: bool#
wrapped_params: int#
dump_callback: int#
use_MPI: bool#
__post_init__()[source]#

Check PyMultiNest configuration parameters and normalize types.

Notes

Authors: Allan Denis

Return type:

None

property to_dict: dict#

Dictionary representation of ConfigPyMultiNest.

classmethod from_dict(data)[source]#

Build an instance of ConfigPyMultiNest from dictionary of PyMultiNest parameters.

Parameters:

data (dict) – Dictionary of PyMultiNest parameters

Return type:

ConfigPyMultiNest

Returns:

‘ConfigPyMultiNest’ – An instance of class ConfigPyMultiNest

Notes

Authors: Allan Denis

set_params(**kwargs)[source]#

Update parameters of ConfigPyMultiNest

Parameters:

**kwargs (dict) – Keyword arguments to override attributes of the config

Return type:

None

Notes

Authors: Allan Denis

class ForMoSA.config.global_config.ConfigUltraNest(wrapped_params=<factory>, vectorized=<factory>, resume=<factory>, run_num=<factory>, num_bootstraps=<factory>, storage_backend=<factory>, warmstart_max_tau=<factory>, dlogz=<factory>, max_iters=<factory>, max_ncalls=<factory>, min_ess=<factory>, frac_remain=<factory>, cluster_num_live_points=<factory>, Lepsilon=<factory>)[source]#

Bases: object

Parameters:
  • wrapped_params (bool)

  • vectorized (bool)

  • resume (bool)

  • run_num (int)

  • num_bootstraps (int)

  • storage_backend (str)

  • warmstart_max_tau (int)

  • dlogz (float)

  • max_iters (int)

  • max_ncalls (int)

  • min_ess (int)

  • frac_remain (float)

  • cluster_num_live_points (int)

  • Lepsilon (float)

wrapped_params: bool#
vectorized: bool#
resume: bool#
run_num: int#
num_bootstraps: int#
storage_backend: str#
warmstart_max_tau: int#
dlogz: float#
max_iters: int#
max_ncalls: int#
min_ess: int#
frac_remain: float#
cluster_num_live_points: int#
Lepsilon: float#
__post_init__()[source]#

Check UltraNest configuration parameters and normalize types.

Notes

Authors: Allan Denis

Return type:

None

property ReactiveNSParams: dict#
property runNSParams: dict#
property to_dict: dict#

Dictionary representation of ConfigUltranest.

classmethod from_dict(data)[source]#

Build an instance of ConfigUltraNest from dictionary of UltraNest parameters.

Parameters:

data (dict) – Dictionary of UltraNest parameters

Return type:

ConfigUltraNest

Returns:

‘ConfigUltraNest’ – An instance of class ConfigUltraNest

Notes

Authors: Allan Denis

set_params(**kwargs)[source]#

Update parameters of ConfigUltraNest

Parameters:

**kwargs (dict) – Keyword arguments to override attributes of the config

Return type:

None

Notes

Authors: Allan Denis

class ForMoSA.config.global_config.Config_NS(nestle=<factory>, pymultinest=<factory>, ultranest=<factory>)[source]#

Bases: object

Parameters:
nestle: ConfigNestle#
pymultinest: ConfigPyMultiNest#
ultranest: ConfigUltraNest#
__post_init__()[source]#

Check Config_NS configuration parameters.

Notes

Authors: Allan Denis

Return type:

None

property to_dict: dict#
classmethod from_dict(data)[source]#

Build an instance of Config_NS from a dictionary of data.

Parameters:

data (dict) – Dictionary representation of data

Return type:

Config_NS

Returns:

“Config_NS” – An instance of class Config_NS

Notes

Authors: Allan Denis

set_params(**kwargs)[source]#

Update parameters of Config_NS

Parameters:

**kwargs (dict) – Keyword arguments to override attributes of the config

Return type:

None

Notes

Authors: Allan Denis

class ForMoSA.config.global_config.ConfigGenerator(sections=None, logger=None, log_level='INFO')[source]#

Bases: object

Config file generator.

Parameters:
  • sections (dict) – Dictionary containing sections of the config file

  • logger (Logger | None) – Logger

  • log_level (str) – Level of the Logger

Notes

Authors: Mathieu Ravet and Allan Denis

save(path, name='new_config.ini')[source]#

Save the ConfigGenerator to a given path.

Parameters:
  • path (str | PathLike) – Path where to save the config file

  • name (str) – Name of the config file

Notes

Authors: Allan Denis

class ForMoSA.config.global_config.ConfigLoader(path, logger=None, log_level='INFO')[source]#

Bases: object

Class handling the loading of a config file.

Parameters:
  • path (str | PathLike) – Path to the config file

  • logger (Logger | None) – Logger

  • log_level (str) – Level of the Logger

Notes

Authors: Allan Denis

load()[source]#

Load all the sections of .ini file in dataclasses.

Notes

Authors: Allan Denis

Paths#

The Paths class validates and manages the file-system paths used throughout an analysis run.

class ForMoSA.config.paths.Paths(config_path, logger=None, log_level='info')[source]#

Bases: object

Analysis path class, handles the paths used in the configuration file.

Parameters:
  • config_path (ConfigPath) – Instance of class ConfigPath

  • logger (Logger | None) – Logger

  • log_level (str) – Level of the Logger

Notes

Authors: Allan Denis

property logger#

Logger.

property config_file_path#

Path to the configuration file.

property observation_path#

List of observation paths.

property adapt_store_path#

Path to the adapted store directory.

property result_path#

Path to the results directory.

property model_path#

Path to the model grid file.

property path_error#

Whether a path error was detected.

property observation#

Observation instance.

property grid#

Model grid instance.