Repository navigation
Description
With load_nev=False, spec 2.1 recordings come back unscaled and every spec loses its recording date:
from neo.rawio.blackrockrawio import BlackrockRawIO
for load_nev in (True, False):
reader = BlackrockRawIO(filename="blackrock/blackrock_2_1/l101210-001", nsx_to_load=2, load_nev=load_nev)
reader.parse_header()
channels = reader.header["signal_channels"]
print(load_nev, set(channels["units"]), set(channels["gain"]), reader.raw_annotations["blocks"][0]["rec_datetime"])True {np.str_('uV')} {np.float64(152.592547)} 2010-12-10 10:50:10.156000
False {np.str_('')} {np.float64(1.0)} None
load_nev=False marks the .nev as absent, but a 2.1 .nsX takes its scaling from the .nev headers and rec_datetime comes from there for every spec:
python-neo/neo/rawio/blackrockrawio.py
Lines 213 to 214 in f34f655
| if not load_nev: | |
| self._avail_files["nev"] = False |
python-neo/neo/rawio/blackrockrawio.py
Lines 1557 to 1568 in f34f655
| if self._avail_files["nev"]: | |
| # Workaround for DigitalFactor overflow in buggy Cerebus systems | |
| # Fix from NPMK toolbox (openNEV, line 464, git rev d0a25eac902704a3a29fa5dfd3aed0744f4733ed) | |
| dig_factor = self._nev_params("digitization_factor")[elid] | |
| if dig_factor == 21516: | |
| dig_factor = 152592.547 | |
| units = "uV" | |
| else: | |
| dig_factor = float("nan") | |
| units = "" | |
| if i == 0: # Only warn once | |
| warnings.warn("Cannot rescale to voltage, raw data will be returned.", UserWarning) |
SpikeInterface always passes load_nev=False and every 2.1 recording read through it has this problem:
https://github.com/SpikeInterface/spikeinterface/blob/0c287eb8193ce963426e13b280976880dc64d97d/src/spikeinterface/extractors/neoextractors/blackrock.py#L47
The fix is to read the .nev headers whenever the file is on disk and keep only the spikes and events behind load_nev.
Activity