This is documentation for an old release of SciPy (version 0.7.). Read this page in the documentation of the latest stable release (version 1.15.1).
median() nominally computes the median pixels for a stack of identically shaped images.
>>> a = np.arange(4)
>>> a = a.reshape((2,2))
>>> arrays = [a*16, a*4, a*2, a*8]
>>> median(arrays)
array([[ 0, 6],
[12, 18]])
>>> median(arrays, nhigh=1)
array([[ 0, 4],
[ 8, 12]])
>>> median(arrays, nlow=1)
array([[ 0, 8],
[16, 24]])
>>> median(arrays, outtype=np.float32)
array([[ 0., 6.],
[ 12., 18.]], dtype=float32)
>>> bm = np.zeros((4,2,2), dtype=np.bool8)
>>> bm[2,...] = 1
>>> median(arrays, badmasks=bm)
array([[ 0, 8],
[16, 24]])
>>> median(arrays, badmasks=threshhold(arrays, high=25))
array([[ 0, 6],
[ 8, 12]])