Binning¶
This page explains the mathematics behind the binning functionality found in
bins
. The binning functions are purely mathematical in nature though
they do have application in other parts of pyne that deal more directly physics
with physics.
Pointwise Linear Collapse¶
The pointwise_linear_collapse()
function takes an array of pointwise
data \(y\) that has the independent variable \(x\) and collapses this into
\(G\) groups as defined by the bin boundaries \(x_g\) where \(g\)
indexes \(G\). Both \(x\) and \(x_g\) must be monotonic and in the
same direction. Say that there are \(N\) points in \(x\) and \(y\).
Let \(n\) index \(N\). Then for all points internal to a group, the
collapsed value \(y_g\) is:
The term \((y_{n+1} + y_n)/2\) is the center (average) value of a linear interpolation between the two points. Therefore, \(y_g\) is the \(x\)-weighted average of \(y\) over the entire group.
In the event that the line between \(y_n\) and \(y_{n+1}\) crosses either the lower or upper bin boundary (or both) then their values are adjusted via a linear interpolation to the value at the bin boundary.
For a lower boundary crossing, the following substitutions are made to the equation above:
For an upper boundary crossing: