code: def _intergral_to_differential(hpx_map, gamma=-2.0):
          
          nebins = len(hpx_map.data)
          diff_map = np.zeros((nebins + 1, hpx_map.hpx.npix))
          ebins = hpx_map.hpx.ebins
          ratio = ebins[1:] / ebins[0:-1]
          half_log_ratio = np.log(ratio) / 2.
          ratio_gamma = np.power(ratio, gamma)
          #ratio_inv_gamma = np.power(ratio, -1. * gamma)
  
          diff_map[0] = hpx_map.data[0] / ((ebins[0] + ratio_gamma[0] * ebins[1]) * half_log_ratio[0])
          for i in range(nebins):
              diff_map[i + 1] = (hpx_map.data[i] / (ebins[i + 1] *
                                                    half_log_ratio[i])) - (diff_map[i] / ratio[i])
          return HpxMap(diff_map, hpx_map.hpx)
docs: Convert integral quantity to differential quantity
  
          Here we are assuming the spectrum is a powerlaw with index gamma and we
          are using log-log-quadrature to compute the integral quantities.