from_bitstream

igwn_segments.utils.from_bitstream(bitstream, start, dt, minlen=1)

Convert consecutive True values in a bit stream (boolean-castable iterable) to a stream of segments. Require minlen consecutive True samples to comprise a segment.

Example:

>>> list(from_bitstream((True, True, False, True, False), 0, 1))
[segment(0, 2), segment(3, 4)]
>>> list(from_bitstream([[], [[]], [[]], [], []], 1013968613, 0.125))
[segment(1013968613.125, 1013968613.375)]