code: def calc_containment(self):
          
  
          hists = self.hists
          hists_out = self._hists_eff
          quantiles = [0.34, 0.68, 0.90, 0.95]
          cth_axis_idx = dict(evclass=2, evtype=3)
          for k in ['evclass']:  # ,'evtype']:
  
              print(k)
  
              non = hists['%s_psf_on' % k]
              noff = hists['%s_psf_off' % k]
              alpha = hists['%s_alpha' % k][..., None]
              if k == 'evclass':
                  sep = self._sep_bins[None, :, None, 1:]
              else:
                  sep = self._sep_bins[None, None, :, None, 1:]
  
              qval, qerr = calc_quantiles(sep, non, noff, alpha, quantiles)
              for i, q in enumerate(quantiles):
                  hists_out['%s_cth_q%2i' % (k, q * 100)] = qval[i]
                  hists_out['%s_cth_q%2i_err' % (k, q * 100)] = qerr[i]
  
              non = np.sum(non, axis=cth_axis_idx[k])
              noff = np.sum(noff, axis=cth_axis_idx[k])
              alpha = np.squeeze(alpha, axis=cth_axis_idx[k])
              sep = np.squeeze(sep, axis=cth_axis_idx[k])
  
              qval, qerr = calc_quantiles(sep, non, noff, alpha, quantiles)
              for i, q in enumerate(quantiles):
                  hists_out['%s_q%2i' % (k, q * 100)] = qval[i]
                  hists_out['%s_q%2i_err' % (k, q * 100)] = qerr[i]
docs: Calculate PSF containment.