-
Notifications
You must be signed in to change notification settings - Fork 265
Closed
Labels
Description
An error that happens after I fix #1689 with #1690
This happens for Blackrock spec==2.3
import neo
base_path = ".../H0.2_openField_PPX_062723001"
r6 = neo.rawio.BlackrockRawIO(filename=base_path, nsx_to_load=[6], load_nev=False)
r6.parse_header()
r6.header
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[8], line 2
1 r6 = neo.rawio.BlackrockRawIO(filename=base_path, nsx_to_load=[6], load_nev=False)
----> 2 r6.parse_header()
3 r6.header
File /mnt/shared_storage/Github/python-neo/neo/rawio/baserawio.py:211, in BaseRawIO.parse_header(self)
197 """
198 Parses the header of the file(s) to allow for faster computations
199 for all other functions
200
201 """
202 # this must create
203 # self.header['nb_block']
204 # self.header['nb_segment']
(...) 208 # self.header['spike_channels']
209 # self.header['event_channels']
--> 211 self._parse_header()
212 self._check_stream_signal_channel_characteristics()
213 self.is_header_parsed = True
File /mnt/shared_storage/Github/python-neo/neo/rawio/blackrockrawio.py:394, in BlackrockRawIO._parse_header(self)
392 else:
393 _data_reader_fun = self.__nsx_data_reader[spec]
--> 394 self.nsx_datas[nsx_nb] = _data_reader_fun(nsx_nb)
396 sr = float(self.main_sampling_rate / self.__nsx_basic_header[nsx_nb]["period"])
397 self.sig_sampling_rates[nsx_nb] = sr
File /mnt/shared_storage/Github/python-neo/neo/rawio/blackrockrawio.py:1087, in BlackrockRawIO.__read_nsx_data_variant_b(self, nsx_nb)
1084 offset = int(self.__nsx_data_header[nsx_nb][data_bl]["offset_to_data_block"])
1086 # read data
-> 1087 data[data_bl] = np.memmap(filename, dtype="int16", shape=shape, offset=offset, mode="r")
1089 return data
File ~/anaconda3/envs/env_nelson/lib/python3.13/site-packages/numpy/_core/memmap.py:289, in memmap.__new__(subtype, filename, dtype, mode, offset, shape, order)
287 start -= mmap.ALLOCATIONGRANULARITY
288 array_offset = offset - start
--> 289 mm = mmap.mmap(fid.fileno(), bytes, access=acc, offset=start)
291 self = ndarray.__new__(subtype, shape, dtype=descr, buffer=mm,
292 offset=array_offset, order=order)
293 self._mmap = mm
ValueError: mmap length is greater than file size
Environment:
- OS: Linux
- Python 3.13.2
- Neo 0.15.0.dev0 (master branch)
- NumPy 2.2.4