SequentialFixedWindowSampler#
- class torch_brain.data.sampler.SequentialFixedWindowSampler(*, sampling_intervals, window_length, step=None, drop_short=False)[source]#
Bases:
torch.utils.data.sampler.SamplerSamples fixed-length windows sequentially, always in the same order. The sampling intervals are defined in the
sampling_intervalsparameter.sampling_intervalsis a dictionary where the keys are the session ids and the values are lists of tuples representing the start and end of the intervals from which to sample.If the length of a sequence is not evenly divisible by the step, the last window will be added with an overlap with the previous window. This is to ensure that the entire sequence is covered.
- Parameters:
sampling_intervals (Dict[str, List[Tuple[float, float]]]) – Sampling intervals for each session in the dataset.
window_length (float) – Length of the window to sample.
step (float, optional) – Step size between windows. If None, it defaults to
window_length.drop_short (bool, optional) – Whether to drop windows smaller than
window_length. Defaults to False.