Repository navigation
Closed
Description
Describe the bug
I'm still getting another OverflowError after all of the latest updates to fix int overflow for blackrockrawio
This is related to #1641 #1642
I installed neo from source to get the latest update, but still run into OverflowError, see error stack below
The same code ran fine in January 2025 (before 0.14.0)
Traceback (most recent call last):
File "/opt/conda/lib/python3.10/site-packages/datajoint/autopopulate.py", line 322, in _populate1
make(dict(key), **(make_kwargs or {}))
File "/opt/conda/lib/python3.10/site-packages/element_array_ephys/spike_sorting/si_spike_sorting.py", line 239, in make
si_recording: si.BaseRecording = si.load_extractor(
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/loading.py", line 137, in load_extractor
return load(file_or_folder_or_dict, base_folder=base_folder)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/loading.py", line 100, in load
return _load_object_from_dict(d, object_type, base_folder=base_folder)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/loading.py", line 175, in _load_object_from_dict
return BaseExtractor.from_dict(d, base_folder=base_folder)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/base.py", line 559, in from_dict
extractor = _load_extractor_from_dict(dictionary)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/base.py", line 1096, in _load_extractor_from_dict
new_kwargs[name] = _load_extractor_from_dict(value)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/base.py", line 1096, in _load_extractor_from_dict
new_kwargs[name] = _load_extractor_from_dict(value)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/base.py", line 1096, in _load_extractor_from_dict
new_kwargs[name] = _load_extractor_from_dict(value)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/base.py", line 1100, in _load_extractor_from_dict
new_kwargs[name] = [transform_dict_to_extractor(e) for e in value]
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/base.py", line 1100, in <listcomp>
new_kwargs[name] = [transform_dict_to_extractor(e) for e in value]
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/base.py", line 1093, in <lambda>
transform_dict_to_extractor = lambda x: _load_extractor_from_dict(x) if is_dict_extractor(x) else x
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/core/base.py", line 1115, in _load_extractor_from_dict
extractor = extractor_class(**new_kwargs)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/extractors/neoextractors/blackrock.py", line 52, in __init__
NeoBaseRecordingExtractor.__init__(
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 188, in __init__
_NeoBaseExtractor.__init__(self, block_index, **neo_kwargs)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 27, in __init__
self.neo_reader = self.get_neo_io_reader(self.NeoRawIOClass, **neo_kwargs)
File "/opt/conda/lib/python3.10/site-packages/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 66, in get_neo_io_reader
neo_reader.parse_header()
File "/opt/conda/lib/python3.10/site-packages/neo/rawio/baserawio.py", line 211, in parse_header
self._parse_header()
File "/opt/conda/lib/python3.10/site-packages/neo/rawio/blackrockrawio.py", line 386, in _parse_header
self.nsx_datas[nsx_nb] = _data_reader_fun(nsx_nb)
File "/opt/conda/lib/python3.10/site-packages/neo/rawio/blackrockrawio.py", line 1079, in __read_nsx_data_variant_b
data[data_bl] = np.memmap(filename, dtype="int16", shape=shape, offset=offset, mode="r")
File "/opt/conda/lib/python3.10/site-packages/numpy/_core/memmap.py", line 278, in __new__
bytes -= start
OverflowError: Python integer 42747100235 out of bounds for uint32
Environment:
- OS: Linux
- Python version: 3.10
- Neo version: latest (commit 3845cdc)
- NumPy version: 2.1.3
Activity
zm711 commentedon Mar 5, 2025
We switched to allowing NumPy > 2 in 0.14.0 and NumPy changed how they dealt with overflows. So that could contribute a little (although I thought the change was on Windows and not Linux). The other issue is that people are making longer and longer files. We love having contributors. Would you like to try to fix it? If not I might have some time this weekend.
zm711 commentedon Mar 8, 2025
Actually I'm going to ping @samuelgarcia as well. It seems like the error is in numpy memmap? We make the memmap with int16 so I don't know why an error is occurring with an uint32. Sam have you seen this before? You think this is a bug in numpy or do you think this is our problem?
h-mayorquin commentedon Mar 19, 2025
Can you share testing data @ttngu207?
zm711 commentedon Mar 26, 2025
@ttngu207 I think I may have discovered one point of overflow ( #1669 ), but unfortunately without triggering the overflows with our own data there's not much we can do. So if you're able to share the data (we can share an email with you to share it privately) then we can debug which point is overflowing.
ttngu207 commentedon Mar 27, 2025
Hi @zm711, many thanks for looking into this. Yes, I may be able to share the data privately, I will confirm. I certainly won't be able to share the data publicly for now.
zm711 commentedon Mar 27, 2025
Just let us know. Both Heberto and I have emails that can be shared for this case to send the data. :)
h-mayorquin commentedon Mar 27, 2025
h . mayorquin @ gmail . com
We just need it for debugging and then we can erase the data.
h-mayorquin commentedon Apr 2, 2025
Hi @ttngu207
I am unable to reproduce the overflow on my system. Is this the code that is triggering the error for you:
the file is the one that you shared with me.
zm711 commentedon Apr 4, 2025
I have since made one tiny patch to blackrock, but I don't think it would have fixed this problem.... But @ttngu207 could you try with main and if it works for you then maybe I did fix things....
ttngu207 commentedon Apr 8, 2025
@zm711 confirming here that the issue is resolved for me. I'm able to load the file successfully. Thank you for your help!
zm711 commentedon Apr 8, 2025
Great my overflow fix actually worked. Nice.