def nanmedian(x): """Find the median over the given axis ignoring nans. fixme: should be fixed to work along an axis. """ x = _asarray1d(x).copy() y = compress(isfinite(x), x) return median(y)
def unmasked_to_masked(mask): """Returns array mapping indices in ungapped to indices in original. Any position where the mask is True will be omitted from the final result. """ return compress(logical_not(mask), arange(len(mask)))