Blackrock NSx 2.1: gains default to 1 uV/count because the .nev is never loaded
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Start by reading blackrock.py around the load_nev setting and Neo’s _build_nsx_v21_ext_header path; the issue also points to neobaseextractor.py for the 1.0 fallback. Reproduce with blackrock/blackrock_2_1/l101210-001 from ephy_testing_data and compare the ns2 channel gains with Neo’s gains when the .nev is available. Done when NSx 2.1 gain handling no longer reports an incorrect valid scale when the .nev is present or scaling is unavailable.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
NSx 2.1 files have no extended headers, so their voltage scaling exists only in the .nev (the digitization factor in each NEUEVWAV header). Neo uses it for 2.1 streams when the .nev is loaded (_build_nsx_v21_ext_header). BlackrockRecordingExtractor always sets neo_kwargs["load_nev"] = False (blackrock.py, line 47 on main). Neo then warns "Cannot rescale to voltage, raw data will be returned", and the gain falls back to 1.0 (fill_value = 1.0 in neobaseextractor.py).
Reproduce with blackrock/blackrock_2_1/l101210-001 from ephy_testing_data:
from neo.rawio import BlackrockRawIO
from spikeinterface.extractors import read_blackrock
stem = "blackrock/blackrock_2_1/l101210-001"
io = BlackrockRawIO(filename=stem) # .nev present, so Neo can scale the 2.1 streams
io.parse_header()
ch = io.header["signal_channels"]
for nb in ("5", "2"):
rec = read_blackrock(file_path=f"{stem}.ns{nb}", stream_id=nb)
neo_ch = ch[ch["stream_id"] == nb]
print(f"ns{nb}: spikeinterface gain_to_uV {sorted({float(g) for g in rec.get_channel_gains().round(6)})}, "
f"Neo with .nev {sorted({float(g) for g in neo_ch['gain'].round(6)})}")
ns5: spikeinterface gain_to_uV [1.0], Neo with .nev [1.0]
ns2: spikeinterface gain_to_uV [1.0], Neo with .nev [152.592547]
In this file the neural channels happen to be digitized at 1000 nV/count, so 1.0 is right for ns5 by coincidence. The ns2 analog inputs have digitization factor 21516, which Neo and NPMK map to 152,592.547 nV/count (+-5 V), so in µV they come out about 153x too small. A 2.1 recording digitized at 250 nV/count would come out 4x too large. The Neo warning is the only sign; downstream, NeuroConv writes conversion = 1e-6 into the NWB file as if the scaling were known.
Possible fixes: let Neo read the .nev header (not the spikes) for 2.1 files when the .nev is present, or set the gain to NaN rather than 1.0 when Neo can't scale, so missing scaling is visible instead of looking valid.
Environment: Windows 11, Python 3.12.13, spikeinterface 0.105.4, neo 0.14.6, numpy 2.5.4.
I found this while checking a NeuroConv conversion against the raw files: https://github.com/JamesBelanger/blackrock-nwb-roundtrip (script: repro/si_nsx21_gain.py).
- Ngôn ngữ chính
- Python
- Star
- 883
- Fork
- 291
- Merge trung bình
- 3 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 40
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SpikeInterface/spikeinterface
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
SpikeInterface/spikeinterface#5008 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
`plot_potential_merges` draws the correlograms of other units when a merge group is not sortedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
SpikeInterface/spikeinterface#5007 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
`plot_unit_presence` shows bin indices on the `Time (s)` axis when `time_range` is not givenĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
SpikeInterface/spikeinterface#5006 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
SpikeInterface/spikeinterface#5005 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
SpikeInterface/spikeinterface#5004 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của SpikeInterface/spikeinterface
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
available bug good first issue tooling
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Nixitov/Riptide-Native#816 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
teng-lin/notebooklm-py#2593 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
claimed-by:collie role:small-fix status:running
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Beovulfo/herd-sdlc#325 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
omarelshamy25x/shamy-arabic-nlp#267 ·
Maintainer thường phản hồi trong vòng 1 ngày