Skip to content

NeuroScopeRawIO: use lfpSamplingRate for .lfp and .eeg files - #1967

Open
aaronkanzer wants to merge 1 commit into
NeuralEnsemble:masterfrom
aaronkanzer:fix/neuroscope-lfp-rate
Open

aaronkanzer wants to merge 1 commit into
NeuralEnsemble:masterfrom
aaronkanzer:fix/neuroscope-lfp-rate

Conversation

@aaronkanzer

Copy link
Copy Markdown
Contributor

In a Neuroscope XML, acquisitionSystem/samplingRate is the rate of the wideband .dat file. The downsampled .lfp and .eeg files are written at fieldPotentials/lfpSamplingRate. NeuroScopeRawIO always uses samplingRate, so LFP files get the wideband rate. Their times and durations come out too short by the ratio of the two rates, 16x for the common 20000 / 1250 Hz setup.

Repro with neuroscope/dataset_1 from ephy_testing_data. The XML has samplingRate 20000 and lfpSamplingRate 1250:

from neo.rawio import NeuroScopeRawIO
r = NeuroScopeRawIO(filename="YutaMouse42-151117.eeg"); r.parse_header()
print(r.header["signal_channels"]["sampling_rate"][0], r.get_signal_size(0, 0, 0), r.segment_t_stop(0, 0))

Observed on 0.14.6 and master: 20000.0 10 0.0005

Expected: 1250.0 10 0.008

Fix: when the data file ends in .lfp or .eeg and the XML has fieldPotentials/lfpSamplingRate, use that rate. .dat files are unchanged. A test covers both suffixes.

@zm711 zm711 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me and I'm temped to just merge, but would there ever be a case where we would have the lfp/eeg yet still want the AP band data ie the 20kHz sampling rate. I don't use this data so for my learning I would love to hear a bit more about the general use of these formats and why this format has both a downsampled and wide band sampling rates and when a user would want to use one or the other. For example I could also imagine making this an argument in the reader and letting the user choose which sampling rate to use.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants