no the mean us used for even elements medians like in the normal median but in the case of masked median some entries may be odd some even, to get them into one output array I always select two elements and if the input was odd I make those pairs the same so the mean is essentially a no-op, you do have an additional small numerical error on the odd elements but I couldn't come up with a better way to do it.