From 9cd537d7474b9342ddbb5ad62502810fe8308c62 Mon Sep 17 00:00:00 2001
From: Alessio Buccino <alejoe9187@gmail.com>
Date: Wed, 4 Sep 2024 15:35:53 +0200
Subject: [PATCH 1/3] Add BaseRecording.reset_times() function

---
 src/spikeinterface/core/baserecording.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/spikeinterface/core/baserecording.py b/src/spikeinterface/core/baserecording.py
index fe670cbf3a..d40ab021b2 100644
--- a/src/spikeinterface/core/baserecording.py
+++ b/src/spikeinterface/core/baserecording.py
@@ -495,6 +495,14 @@ def set_times(self, times, segment_index=None, with_warning=True):
                 "Use this carefully!"
             )
 
+    def reset_times(self):
+        """Reset times in-memory for all segments that have a time vector."""
+        for segment_index in range(self.get_num_segments()):
+            if self.has_time_vector(segment_index):
+                rs = self._recording_segments[segment_index]
+                rs.t_start = None
+                rs.time_vector = None
+
     def sample_index_to_time(self, sample_ind, segment_index=None):
         """
         Transform sample index into time in seconds

From 3c9a3e432356e0d7d4fe1a0ed9e9b1b3c661bc08 Mon Sep 17 00:00:00 2001
From: Alessio Buccino <alejoe9187@gmail.com>
Date: Wed, 4 Sep 2024 15:38:31 +0200
Subject: [PATCH 2/3] Add test

---
 src/spikeinterface/core/tests/test_baserecording.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/spikeinterface/core/tests/test_baserecording.py b/src/spikeinterface/core/tests/test_baserecording.py
index 682881af8a..3758fc3b43 100644
--- a/src/spikeinterface/core/tests/test_baserecording.py
+++ b/src/spikeinterface/core/tests/test_baserecording.py
@@ -289,6 +289,11 @@ def test_BaseRecording(create_cache_folder):
     rec3 = load_extractor(folder)
     assert np.allclose(times1, rec3.get_times(1))
 
+    # reset times
+    rec.reset_times()
+    for segm in range(num_seg):
+        assert not rec.has_time_vector(segment_index=segm)
+
     # test 3d probe
     rec_3d = generate_recording(ndim=3, num_channels=30)
     locations_3d = rec_3d.get_property("location")

From 7d50fc5e238c75d9db490174e4d156f73aa697eb Mon Sep 17 00:00:00 2001
From: Alessio Buccino <alejoe9187@gmail.com>
Date: Thu, 5 Sep 2024 10:19:18 +0200
Subject: [PATCH 3/3] Improve reset_times docstring

---
 src/spikeinterface/core/baserecording.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/spikeinterface/core/baserecording.py b/src/spikeinterface/core/baserecording.py
index d40ab021b2..766429f8c9 100644
--- a/src/spikeinterface/core/baserecording.py
+++ b/src/spikeinterface/core/baserecording.py
@@ -496,7 +496,11 @@ def set_times(self, times, segment_index=None, with_warning=True):
             )
 
     def reset_times(self):
-        """Reset times in-memory for all segments that have a time vector."""
+        """
+        Reset times in-memory for all segments that have a time vector.
+        If the timestamps come from a file, the files won't be modified. but only the in-memory
+        attributes of the recording objects are deleted.
+        """
         for segment_index in range(self.get_num_segments()):
             if self.has_time_vector(segment_index):
                 rs = self._recording_segments[segment_index]