feature_calculators.get_snippet_start_times
feature_calculators.get_snippet_start_times(
recording_duration,
n_snippets,
snippet_duration,
margin=300.0,
method='stratified',
seed=0,
on_overlap='raise',
)Spread snippet start times over a recording, away from its start and end.
Args: recording_duration (float): Recording duration in seconds. n_snippets (int): Number of snippets. snippet_duration (float): Duration of each snippet in seconds. margin (float): Seconds excluded at the start and at the end of the recording, 5 minutes by default. method (str): "stratified" splits the usable range into n_snippets equal bins and draws one start uniformly in each (random but spread); "linspace" spaces the starts evenly. seed (int): Random seed of the "stratified" draw. on_overlap (str): "raise" or "warn" when snippets overlap.
Returns: np.ndarray: Sorted start times in whole seconds (floats), shape (n_snippets,).
Raises: ValueError: If the recording is too short for the margins and the snippet duration, or if snippets overlap and on_overlap="raise".