pyActigraphy.analysis.Fractal.segmentation

classmethod Fractal.segmentation(x, n, backward=False, overlap=False, exclude_segment_with_nans=False, nan_frac=0)[source]

Segmentation function

Segment the signal into non-overlapping windows of equal size.

Parameters:
  • x (numpy.array) – Input array.

  • n (int) – Window size.

  • backward (bool, optional) – If set to True, start segmentation from the end of the signal. Default is False.

  • overlap (bool, optional) – If set to True, consecutive windows overlap by 50%. Default is False.

  • exclude_segment_with_nans (bool, optional) – If set to True, segments containing a NaN fraction equal or greater than nan_frac are excluded. Default is False.

  • nan_frac (float, optional) – Threshold on the maximal fraction of NaN in the returned segments. Default is 0.

Returns:

segments – Non-overlappping windows of size n.

Return type:

numpy.array