Skip to content

Frame slicing recordings and relative time vectors #2612

Closed Answered by alejoe91
BenjaminJNZ asked this question in Q&A
Discussion options

You must be logged in to vote

@yger actually timestamps are propagated if you slice a recording. Here's an example:

rec, sort = si.generate_ground_truth_recording()

# set times starting at 100 s
rec.set_times(np.arange(rec.get_num_samples()) / re.sampling_frequency() + 100)

# slice between 1 second worth of data
rec_slice = rec.frame_slice(start_frame=int(1 * rec.sampling_frequency), end_frame=int(2 * rec.sampling_frequency))

# times start at 101!
print(rec_slice.get_times()[:10])

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@alejoe91
Comment options

Answer selected by alejoe91
@yger
Comment options

yger Mar 22, 2024
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question General question regarding SI
3 participants