slophep.Predictions.SamplingFluctuate

class slophep.Predictions.SamplingFluctuate.SamplingHelper(obs)[source]

Bases: object

clear_fluctuations()[source]

Clear produced fluctuations

property constants: dict[float]

Parameters that are kept constant in fluctuation and their values. If they are here, they SHOULD NOT be in self.params

property corr: ndarray

Correlation matrix of parameters

property cov: ndarray

Covariance matrix of parameters

property err: dict[float]

Error values for the parameters

property errtype: str

Error type, should be Symmetric or Asymmetric

fluctuate(N: int, seed: int = None)[source]

Produce N gaussian/bifurcated gaussian fluctuations

Parameters:
  • N (int) – Number of fluctuations

  • seed (int, optional) – numpy random seed, by default None

property fluctuations: list | ndarray

List of fluctuations generated

get_error(attr: str, attr_args: list = [], cl: float = 0.683, return_all: bool = False)[source]

Gets an error using produced fluctations for a spcified CL

Parameters:
  • attr (str) – The attribute/method in self.obs to compute

  • attr_args (list) – Arguments to be passed to that attribute, by default an empty list which means no arguments to pass

  • cl (float, optional) – CL to asses error for, by default 0.683

  • return_all (bool, optional) – Whether to return a list with all the fluctiations (only) rather than the errors, by default False

property mean: dict[float]

Nominal/mean values for the parameters

property nominal: dict[float]

Alias for mean

property obs

Observable/FF object to fluctuate

property params: list[str]

List of fluctuated params names, in order as they appear in cov matrix

set_params_asymmetric(param_names: list[str], mean: dict, errlo: dict, errhi: dict, corr: list | ndarray, constants: dict = {})[source]

Sets parameters necessary for fluctuation, for asymmetric gaussian errors

Parameters:
  • param_names (list[str]) – “List of fluctuated params names, in order as they appear in cov matrix

  • mean (dict) – Nominal/mean values for the parameters

  • errlo (dict) – Size of lower error

  • errhi (dict) – Size of upper error

  • corr (list | np.ndarray) – Correlation matrix

  • constants (dict, optional) – Dictinoary of parameters that are set constant - for specific use-cases with fluctuate e.g. in case want to set a particular WC to some non-zero value for all fluctations. In principle FF that are not in params should be kept the same so shouldn’t need to pass them here.

set_params_from_configfile(inpath: str)[source]

Set parameters for fluctuation from a json file

Parameters:

inpath (str) – Path to json file

set_params_symmetric(param_names: list[str], mean: dict, cov: list | ndarray, constants: dict = {})[source]

Sets parameters necessary for fluctuation, for symmetric gaussian errors

Parameters:
  • param_names (list[str]) – List of fluctuated params names, in order as they appear in cov matrix

  • mean (dict) – Nominal/mean values for the parameters

  • cov (list | np.ndarray) – Covariance matrix

  • constants (dict, optional) – Dictinoary of parameters that are set constant - for specific use-cases with fluctuate e.g. in case want to set a particular WC to some non-zero value for all fluctations. In principle FF that are not in params should be kept the same so shouldn’t need to pass them here.