Skip to content

Commit a3fef70

Browse files
committed
Reset times also sets t_start to None
1 parent 693d153 commit a3fef70

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/spikeinterface/core/baserecording.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,16 +497,17 @@ def set_times(self, times, segment_index=None, with_warning=True):
497497

498498
def reset_times(self):
499499
"""
500-
Reset times in-memory for all segments that have a time vector.
500+
Reset time information in-memory for all segments that have a time vector.
501501
If the timestamps come from a file, the files won't be modified. but only the in-memory
502-
attributes of the recording objects are deleted.
502+
attributes of the recording objects are deleted. Also `t_start` is set to None and the
503+
segment's sampling frequency is set to the recording's sampling frequency.
503504
"""
504505
for segment_index in range(self.get_num_segments()):
505506
if self.has_time_vector(segment_index):
506507
rs = self._recording_segments[segment_index]
507-
rs.t_start = None
508508
rs.time_vector = None
509-
rs.sampling_frequency = self.sampling_frequency
509+
rs.t_start = None
510+
rs.sampling_frequency = self.sampling_frequency
510511

511512
def sample_index_to_time(self, sample_ind, segment_index=None):
512513
"""

src/spikeinterface/core/tests/test_baserecording.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,11 @@ def test_BaseRecording(create_cache_folder):
292292
# reset times
293293
rec.reset_times()
294294
for segm in range(num_seg):
295+
time_info = rec.get_time_info(segment_index=segm)
295296
assert not rec.has_time_vector(segment_index=segm)
297+
assert time_info["t_start"] is None
298+
assert time_info["time_vector"] is None
299+
assert time_info["sampling_frequency"] == rec.sampling_frequency
296300

297301
# test 3d probe
298302
rec_3d = generate_recording(ndim=3, num_channels=30)

0 commit comments

Comments
 (0)