fill_negative_gauss

ompy.fill_negative_gauss(array, Eg, window_size, n_trunc=3)[source]

Fill negative channels with positive counts from weighted neighbor chnls.

The idea is that the negative counts are somehow connected to the (γ-ray) resolution and should thus be filled from a channel within the resolution.

This implementation loops through channels with the maximum “weight”, where the weight is given by

weight = gaussian(i, loc=i, scale ~ window_size) * counts(i),

to fill the channle(s) with negative counts. Note that it can happen that some bins will remain with negative counts (if not enough bins with possitive counts are available within the window_size) .

The routine is performed for each Ex row independently.

Parameters:
  • array (ndarray) – Input array, ordered as [Ex, Eg]

  • Eg (ndarray) – Gamma-ray energies

  • window_size (Union[int, float, array]) – FWHM for the gaussian. If int or float, the same FWHM will be applied for all Eg bins. Otherwise, provide an array with the FWHM for each Eg bin.

  • n_trun (float, optional) – Truncate gaussian for faster calculation. Defaults to 3.

Return type:

ndarray

Returns:

array with negative counts filled, where possible