Seems a bit odd to use np.diff. Are you supporting nbounds != 2?