code: def simulate_source(self, src_dict=None):
          
  
          self._fitcache = None
  
          if src_dict is None:
              src_dict = {}
          else:
              src_dict = copy.deepcopy(src_dict)
  
          skydir = wcs_utils.get_target_skydir(src_dict, self.roi.skydir)
  
          src_dict.setdefault('ra', skydir.ra.deg)
          src_dict.setdefault('dec', skydir.dec.deg)
          src_dict.setdefault('SpatialModel', 'PointSource')
          src_dict.setdefault('SpatialWidth', 0.3)
          src_dict.setdefault('Index', 2.0)
          src_dict.setdefault('Prefactor', 1E-13)
  
          self.add_source('mcsource', src_dict, free=True,
                          init_source=False)
          for c in self.components:
              c.simulate_roi('mcsource', clear=False)
  
          self.delete_source('mcsource')
  
          if hasattr(self.like.components[0].logLike, 'setCountsMap'):
              self._init_roi_model()
          else:
              self.write_xml('tmp')
              self._like = SummedLikelihood()
              for i, c in enumerate(self._components):
                  c._create_binned_analysis('tmp.xml')
                  self._like.addComponent(c.like)
              self._init_roi_model()
              self.load_xml('tmp')
docs: Inject simulated source counts into the data.
  
          Parameters
          ----------
          src_dict : dict
             Dictionary defining the spatial and spectral properties of
             the source that will be injected.