smps.fit.LogNormal#

class smps.fit.LogNormal#

A multi-mode LogNormal particle size distribution.

fit(X, Y, modes=1, xmin=None, xmax=None, weight='number', fit_kwargs=None, **kwargs)#

Fit a multi-mode lognormal aerosol distribution.

Parameters
Xarray-like

Training data

Yarray-like

The target values.

modesint, default=1

The number of models for the model to fit to.

xminfloat, default=None

The minimum particle diameter (in nm) to consider.

xmaxfloat, default=None

The maximum particle diameter (in nm) to consider.

weightstr, default=’number’

The moment of the distribution to fit. Should be one of (“number”, “surface”, “volume”).

fit_kwargsdict

Optional kwargs to be passed directly to scipy.optimize.curve_fit. Read more here.

p0array-like

Array of initial guesses

Returns
smps.fit.LogNormalFitResults

Examples

Create a single-mode fit:

>>> from smps.fit import LogNormal
>>> model = LogNormal()
>>> results = model.fit(obj.midpoints, obj.dndlogdp.mean(), modes=1)