Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions neo/rawio/neuroscoperawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ def _parse_header(self):
nbits = int(acq.find("nBits").text)
nb_channel = int(acq.find("nChannels").text)
self._sampling_rate = float(acq.find("samplingRate").text)
# .lfp and .eeg files are downsampled and their rate is stored separately
if self.data_file_path.suffix in (".lfp", ".eeg"):
lfp_sampling_rate = root.find("fieldPotentials/lfpSamplingRate")
if lfp_sampling_rate is not None:
self._sampling_rate = float(lfp_sampling_rate.text)
voltage_range = float(acq.find("voltageRange").text)
# offset = int(acq.find('offset').text)
amplification = float(acq.find("amplification").text)
Expand Down
10 changes: 10 additions & 0 deletions neo/test/rawiotest/test_neuroscoperawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ def test_signal_scale(self):
# scale is in mV = range of recording in volts * 1000 mV/V /(number of bits * ampification)
self.assertAlmostEqual(20.0 * 1000 / (2**16 * 1000), gain)

def test_lfp_sampling_rate(self):
local_test_dir = get_local_testing_data_folder()
# the xml has samplingRate 20000 for the .dat and lfpSamplingRate 1250 for .eeg/.lfp
for suffix in (".eeg", ".lfp"):
fname = local_test_dir / f"neuroscope/dataset_1/YutaMouse42-151117{suffix}"
reader = NeuroScopeRawIO(filename=fname)
reader.parse_header()
assert reader.header["signal_channels"]["sampling_rate"][0] == 1250.0
assert reader.segment_t_stop(0, 0) == 10 / 1250.0

def test_binary_argument_with_non_canonical_xml_file(self):

local_test_dir = get_local_testing_data_folder()
Expand Down
Loading