Skip to content

Commit

Permalink
Merge pull request #3391 from alejoe91/reset-times
Browse files Browse the repository at this point in the history
Reset times 3: fix case when no time vector
  • Loading branch information
samuelgarcia authored Sep 11, 2024
2 parents 36ccbd4 + 30bd9b9 commit 73f4d58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/spikeinterface/core/baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ def reset_times(self):
segment's sampling frequency is set to the recording's sampling frequency.
"""
for segment_index in range(self.get_num_segments()):
rs = self._recording_segments[segment_index]
if self.has_time_vector(segment_index):
rs = self._recording_segments[segment_index]
rs.time_vector = None
rs.t_start = None
rs.sampling_frequency = self.sampling_frequency
Expand Down
3 changes: 3 additions & 0 deletions src/spikeinterface/core/tests/test_baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ def test_BaseRecording(create_cache_folder):
assert time_info["time_vector"] is None
assert time_info["sampling_frequency"] == rec.sampling_frequency

# resetting time again should be ok
rec.reset_times()

# test 3d probe
rec_3d = generate_recording(ndim=3, num_channels=30)
locations_3d = rec_3d.get_property("location")
Expand Down

0 comments on commit 73f4d58

Please sign in to comment.