redback.likelihoods.PoissonLikelihood

class redback.likelihoods.PoissonLikelihood(*args: Any, **kwargs: Any)[source]

Bases: _RedbackLikelihood

__init__(time: ndarray, counts: ndarray, function: callable, integrated_rate_function: bool = True, dt: Optional[Union[float, ndarray]] = None, kwargs: Optional[dict] = None, priors=None, fiducial_parameters=None) None[source]
Parameters:
  • time (np.ndarray) – The time values.

  • counts (np.ndarray) – The number of counts for the time value.

  • function (callable) – The python function to fit to the data.

  • integrated_rate_function (bool) – Whether the function returns an integrated rate over the dt in the bins. This should be true if you multiply the rate with dt in the function and false if the function returns a rate per unit time. (Default value = True)

  • dt (Union[float, None, np.ndarray]) – Array of each bin size or single value if all bins are of the same size. If None, assume that dt is constant and calculate it from the first two elements of time.

  • 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__(time, counts, function[, ...])

param time:

The time values.

find_maximum_likelihood_parameters([...])

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()

return:

The log-likelihood.

noise_log_likelihood()

return:

The noise log-likelihood, i.e. the log-likelihood assuming the signal is just noise.

Attributes

background_rate

counts

dt

kwargs

n

Length of the x/y-values :rtype: int

parameters_to_be_updated

time

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

log_likelihood() float[source]
Returns:

The log-likelihood.

Return type:

float

property n: int

Length of the x/y-values :rtype: int

Type:

return

noise_log_likelihood() float[source]
Returns:

The noise log-likelihood, i.e. the log-likelihood assuming the signal is just noise.

Return type:

float