def gamma_dist(bin_values, K, M):
"""
Gamma distribution function
Parameters
----------
bin_values : array
scattering intensities
K : int
average number of photons
M : int
number of coherent modes
Returns
-------
gamma_dist : array
Gamma distribution
Notes
-----
These implementations are based on the references under
nbinom_distribution() function Notes
: math ::
P(K) =(\frac{M}{<K>})^M \frac{K^(M-1)}{\Gamma(M)}\exp(-M\frac{K}{<K>})
"""
#gamma_dist = (stats.gamma(M, 0., K/M)).pdf(bin_values)
x= bin_values
coeff = np.exp(M*np.log(M) + (M-1)*np.log(x) - gammaln(M) - M*np.log(K))
gamma_dist = coeff*np.exp(-M*x/K)
return gamma_dist
评论列表
文章目录