fill_negative_max

ompy.fill_negative_max(array, window_size)[source]

Fill negative channels with positive counts from neighboring channels.

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 the closest channels with maximum number of counts 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]

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

Return type:

ndarray

Returns:

array with negative counts filled, where possible