-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Update values to int64 #13548
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
base: main
Are you sure you want to change the base?
Update values to int64 #13548
Conversation
|
To read your file it needs a few more fixes actually... I'll push |
| (n_samples,) = np.frombuffer(fid.read(4), dtype="<i4") | ||
| fid.seek(_NSAMPLES_OFFSET) | ||
| n_samples = int(np.frombuffer(fid.read(4), dtype="<u4").item()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, this was <i4 here but <u4 in cnt.py. When we use <i4 in cnt.py we get a negative n_samples (-732)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just reverted it back to "<i4", it should be a signed int. I thought something was wrong when I first encountered it sign-wise.
but yeah, I'm getting the same values as you with the "<i4". I guess that's why there is the later implementation mentioned below.
|
@teonbrooks I'm done pushing/looking for now, I hope the changes I made help debugging a bit more. Something is wrong with |
|
thanks @larsoner! came across this post and adding it here for reference in the future |
according to the link above, it looks like this is not an uncommon occurrence:
it looks like n_samples should be calculated as: |
|
Great, can you add some comments / links in the code for the next time we dig into this, and try the suggested fix? |
|
added a note. after trying it out and I look more closely at the code, it looks as though the n_samples logic is already there starting at https://github.com/mne-tools/mne-python/blob/main/mne/io/cnt/cnt.py#L339. |
a5c1f92 to
603dd01
Compare
|
I actually don't know what to do about the |
603dd01 to
66c24ca
Compare

Fix attempt as fixing the overflow issue in the
read_raw_cntreader. This error has manifested with numpy upgrade.Reference issue
Fixes #13547.
What does this implement/fix?
This follows a pattern suggested in #12907 to cast the integer to int64.