pyinterp.Binning2D.push#
- Binning2D.push(x: ndarray, y: ndarray, z: ndarray, simple: bool = True) None [source]#
Push new samples into the defined bins.
- Parameters:
x – X coordinates of the samples
y – Y coordinates of the samples
z – New samples to push into the defined bins.
simple – If true, a simple binning 2D is used otherwise a linear binning 2d is applied. See the full description of the algorithm below.
The figure below is a graphical presentation of how a sample data point \(x\) distributes its weight to neighboring grid points.
\(A\) is the area of the grid cell. \(\alpha\), \(\beta\), \(\gamma\) and \(\delta\) are the areas of the different sub-rectangles. \(g_{00}\), \(g_{01}\), \(g_{10}\) and \(g_{11}\) are the grid points identified around point \(x\). \(w_{00}\), \(w_{01}\), \(w_{10}\) and \(w_{11}\) are the weights associated with the grid points.
For simple binning, the point \(x\) gives all its weight to its nearest grid point. In this example, the lower left grid point takes the weight equal to 1, that is \(w_{00}=1\).
In the case of linear binning, the contribution from \(x\) is distributed among each of the four surrounding grid points according to the areas of the opposite sub-rectangle induced by the position of the point.
See also
Peter Hall, M.P. Wand, On the Accuracy of Binned Kernel Density Estimators, Journal of Multivariate Analysis, Volume 56, Issue 2, 1996, Pages 165-184,