code: def averaging(grid, numGrid, numPix):
      
  
      Nbig = numGrid
      Nsmall = numPix
      small = grid.reshape([int(Nsmall), int(Nbig/Nsmall), int(Nsmall), int(Nbig/Nsmall)]).mean(3).mean(1)
      return small
docs: resize 2d pixel grid with numGrid to numPix and averages over the pixels
      :param grid: higher resolution pixel grid
      :param numGrid: number of pixels per axis in the high resolution input image
      :param numPix: lower number of pixels per axis in the output image (numGrid/numPix is integer number)
      :return: