question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Verbose not working with the Epochs.drop_bad method

See original GitHub issue

Describe the bug

The verbose argument in not working in the drop_bad() method.

Steps to reproduce

import os
import mne


sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
                                    'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False).crop(tmax=60)
events = mne.find_events(raw, stim_channel='STI 014')
epochs = mne.Epochs(raw, events, tmin=-0.3, tmax=0.7)

epochs.verbose = False

epochs.drop_bad(verbose=True)

Expected results

The verbose argument set to True overwrites the Epochs.verbose attribute and prints the number of bad epochs dropped.

86 events found
Event IDs: [ 1  2  3  4  5 32]
Not setting metadata
Not setting metadata
86 matching events found
Applying baseline correction (mode: mean)
Created an SSP operator (subspace dimension = 3)
3 projection items activated
Loading data for 86 events and 601 original time points ...
1 bad epochs dropped

Actual results

The number of bad epochs dropped is not printed.

86 events found
Event IDs: [ 1  2  3  4  5 32]
Not setting metadata
Not setting metadata
86 matching events found
Applying baseline correction (mode: mean)
Created an SSP operator (subspace dimension = 3)
3 projection items activated

Additional information

It seems that in the source code of drop_bad() the argument verbose which defaults to None is not used.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
larsonercommented, Feb 16, 2021

Also this following code doesn’t print info:

That one at least shouldn’t based on how the code is designed. The precedence/order is meant to be:

  • verbose arg is used if not None
  • verbose attribute of a class is used if not None
  • global verbose level is used

And in that last example, the raw gets initialized with verbose=False, so raw.load_data() should always be in non-verbose mode regardless of set_log_level.

0reactions
HanBnrdcommented, Feb 16, 2021

(I can take a look at fixing the verbose decorator if it would help, since it does seem like the first/top-comment example is problematic)

Thanks @larsoner, that would be nice if you have time as I’m not very familiar with it and it appears to be used as a decorator for a lot of functions/methods in MNE. Please let me know if I can help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mne.Epochs — MNE 1.2.2 documentation - MNE-Python
All methods for iteration over objects (using mne.Epochs. ... Drop bad epochs without retaining the epochs data. ... Working with sEEG data.
Read more >
Using autoreject to compute local threshes impacts the ...
I am trying to use autoreject to drop bad epochs with the function get_rejection_threshold. I discovered recently the local threshes method called ...
Read more >
What is the use of verbose in Keras while validating the model?
By setting verbose 0, 1 or 2 you just say how do you want to 'see' the training progress for each epoch. verbose=0...
Read more >
Flight Weather Delay System - NYU Stern
The model would have a serious data leakage problem if we had not adjusted the ... n_jobs=-1, verbose=2 -- Epoch 1 Norm: 118.49,...
Read more >
Kernel does not print all Keras model.fit training output in ...
This kernel an example case. The problem happen to all kernel which have a lot of epoch, each epoch train in quite short...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found