-
Notifications
You must be signed in to change notification settings - Fork 257
Error reading blackrock nev file, IndexError: too many indices, in blackrockrawio.py - due to deprecation drop in Numpy 1.23.0 #1151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Versions: (Pdb) neo.version |
I'm encountering this too, using i140703-001-03.nev from https://gin.g-node.org/INT/multielectrode_grasp The error is in python-neo/neo/rawio/blackrockrawio.py Lines 439 to 442 in 50abfbc
If I simply remove the square brackets around This is 4-5 year old code, so it's amazing I hadn't encountered this before. I wonder what's different about that file vs the files I was using previously. |
I am pretty sure my file passed our test suite about a year ago with an
older neo version, so I assumed this was due to a neo change, but I didn’t
check the neo code.
…On Wed, Aug 17, 2022 at 17:42 Chadwick Boulay ***@***.***> wrote:
I'm encountering this too, using i140703-001-03.nev from
https://gin.g-node.org/INT/multielectrode_grasp
The error is in _parse_header.
https://github.com/NeuralEnsemble/python-neo/blob/50abfbce832edb1c0f8364ac34c8a6442e1a3edf/neo/rawio/blackrockrawio.py#L439-L442
data is a structured array (fields for timestamp, packet_id, etc.) of
shape (1317,)
mask is a len-1 list containing a boolean array.
If I simply remove the square brackets around mask and use the bool array
directly then this fixes the problem: curr_data = data[ev_ids == I]
This is 4-5 year old code, so it's amazing I hadn't encountered this
before. I wonder what's different about that file vs the files I was using
previously.
—
Reply to this email directly, view it on GitHub
<#1151 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABLCF24BMSLHZ27AZV4FNTVZVMDPANCNFSM56MXGDLQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
It's in a block of code that only gets touched when there are no .nsx files present. So you can trigger this, for example, by opening a nev file that has been run through a sorter and has an extra The error has been there since at least before Python 3.8, because I tried checking out old commits and nothing before fe56cc3 will work with Python >= 3.8, and that particular commit still has the bug. I'm not terribly interested in tracking it down more precisely than that. If everyone is happy with my proposed solution above then I can make a PR. |
Looks to me like the issue is a change in Numpy that changed how indexing works:
So what happened before Numpy 1.23.0 was: |
Indeed if I change the code in blackrockrawio.py to for i in np.unique(ev_ids):
mask = tuple([ev_ids == i])
curr_data = data[mask] it works. Looks like this change was added in 2018 in this commit: 780d4c4 I looked through blackrockrawio.py and it looks like this is the only line with 'mask' in it that has the bool array wrapped into a list. @cboulay I'm good with your solution - please go ahead and make the pull request. |
fyi @muellerbjoern - proposed bugfix |
BlackrockRawIO - Fix #1151 indexing bug when no nsx present
Uh oh!
There was an error while loading. Please reload this page.
To replicate:
brIO = neo.io.BlackrockIO('datafile002.nev')
Error is at:
Datafile:
datafile002.nev.gz
The text was updated successfully, but these errors were encountered: