Skip to content

Commit

Permalink
Merge pull request #3294 from h-mayorquin/fix_sampling_repr
Browse files Browse the repository at this point in the history
Fix sampling frequency repr
  • Loading branch information
samuelgarcia authored Aug 28, 2024
2 parents bcc47a1 + cd66e7b commit 2f9365e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/spikeinterface/core/baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,18 @@ def list_to_string(lst, max_size=6):
def _repr_header(self):
num_segments = self.get_num_segments()
num_channels = self.get_num_channels()
sf_hz = self.get_sampling_frequency()
sf_khz = sf_hz / 1000
dtype = self.get_dtype()

total_samples = self.get_total_samples()
total_duration = self.get_total_duration()
total_memory_size = self.get_total_memory_size()
sampling_frequency_repr = f"{sf_khz:0.1f}kHz" if sf_hz > 10_000.0 else f"{sf_hz:0.1f}Hz"

sf_hz = self.get_sampling_frequency()
if not sf_hz.is_integer():
sampling_frequency_repr = f"{sf_hz:f} Hz"
else:
# Khz for high sampling rate and Hz for LFP
sampling_frequency_repr = f"{(sf_hz/1000.0):0.1f}kHz" if sf_hz > 10_000.0 else f"{sf_hz:0.1f}Hz"

txt = (
f"{self.name}: "
Expand Down

0 comments on commit 2f9365e

Please sign in to comment.