11.2.1.5. astroML.density_estimation.freedman_bin_width

astroML.density_estimation.freedman_bin_width(data, return_bins=False)[source]

Deprecated since version 0.4: The freedman_bin_width function is deprecated and may be removed in a future version. Use astropy.stats.freedman_bin_width instead.

Return the optimal histogram bin width using the Freedman-Diaconis rule

Parameters
dataarray-like, ndim=1

observed (one-dimensional) data

return_binsbool (optional)

if True, then return the bin edges

Returns
widthfloat

optimal bin width using Scott’s rule

binsndarray

bin edges: returned if return_bins is True

Notes

The optimal bin width is

\Delta_b = \frac{2(q_{75} - q_{25})}{n^{1/3}}

where q_{N} is the N percent quartile of the data, and n is the number of data points.