@jit  
def pmap2_trim(f, x, width = (3,3), step = (1,1)):
  width_x, width_y = width 
  step_x, step_y = step 
  n_rows, n_cols = x.shape
  hx = width_x / 2
  hy = width_y / 2
  return [[f(x[i-hx:i+hx+1, j-hy:j+hy+1]) 
           for j in np.arange(hx, n_cols-hx, step_x)] 
           for i in np.arange(hy, n_rows-hy, step_y)]
Patch-map over interior windows, ignoring the border
dataset/ETHPy150Open iskandr/parakeet/parakeet/lib/patchmap.py/pmap2_trim