neuralib.util.segments.segment_mask
- neuralib.util.segments.segment_mask(x, t=None, duration=None, merge=None)[source]
segmenting an array that the value is long enough.
- Parameters:
x (ndarray) – (N,) int-cast-able array.
t (ndarray | None) – (N,) T-value array
duration (float | None) – T. the minimal True duration, duration smaller than value will set to even value. If using negative value, then duration larger than value will set to even value.
merge (float | None) –
the minima False duration, duration smaller than value will set to odd value.
- Returns:
(N,) int array, where even value indicate False, odd value indicate True
- Return type:
ndarray