pyinterp.Histogram2DFloat64.push#
- Histogram2DFloat64.push(self, x: numpy.ndarray[dtype=float64, shape=(*), writable=False], y: numpy.ndarray[dtype=float64, shape=(*), writable=False], z: numpy.ndarray[dtype=float64, shape=(*), writable=False]) None#
Push new samples into the histogram bins.
Values are assigned to bins based on their (x, y) coordinates. NaN values are automatically filtered out. Each value is added to the TDigest in its corresponding bin.
- Parameters:
x – X coordinates of the values to push (1D array).
y – Y coordinates of the values to push (1D array).
z – Values to accumulate in the bins (1D array).
- Raises:
ValueError – If arrays have different shapes or are not 1-dimensional.
Examples
>>> import numpy as np >>> import pyinterp >>> x_axis = pyinterp.Axis(np.arange(0, 10, 1)) >>> y_axis = pyinterp.Axis(np.arange(0, 10, 1)) >>> hist = pyinterp.Histogram2D(x_axis, y_axis)
Add single batch of data
>>> x = np.array([1.5, 2.3, 3.7]) >>> y = np.array([4.2, 5.1, 6.8]) >>> z = np.array([10.0, 20.0, 30.0]) >>> hist.push(x, y, z)
Add more data incrementally
>>> x2 = np.array([1.8, 2.9]) >>> y2 = np.array([4.5, 5.5]) >>> z2 = np.array([15.0, 25.0]) >>> hist.push(x2, y2, z2)