code: def weight_map(self):
          
          # EAC we need the try blocks b/c older versions of the ST don't have some of these functions
          if isinstance(self.like, gtutils.SummedLikelihood):
              cmap = self.like.components[0].logLike.countsMap()
              try:
                  p_method = cmap.projection().method()
              except AttributeError:
                  p_method = 0
              try:
                  if self.like.components[0].logLike.has_weights():
                      wmap = self.like.components[0].logLike.weightMap()
                  else:
                      wmap = None
              except Exception:
                  wmap = None
          else:
              cmap = self.like.logLike.countsMap()
              try:
                  p_method = cmap.projection().method()
              except AttributeError:
                  p_method = 0
              try:
                  if self.like.logLike.has_weights():
                      wmap = self.like.logLike.weightMap()
                  else:
                      wmap = None
              except Exception:
                  wmap = None
  
          if p_method == 0:  # WCS
              if wmap is None:
                  z = np.ones((self.enumbins, self.npix, self.npix))
              else:
                  z = wmap.model()
                  z = np.array(z).reshape(self.enumbins, self.npix, self.npix)
              return WcsNDMap(copy.deepcopy(self._geom), z)
          elif p_method == 1:  # HPX
              nhpix = np.max(self.geom.npix)
              if wmap is None:
                  z = np.ones((self.enumbins, nhpix))
              else:
                  z = wmap.model()
                  z = np.array(z).reshape(self.enumbins, nhpix)
              return HpxNDMap(self.geom, z)
          else:
              self.logger.error('Did not recognize CountsMap type %i' % p_method,
                                exc_info=True)
          return None
docs: Return 3-D weights map for this component as a Map object.
  
          Returns
          -------
          map : `~fermipy.skymap.MapBase`