Potential bug in `to_ibl.py` raw data metrics PSD calculation
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
Research direction
Start with src/spikeinterface/exporters/to_ibl.py at the PSD calculation around line 219, and trace how randomly sampled LFP chunks are passed to Welch. Check the relevant exporter tests and how they validate PSD metrics. Done when the PSD is computed from consecutive samples and a regression test covers the result.
Written by the indexing model from the issue text.
Description
Currently in to_ibl.py the PSD computation for LFP is computed as:
lfp_sample_data = get_random_data_chunks(
lfp_recording,
num_chunks_per_segment=psd_num_chunks,
chunk_duration=f"{psd_chunk_duration_s}s",
return_in_uV=True,
concatenated=True,
)
psd = np.zeros((welch_win_length_samples // 2 + 1, lfp_sample_data.shape[1]), dtype=np.float32)
for i_channel in range(lfp_sample_data.shape[1]):
freqs, Pxx = welch(
lfp_sample_data[:, i_channel],
fs=lfp_recording.sampling_frequency,
nperseg=welch_win_length_samples,
)
psd[:, i_channel] = Pxx
Here the randomly sampled chunks of 1s (30k samples) which are concatenated then passed to Welch with chunk size 16384. This then computes the PSD with 50% overlap by default. However, this takes the PSD computation over randomly sampled chunks which are not-consecutive, giving erroneous PSD estimate.
- Dominant language
- Python
- Stars
- 883
- Forks
- 291
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 40
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SpikeInterface/spikeinterface
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
SpikeInterface/spikeinterface#5008 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
SpikeInterface/spikeinterface#5007 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
SpikeInterface/spikeinterface#5006 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
SpikeInterface/spikeinterface#5005 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
SpikeInterface/spikeinterface#5004 ·
Maintainers usually reply within 2 days
All issues in SpikeInterface/spikeinterface
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
daniel-ospina/tortoise#15308 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
difficulty:easy prio:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NatronGitHub/Natron#2405 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Jstar269/nakagawa-recomp#3746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day