smps.utils.make_bins#

smps.utils.make_bins(**kwargs)#

Create a 3xn array of particle size bins.

Compute the lower boundary, upper boundary, and midpoint diameter for each particle size bin.

Parameters
boundariesarray-like

A list or array containing all unique lower and upper bounds.

boundaries_leftarray-like

A list of lower boundaries for each bin. If used, you must also define the boundaries_right.

boundaries_rightarray-like

A list of upper boundaries for each bin. If used, you must also define the boundaries_left.

lbfloat

The lower bound of the lowest size bin. If used, you must also provide a value for ub.

ubfloat

The upper bound of the largest size bin. If used, you must also provide a value for lb.

midpointsarray-like

A list of midpoints to use. If used, you must also provide values for lb and ub.

channels_per_decadeint

A measure of the bin width on a log scale.

mean_calcstr

The method of calculation for midpoints. Should be one of (‘am’, ‘gm’) corresponding to the arithmetic or geometric mean.

Returns
binsarray-like

A 3xn array of particle size bins with a (lower boundary, midpoint, upper boundary) for each particle size bin.

Examples

Create a set of bins from a list of boundaries:

>>> bins = make_bins(boundaries=np.array([0.35, 1.0, 2.5, 10.0]))

Create a set of bins from lists of lower and upper boundaries:

>>> bins = make_bins(
>>>    boundaries_left=np.array([0.35, 1.0, 2.5]),
>>>    boundaries_right=np.array([1.0, 2.5, 10.0])
>>> )

Create a set of bins from the lowest boundary, highest boundary, and midpoints:

>>> bins = make_bins(lb=0.35, ub=10.0, midpoints=np.array([.5, 2.0, 5.0]))