beetroots.approx_optim.forward_map package

Submodules

beetroots.approx_optim.forward_map.abstract_forward_map module

class beetroots.approx_optim.forward_map.abstract_forward_map.ApproxOptimForwardMap[source]

Bases: ABC

abstract class that handles the generation of a dataset of \(\log_{10} f_{\ell}(\theta)\) values

abstract compute_log10_f_Theta()[source]

Evaluates \(\log_{10} f\) on a list of self.N_samples_theta \(\theta\) values, each randomly generated in the hypercube defined by its lower and upper bounds.

Parameters:
  • forward_model_name (str) – name of the forward model to load (i.e., of the corresponding folder)

  • angle (float) – angle at which the cloud is observed

  • lower_bounds_lin (np.ndarray of shape (D,)) – array of lower bounds in linear scale

  • upper_bounds_lin (np.ndarray of shape (D,)) – array of upper bounds in linear scale

Returns:

evaluations of the self.N_samples_theta \(\theta\) values for the L considered lines.

Return type:

np.ndarray of shape (self.N_samples_theta, L)

scale_dict_fixed_params(scaler: Scaler, dict_fixed_params: Dict[str, float | None]) Dict[str, float | None][source]

transforms the fixed parameters from their value in their natural spae to their value in the space in which they are to be sampled.

Note

since the scaler does not accept None or np.NaN, this transformation really needed a dedicated (though simple) method

Parameters:
  • scaler (Scaler) – contains the transformation of the physical parameters values from their natural space to their scaled space (in which the sampling happens) and its inverse

  • dict_fixed_params (Dict[str, Optional[float]]) – contains the value of the fixed parameters in the physical parameter natural space. For example, {“kappa”:None, “Pth”:None, “G0”:None, “AV”:None, “angle”:0.} (the values with None indicate that the parameter is not fixed, so here, only the angle is set, to 0 degree).

Returns:

contains the value of the fixed parameters in the space in which the physical parameter are to be sampled

Return type:

Dict[str, Optional[float]]

beetroots.approx_optim.forward_map.nn module

class beetroots.approx_optim.forward_map.nn.ApproxOptimNN[source]

Bases: ApproxOptimForwardMap

handles the generation of a dataset of \(\log_{10} f_{\ell}(\theta)\) values for a neural network forward map

compute_log10_f_Theta(dict_forward_model: dict, lower_bounds_lin: ndarray, upper_bounds_lin: ndarray) ndarray[source]

Evaluates \(\log_{10} f\) on a list of self.N_samples_theta \(\theta\) values, each randomly generated in the hypercube defined by its lower and upper bounds.

Parameters:
  • forward_model_name (str) – name of the forward model to load (i.e., of the corresponding folder)

  • angle (float) – angle at which the cloud is observed

  • lower_bounds_lin (np.ndarray of shape (D,)) – array of lower bounds in linear scale

  • upper_bounds_lin (np.ndarray of shape (D,)) – array of upper bounds in linear scale

Returns:

evaluations of the self.N_samples_theta \(\theta\) values for the L considered lines.

Return type:

np.ndarray of shape (self.N_samples_theta, L)

setup_forward_map(forward_model_name: str, force_use_cpu: bool, fixed_params: Dict[str, float | None], is_log_scale_params: Dict[str, bool]) Tuple[MyScaler, NeuralNetworkApprox][source]

beetroots.approx_optim.forward_map.poly_reg module

class beetroots.approx_optim.forward_map.poly_reg.ApproxOptimPolynomialReg[source]

Bases: ApproxOptimForwardMap

handles the generation of a dataset of \(\log_{10} f_{\ell}(\theta)\) values for a polynomial forward map

Warning

Unfinished class. Needs to be updated for D_sampling to remove the angle parameter. Needs work on the PolynomialApprox class

compute_log10_f_Theta(dict_forward_model: dict, lower_bounds_lin: ndarray, upper_bounds_lin: ndarray)[source]

Unfinished method. Needs to be updated for D_sampling to remove the angle parameter. Needs work on the PolynomialApprox class

setup_forward_map(forward_model_name: str, dict_fixed_params: Dict[str, float | None], dict_is_log_scale_params: Dict[str, bool]) Tuple[MyScaler, PolynomialApprox][source]

Module contents