code: def get_spectral_index(src, egy):
      
      delta = 1E-5
      f0 = src.spectrum()(pyLike.dArg(egy * (1 - delta)))
      f1 = src.spectrum()(pyLike.dArg(egy * (1 + delta)))
  
      if f0 > 0 and f1 > 0:
          gamma = np.log10(f0 / f1) / np.log10((1 - delta) / (1 + delta))
      else:
          gamma = np.nan
  
      return gamma
docs: Compute the local spectral index of a source.