median#
- pyrost.bin.median(inp: numpy.ndarray, mask: Optional[numpy.ndarray] = None, axis: int = 0, num_threads: int = 1)#
Calculate a median along the axis.
- Parameters
inp (numpy.ndarray) – Input array. Must be one of the following types: np.float64, np.float32, np.int32, np.uint32, np.uint64.
mask (Optional[numpy.ndarray]) – Output mask. Median is calculated only where mask is True, output array set to 0 otherwise. Median is calculated over the whole input array by default.
axis (int) – Array axis along which median values are calculated.
num_threads (int) – Number of threads used in the calculations.
- Raises
ValueError – If mask and inp have different shapes.
TypeError – If inp has incompatible type.
RuntimeError – If C backend exited with error.
- Returns
Array of medians along the given axis.
- Return type