mne-tools / mne-tools/mne-python

Bad split size with raw.save

Open
#11,998 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

BUG
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

In today's weird bug category, I have a MEGIN recording test_sleep_raw.fif splitted in 2 files (2 GB + 1.3 GB). The I/O roundtrip through MNE-Python to crop the 40 first second before running MEGIN's MaxFilter yields 2 files (so far so good), of size 2.1 GB + 1.2 GB, despite the default split_size='2GB' argument.

from mne.io import read_raw_fif

raw = read_raw_fif("test_sleep_raw.fif", preload=True)
raw.del_proj(len(raw.info["projs"]) - 1)
raw.crop(40, None)
raw.save("test_sleep_cropped_raw.fif", drop_small_buffer=True)

And MaxFilter doesn't like that 2 145 MB size of the first file 😢

ERROR: Too large output file (2145 MB)!

Tested on MNE-main.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the read_raw_fif and raw.save calls in the reproduction, focusing on the default split_size='2GB' behavior and drop_small_buffer=True. Reproduce the crop-and-save round trip with the provided snippet, then verify that the generated files stay within the expected size and are accepted by MaxFilter.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.