code: def calc_counts_edisp(skydir, ltc, event_class, event_types,
                        egy_bins, cth_bins, fn, nbin=16, npts=1):
      
      #npts = int(np.ceil(32. / bins_per_dec(egy_bins)))
  
      # Split energy bins
      egy_bins = np.exp(utils.split_bin_edges(np.log(egy_bins), npts))
      etrue_bins = 10**np.linspace(1.0, 6.5, nbin * 5.5 + 1)
      drm = calc_drm(skydir, ltc, event_class, event_types,
                     egy_bins, cth_bins, nbin=nbin)
      cnts_etrue = calc_counts(skydir, ltc, event_class, event_types,
                               etrue_bins, cth_bins, fn)
  
      cnts = np.sum(cnts_etrue[None, :, :] * drm[:, :, :], axis=1)
      cnts = sum_bins(cnts, 0, npts)
      return cnts
docs: Calculate the expected counts vs. observed energy and true
      incidence angle for a source with spectral parameterization ``fn``.
  
      Parameters
      ----------
      skydir : `~astropy.coordinate.SkyCoord`
  
      ltc : `~fermipy.irfs.LTCube`
  
      egy_bins : `~numpy.ndarray`
          Bin edges in observed energy in MeV.
  
      cth_bins : `~numpy.ndarray`
          Bin edges in cosine of the true incidence angle.
  
      nbin : int    
          Number of points per decade with which to sample true energy.
          
      npts : int
          Number of points by which to oversample each reconstructed energy bin.