Poisson#

class zfit.prior.Poisson(lam, name=None)[source]#

Bases: BasePrior

Poisson prior distribution.

The Poisson distribution is a discrete probability distribution that models the number of events occurring in a fixed interval of time or space. It’s particularly useful for parameters that represent counts, rates, or other discrete positive quantities.

Properties: - Support: Non-negative integers {0, 1, 2, …} - Mean = Variance = λ (rate parameter) - Mode = floor(λ) if λ is not an integer, otherwise λ and λ-1

Example

>>> # Prior for a count parameter expecting ~3 events
>>> prior = Poisson(lam=3.0)
>>>
>>> # Prior for rare events
>>> prior = Poisson(lam=0.5)

Initialize a Poisson prior.

Parameters:
  • lam (float) – Rate parameter (expected number of events). Must be positive. This is both the mean and variance of the distribution.

  • name (str | None) – Optional name for the prior

__eq__(other)#

Compare two priors for equality.

Parameters:

other – Another ZfitPrior instance to compare with

Returns:

True if the priors are equal

Return type:

bool

__hash__()#

Return hash of the prior based on pdf and name.

Returns:

Hash value for the prior

Return type:

int

log_pdf(value=None)#

Return the log probability of the prior at the given value(s).

Parameters:

value – The parameter value(s) to evaluate the log probability at

Returns:

The log probability

sample(n)#

Sample n values from the prior distribution.

Parameters:

n – Number of samples to draw

Returns:

An array of samples