quantlab.model.split.purge_segments#
- quantlab.model.split.purge_segments(timestamps, segments, lookahead)[source]#
Return each segment’s usable timestamps after purging.
- Parameters:
- timestampsnp.ndarray
The sorted timestamp axis the segments are cut from.
- segmentssequence of (start, end)
Segment bounds in time order, both ends inclusive, resolved as
xarray’ssel(timestamp=slice(start, end))resolves them: a bound need not be a bar of the axis, and a date string covers its whole day.- lookaheadint
L, the largest
lookahead_bars()among the model’s labels.
- Returns:
- list[np.ndarray]
One array per segment: the axis bars inside its bounds, minus the last
lookaheadbars for every segment but the last. A segment with no more thanlookaheadbars comes back empty.