PyDL:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- pydl v0.6.0 »
- PyDL »
- SDSS Utilities (`pydl.pydlutils`) »
- djs_median

# djs_median

`pydl.pydlutils.math.``djs_median`(array, dimension=None, width=None, boundary='none')

  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 `dimension` and `width`.

  width : `int`, optional

  > Width of the median window. In general, this should be an odd integer. It is an error to specify both `dimension` and `width`.

  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.

  Returns:

  `numpy.ndarray`

  > The output. If neither `dimension` nor `width` are set, this is a scalar value, just the output of `numpy.median()`. If `dimension` is set, then the result simply `numpy.median(array,dimension)`. If `width` is set, the result has the same shape as the input array.