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 formu
and cm**-3 forN
, then you should keep these in mind when evaluating thepdf()
andcdf()
functions and when interpreting moments.Parameters: mu : float
Median/geometric mean radius, length unit.
sigma : float
Geometric standard deviation, unitless.
N : float, optional (default=1.0)
Total number concentration, concentration unit.
base : float, optional (default=np.e)
Base of logarithm in lognormal distribution.
Attributes
median, mean (float) 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: x : float
Ordinate value to evaluate CDF at
Returns: value of CDF at ordinate
-
invcdf
(y)¶ Inverse of cumulative density function.
Parameters: y : float
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: k : int
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: x : float
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
, andeffective_radius
-