code: def get_offsets(self, pix):
          
  
          idx = []
          for i in range(self.ndim):
  
              if i == 0:
                  idx += [0]
              else:
                  npix1 = int(self.shape[i])
                  pix0 = int(pix[i - 1]) - npix1 // 2
                  idx += [pix0]
  
          return idx
docs: Get offset of the first pixel in each dimension in the
          global coordinate system.
  
          Parameters
          ----------
          pix : `~numpy.ndarray`
              Pixel coordinates in global coordinate system.