code: def constrain_centers(self):
          
  
          if len(self._data) < 2:   # no linked stars
              return
  
          idx = np.logical_not(self._excluded_from_fit).nonzero()[0]
          if len(idx) == 0:
              warnings.warn('Cannot constrain centers of linked stars because '
                            'all the stars have been excluded during the ePSF '
                            'build process.', AstropyUserWarning)
              return
  
          good_stars = [self._data[i] for i in idx]
  
          coords = []
          for star in good_stars:
              coords.append(star.wcs_large.all_pix2world(star.center[0],
                                                         star.center[1], 0))
  
          # compute mean cartesian coordinates
          lon, lat = np.transpose(coords)
          lon *= np.pi / 180.
          lat *= np.pi / 180.
          x_mean = np.mean(np.cos(lat) * np.cos(lon))
          y_mean = np.mean(np.cos(lat) * np.sin(lon))
          z_mean = np.mean(np.sin(lat))
  
          # convert mean cartesian coordinates back to spherical
          hypot = np.hypot(x_mean, y_mean)
          lon = np.arctan2(y_mean, x_mean)
          lat = np.arctan2(z_mean, hypot)
          lon *= 180. / np.pi
          lat *= 180. / np.pi
  
          # convert mean sky coordinates back to center pixel coordinates
          # for each star
          for star in good_stars:
              center = np.array(star.wcs_large.all_world2pix(lon, lat, 0))
              star.cutout_center = center - star.origin
docs: Constrain the centers of linked `EPSFStar` objects (i.e. the
          same physical star) to have the same sky coordinate.
  
          Only `EPSFStar` objects that have not been excluded during the
          ePSF build process will be used to constrain the centers.
  
          The single sky coordinate is calculated as the mean of sky
          coordinates of the linked stars.