djs_median¶
- pydl.pydlutils.math.djs_median(array, dimension=None, width=None, boundary='none')[source]¶
Compute the median of an array.
Use a filtering box or collapse the image along one dimension.
- Parameters:
- array
numpy.ndarray input array
- dimension
int, optional Compute the median over this dimension. It is an error to specify both
dimensionandwidth.- width
int, optional Width of the median window. In general, this should be an odd integer. It is an error to specify both
dimensionandwidth.- boundary{ ‘none’, ‘reflect’, ‘nearest’, ‘wrap’ }, optional
Boundary condition to impose. ‘none’ means no filtering is done within
width/2 of the boundary. ‘reflect’ means reflect pixel values around the boundary. ‘nearest’ means use the values of the nearest boundary pixel. ‘wrap’ means wrap pixel values around the boundary. ‘nearest’ and ‘wrap’ are not implemented. Ifarrayis one-dimensional, andboundaryis not ‘none’, then it is forced to be ‘reflect’.
- array
- Returns:
numpy.ndarrayThe output. If neither
dimensionnorwidthare set, this is a scalar value, just the output ofnumpy.median(). Ifdimensionis set, then the result simplynumpy.median(array,dimension). Ifwidthis set, the result has the same shape as the input array.