pyrcel.distributions.Lognorm

class pyrcel.distributions.Lognorm(mu, sigma, N=1.0, base=2.718281828459045)

Lognormal size distribution.

An instance of Lognorm contains a construction of a lognormal distribution and the utilities necessary for computing statistical functions associated with that distribution. The parameters of the constructor are invariant with respect to what length and concentration unit you choose; that is, if you use meters for mu and cm**-3 for N, then you should keep these in mind when evaluating the pdf() and cdf() functions and when interpreting moments.

Parameters:
mufloat

Median/geometric mean radius, length unit.

sigmafloat

Geometric standard deviation, unitless.

Nfloat, optional (default=1.0)

Total number concentration, concentration unit.

basefloat, optional (default=np.e)

Base of logarithm in lognormal distribution.

Attributes:
median, meanfloat

Pre-computed statistical quantities

Methods

pdf(x)

Evaluate distribution at a particular value

cdf(x)

Evaluate cumulative distribution at a particular value.

moment(k)

Compute the k-th moment of the lognormal distribution.

__init__(mu, sigma, N=1.0, base=2.718281828459045)
cdf(x)

Cumulative density function

\[\text{CDF} = \frac{N}{2}\left(1.0 + \text{erf}(\frac{\log{x/\mu}}{\sqrt{2}\log{\sigma}}) \right)\]
Parameters:
xfloat

Ordinate value to evaluate CDF at

Returns:
value of CDF at ordinate
invcdf(y)

Inverse of cumulative density function.

Parameters:
yfloat

CDF value, between (0, 1)

Returns:
value of ordinate corresponding to given CDF evaluation
moment(k)

Compute the k-th moment of the lognormal distribution

\[F(k) = N\mu^k\exp\left( \frac{k^2}{2} \ln^2 \sigma \right)\]
Parameters:
kint

Moment to evaluate

Returns:
moment of distribution
pdf(x)

Probability density function

\[\text{PDF} = \frac{N}{\sqrt{2\pi}\log\sigma x}\exp\left( -\frac{\log{x/\mu}^2}{2\log^2\sigma} \right)\]
Parameters:
xfloat

Ordinate value to evaluate CDF at

Returns:
value of CDF at ordinate
stats()

Compute useful statistics for a lognormal distribution

Returns:
dict

Dictionary containing the stats mean_radius, total_diameter, total_surface_area, total_volume, mean_surface_area, mean_volume, and effective_radius