code: def distance_to_edge(self, skydir):
          
  
          xpix, ypix = skydir.to_pixel(self.wcs, origin=0)
          deltax = np.array((xpix - self._pix_center[0]) * self._pix_size[0],
                            ndmin=1)
          deltay = np.array((ypix - self._pix_center[1]) * self._pix_size[1],
                            ndmin=1)
  
          deltax = np.abs(deltax) - 0.5 * self._width[0]
          deltay = np.abs(deltay) - 0.5 * self._width[1]
  
          m0 = (deltax < 0) & (deltay < 0)
          m1 = (deltax > 0) & (deltay < 0)
          m2 = (deltax < 0) & (deltay > 0)
          m3 = (deltax > 0) & (deltay > 0)
          mx = np.abs(deltax) <= np.abs(deltay)
          my = np.abs(deltay) < np.abs(deltax)
  
          delta = np.zeros(len(deltax))
          delta[(m0 & mx) | (m3 & my) | m1] = deltax[(m0 & mx) | (m3 & my) | m1]
          delta[(m0 & my) | (m3 & mx) | m2] = deltay[(m0 & my) | (m3 & mx) | m2]
          return delta
docs: Return the angular distance from the given direction and
          the edge of the projection.