This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Estimate parameters of a Gaussian from a histogram. | |
You typically get about 10% error with a sample size of 32 in 8 bins | |
that cover its range reasonably well. The errors look pretty Gaussian | |
with some weird rounding artifacts. | |
For 8 bins, this algorithm requires 16 multiplications, 8 additional | |
squarings, 28 additions, a subtraction, a threshold to zero, two divisions, | |
and a square root, about 50 numerical operations in all. But the operations | |
are easily vectorizable. Also they can be all executed in a single pass over |