Skip to content

Commit 94e2979

Browse files
committed
Revert use_times changes
1 parent ca276f8 commit 94e2979

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

src/spikeinterface/core/baserecording.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __repr__(self):
5959
if num_segments > 1:
6060
samples_per_segment = [self.get_num_samples(segment_index) for segment_index in range(num_segments)]
6161
memory_per_segment_bytes = (self.get_memory_size(segment_index) for segment_index in range(num_segments))
62-
durations = [self.get_duration(segment_index, use_times=False) for segment_index in range(num_segments)]
62+
durations = [self.get_duration(segment_index) for segment_index in range(num_segments)]
6363

6464
samples_per_segment_formated = [f"{samples:,}" for samples in samples_per_segment]
6565
durations_per_segment_formated = [convert_seconds_to_str(d) for d in durations]
@@ -95,7 +95,7 @@ def _repr_header(self):
9595
dtype = self.get_dtype()
9696

9797
total_samples = self.get_total_samples()
98-
total_duration = self.get_total_duration(use_times=False)
98+
total_duration = self.get_total_duration()
9999
total_memory_size = self.get_total_memory_size()
100100

101101
sf_hz = self.get_sampling_frequency()
@@ -216,7 +216,7 @@ def get_total_samples(self) -> int:
216216

217217
return sum(samples_per_segment)
218218

219-
def get_duration(self, segment_index=None, use_times=True) -> float:
219+
def get_duration(self, segment_index=None) -> float:
220220
"""
221221
Returns the duration in seconds.
222222
@@ -226,9 +226,6 @@ def get_duration(self, segment_index=None, use_times=True) -> float:
226226
The sample index to retrieve the duration for.
227227
For multi-segment objects, it is required, default: None
228228
With single segment recording returns the duration of the single segment
229-
use_times : bool, default: True
230-
If True, the duration is calculated using the time vector if available.
231-
If False, the duration is calculated using the number of samples and the sampling frequency.
232229
233230
Returns
234231
-------
@@ -237,7 +234,7 @@ def get_duration(self, segment_index=None, use_times=True) -> float:
237234
"""
238235
segment_index = self._check_segment_index(segment_index)
239236

240-
if self.has_time_vector(segment_index) and use_times:
237+
if self.has_time_vector(segment_index):
241238
times = self.get_times(segment_index)
242239
segment_duration = times[-1] - times[0] + (1 / self.get_sampling_frequency())
243240
else:
@@ -246,24 +243,16 @@ def get_duration(self, segment_index=None, use_times=True) -> float:
246243

247244
return segment_duration
248245

249-
def get_total_duration(self, use_times=True) -> float:
246+
def get_total_duration(self) -> float:
250247
"""
251248
Returns the total duration in seconds
252249
253-
Parameters
254-
----------
255-
use_times : bool, default: True
256-
If True, the duration is calculated using the time vector if available.
257-
If False, the duration is calculated using the number of samples and the sampling frequency.
258-
259250
Returns
260251
-------
261252
float
262253
The duration in seconds
263254
"""
264-
duration = sum(
265-
[self.get_duration(segment_index, use_times) for segment_index in range(self.get_num_segments())]
266-
)
255+
duration = sum([self.get_duration(idx) for idx in range(self.get_num_segments())])
267256
return duration
268257

269258
def get_memory_size(self, segment_index=None) -> int:

0 commit comments

Comments
 (0)