find_islands#

pypillometry.signal.find_islands(usable, min_len, max_gap=0, min_density=None)[source]#

Islands: short stretches of usable data between unusable ones.

Unusable stretches of up to max_gap samples do not separate (e.g., single missing samples every few samples in otherwise good data); the usable data then fall into segments, separated by longer unusable stretches (or the start and end of the data). A segment is an island if its span (from its first to its last usable sample) is shorter than min_len, or, with min_density, if less than this fraction of its span is usable.

Parameters:
  • usable (np.ndarray of bool) – the usable samples

  • min_len (int) – minimum span of a segment (in samples)

  • max_gap (int) – longest unusable stretch that does not separate segments

  • min_density (float, optional) – minimum fraction (0-1) of usable samples in a segment; None: no minimum

Return type:

ndarray

Returns:

the usable samples that belong to islands