fromsegwizard

igwn_segments.utils.fromsegwizard(fileobj, coltype=<class 'int'>, strict=True)

Read a segmentlist from the file object fileobj containing a segwizard compatible segment list. Parsing stops on the first line that cannot be parsed (which is consumed). The segmentlist will be created with segment whose boundaries are of type coltype, which should raise ValueError if it cannot convert its string argument. Two-column, three-column, and four-column segwizard files are recognized, but the entire file must be in the same format, which is decided by the first parsed line. If strict is True and the file is in three- or four-column format, then each segment’s duration is checked against that column in the input file.

NOTE: the output is a segmentlist as described by the file; if the segments in the input file are not coalesced or out of order, then thusly shall be the output of this function. It is recommended that this function’s output be coalesced before use.