Skip to content

Conversation

@shruti423
Copy link

Implements the on_drop_all parameter to warn or raise an error when all epochs are dropped, as discussed in #13473.

@agramfort
Copy link
Member

you're going to need to add tests.

@shruti423
Copy link
Author

I have added the test case in mne/tests/test_epochs.py as requested. It covers warn, raise, ignore, and invalid input scenarios.

def test_drop_all_epochs():
"""Test on_drop_all parameter in Epochs.drop."""
# Create tiny dummy data (3 epochs)
data = np.random.randn(3, 1, 10)
Copy link
Member

Choose a reason for hiding this comment

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

use a random state to avoid touching the global seed.

Suggested change
data = np.random.randn(3, 1, 10)
data = np.random.RandomState(0).randn(3, 1, 10)

Copy link
Member

Choose a reason for hiding this comment

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

also you can use only 1 epoch and not 3. It's a good habit to take to think about keep the test time as low as possible

@shruti423
Copy link
Author

I switched to RandomState(0) and cut it down to 1 epoch. Thanks for the tip on keeping the tests fast—that's a good habit to build. Well I had a doubt regarding the number of epochs, I know most standard experiments usually have a few hundred epochs, but do MNE users often work with massive datasets (like thousands of epochs for sleep scoring)? I'm just trying to get a better idea about how aggressive I should be with optimization in future PRs

@shruti423 shruti423 requested a review from larsoner as a code owner December 24, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants