Skip to content
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

BUG: Fix bug on CTF + Windows #10866

Merged
merged 1 commit into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/changes/latest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ Bugs

- Fix bug in :func:`mne.io.read_raw_bti` where unknown electrode locations were not handled properly (:gh:`10662` by `Eric Larson`_)

- Fix bug in :func:`mne.io.read_raw_ctf` on Windows where large files could not be read (:gh:`10866` by `Eric Larson`_)

- Rendering issues with recent MESA releases can be avoided by setting the new environment variable``MNE_3D_OPTION_MULTI_SAMPLES=1`` or using :func:`mne.viz.set_3d_options` (:gh:`10513` by `Eric Larson`_)

- Fix behavior for the ``pyvista`` 3D renderer's ``quiver3D`` function so that default arguments plot a glyph in ``arrow`` mode (:gh:`10493` by `Alex Rockhill`_)
Expand Down
7 changes: 5 additions & 2 deletions mne/io/ctf/ctf.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,11 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
samp_offset = (bi + trial_start_idx) * si['res4_nsamp']
n_read = min(si['n_samp_tot'] - samp_offset, si['block_size'])
# read the chunk of data
pos = CTF.HEADER_SIZE
pos += samp_offset * si['n_chan'] * 4
# have to be careful on Windows and make sure we are using
# 64-bit integers here
with np.errstate(over='raise'):
pos = np.int64(CTF.HEADER_SIZE)
pos += np.int64(samp_offset) * si['n_chan'] * 4
Comment on lines +187 to +189
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that turned out to be less painful than I thought it would be

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and it would have been even easier / not required a windows machine to debug at all if the native int emitted a warning when it overflowed like numpy does!

fid.seek(pos, 0)
this_data = np.fromfile(fid, '>i4',
count=si['n_chan'] * n_read)
Expand Down