redback.likelihoods.GaussianLikelihoodWithSystematicNoise
- class redback.likelihoods.GaussianLikelihoodWithSystematicNoise(*args: Any, **kwargs: Any)[source]
Bases:
GaussianLikelihood- __init__(x: ndarray, y: ndarray, sigma_i: float | None | ndarray, function: callable, kwargs: dict = None, priors=None, fiducial_parameters=None) None[source]
A Gaussian likelihood with a systematic noise term that is proportional to the model + the original data noise added in quadrature. The parameters are inferred from the arguments of function
- Parameters:
x (np.ndarray) – The x values.
y (np.ndarray) – The y values.
sigma_i (Union[float, None, np.ndarray]) – The standard deviation of the noise. This is part of the full noise. The sigma used in the likelihood is sigma = sqrt(sigma_i^2 + model_y**2*sigma^2)
function (callable) – The python function to fit to the data. Note, this must take the dependent variable as its first argument. The other arguments will require a prior and will be sampled over (unless a fixed value is given).
kwargs (dict) – Any additional keywords for ‘function’.
priors – The priors for the parameters. Default to None if not provided.
Only necessary if using maximum likelihood estimation functionality. :type priors: Union[dict, None] :param fiducial_parameters: The starting guesses for model parameters to use in the optimization for maximum likelihood estimation. Default to None if not provided. :type fiducial_parameters: Union[dict, None]
- __call__(*args: Any, **kwargs: Any) Any
Call self as a function.
Methods
__init__(x, y, sigma_i, function[, kwargs, ...])A Gaussian likelihood with a systematic noise term that is proportional to the model + the original data noise added in quadrature.
Estimate the maximum likelihood
get_bounds_from_priors(priors)get_parameter_dictionary_from_list(...)get_parameter_list_from_dictionary(...)lnlike_scipy_maximize(parameter_list)log_likelihood([parameters])Attributes
The standard deviation of the full noise :rtype: Union[float, np.ndarray]
kwargsThe model output for the given x values.
Length of the x/y-values :rtype: int
parametersparameters_to_be_updatedresidualsigma- find_maximum_likelihood_parameters(iterations=5, maximization_kwargs=None, method='Nelder-Mead', break_threshold=0.001)
Estimate the maximum likelihood
- Parameters:
iterations – Iterations to run the minimizer for before stopping. Default is 5.
maximization_kwargs – Any extra keyword arguments passed to the scipy minimize function
method – Minimize method to use. Default is ‘Nelder-Mead’
break_threshold – The threshold for the difference in log likelihood to break the loop. Default is 1e-3.
- Returns:
Dictionary of maximum likelihood parameters
- property full_sigma: float | ndarray
The standard deviation of the full noise :rtype: Union[float, np.ndarray]
- Type:
return
- property model_output: ndarray
The model output for the given x values. :rtype: np.ndarray
- Type:
return
- property n: int
Length of the x/y-values :rtype: int
- Type:
return