code: def _to_pixel_params(self, wcs, mode='all'):
          
  
          pixel_params = {}
          x, y = skycoord_to_pixel(self.positions, wcs, mode=mode)
          pixel_params['positions'] = np.array([x, y]).transpose()
  
          # The aperture object must have a single value for each shape
          # parameter so we must use a single pixel scale for all positions.
          # Here, we define the scale at the WCS CRVAL position.
          crval = SkyCoord([wcs.wcs.crval], frame=wcs_to_celestial_frame(wcs),
                           unit=wcs.wcs.cunit)
          scale, angle = pixel_scale_angle_at_skycoord(crval, wcs)
  
          params = self._params[:]
          theta_key = 'theta'
          if theta_key in self._params:
              pixel_params[theta_key] = (self.theta + angle).to(u.radian).value
              params.remove(theta_key)
  
          param_vals = [getattr(self, param) for param in params]
          if param_vals[0].unit.physical_type == 'angle':
              for param, param_val in zip(params, param_vals):
                  pixel_params[param] = (param_val / scale).to(u.pixel).value
          else:    # pixels
              for param, param_val in zip(params, param_vals):
                  pixel_params[param] = param_val.value
  
          return pixel_params
docs: Convert the sky aperture parameters to those for a pixel
          aperture.
  
          Parameters
          ----------
          wcs : `~astropy.wcs.WCS`
              The world coordinate system (WCS) transformation to use.
  
          mode : {'all', 'wcs'}, optional
              Whether to do the transformation including distortions
              (``'all'``; default) or only including only the core WCS
              transformation (``'wcs'``).
  
          Returns
          -------
          pixel_params : dict
              A dictionary of parameters for an equivalent pixel aperture.