Skip to content

Fix int overflow in blackrock - #1642

Merged
zm711 merged 1 commit into
NeuralEnsemble:masterfrom
NinelK:NinelK-patch-int-overflow
Feb 11, 2025
Merged

zm711 merged 1 commit into
NeuralEnsemble:masterfrom
NinelK:NinelK-patch-int-overflow

Conversation

@NinelK

@NinelK NinelK commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Fixes int overflow for big blackrock files. Error trace:

Traceback (most recent call last):
  File "/disk/scratch/nkudryas/StimIO/BlackRock_US_dataset/bin_spikes.py", line 54, in <module>
    recording = read_blackrock(file_path=filename) 
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk/scratch/nkudryas/StimIO/spikeinterface/src/spikeinterface/extractors/neoextractors/blackrock.py", line 52, in __init__
    NeoBaseRecordingExtractor.__init__(
  File "/disk/scratch/nkudryas/StimIO/spikeinterface/src/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 188, in __init__
    _NeoBaseExtractor.__init__(self, block_index, **neo_kwargs)
  File "/disk/scratch/nkudryas/StimIO/spikeinterface/src/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 27, in __init__
    self.neo_reader = self.get_neo_io_reader(self.NeoRawIOClass, **neo_kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk/scratch/nkudryas/StimIO/spikeinterface/src/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 66, in get_neo_io_reader
    neo_reader.parse_header()
  File "/disk/scratch/nkudryas/StimIO/python-neo/neo/rawio/baserawio.py", line 211, in parse_header
    self._parse_header()
  File "/disk/scratch/nkudryas/StimIO/python-neo/neo/rawio/blackrockrawio.py", line 332, in _parse_header
    self.__nsx_data_header[nsx_nb] = nsx_dataheader_reader(nsx_nb)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk/scratch/nkudryas/StimIO/python-neo/neo/rawio/blackrockrawio.py", line 982, in __read_nsx_dataheader_variant_b
    offset = data_header[index]["offset_to_data_block"] + data_size
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
OverflowError: Python integer 8700514560 out of bounds for uint32

@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.

Looks good to me. Let's wait for tests to pass then I'll merge :)

@zm711
zm711 merged commit 2cbe578 into NeuralEnsemble:master Feb 11, 2025
@zm711

zm711 commented Feb 11, 2025 •

Copy link
Copy Markdown
Contributor

Do you want me to add you to the author list before our next release? It looks like I have your name and then for affiliation you're University of Edinburgh (or do you have another affiliation we need to list too?)

@NinelK

NinelK commented Feb 11, 2025

Copy link
Copy Markdown
Contributor Author

For 1 line change? Yeah, sure :)
I'm working at UoE only, that is correct.

@zm711

zm711 commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Of course! Overflow fixes are super important! :)

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