https://github.com/simonsobs/pixell/blob/6a4dbca0ed313e6902de4fdeded96c07c10bd0f9/pixell/utils.py#L2309 Suggested change: axis %= a.ndim if op == "nearest": if inclusive: i = 1 if off>0 else 0 pre, mid, tail = np.split(a, [i, i+nwhole], axis) parts = []