lmlib.utils.beta.find_max_mask#

lmlib.utils.beta.find_max_mask(y, msks, locs=None, range_start=None, range_end=None, threshold=- inf, direction='maximum', skip_invalid=False, SHOW_DEBUG_PLOT=False)#

Advanced peak finder with masked samples and search intervals.

This peak finder finds in signal y for every interval that sample fulfilling multiple criteria.

Parameters
  • y (array_like, shape=(K,)) – input signal

  • msks (array_like of shape=(K) of Boolean OR tuple of array_like of shape=(K) of Boolean,) – a mask or a list of masks each of length K with True for any valid samples. If multiple masks are provided, a sample is only valid, if set True in all masks (multiple mask are merged using logic AND). The peak index is decided among all valid samples

  • locs (array_line of shape=(P) of int,) – reference index for P intervals

  • range_start (int) – start index of a interval relative to the reference index

  • range_end (int) – end index of a interval relative to the reference index

  • threshold (int) – min. value in y for peaks

  • direction (string {"forward", "backward", "maximum"}) – search direction "forward" or "backward" (return first value fulfilling all criteria) or "maximum" (take maximum value of y)

  • skip_invalid (bool) –

    True: removes entries if no peak is found in a certain interval. False: if no peak is found in a certain interval, the index is set to -1 instead.

    default: False

Returns

out – index per location interval or -1 if skip_invalid == False. if skip_invalid == True, the returned vector might has less than K entries.

Return type

ndarray of shape(<=K,) of int