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.

DOC: Clearer error message for bad events (tuple)

See original GitHub issue

Hello,

I met a problem with mne.epoch() on v18. Please find the example code and the error bellow. (I can share share the data on request) Thank in advance. William

# ==========================ImportPackage=====================================
import mne
import scipy
import numpy as np
from mne.datasets import sample
#=========================================================================
raw = mne.io.read_raw_brainvision(vhdr_fname, misc='auto', scale=1.0, preload=True, verbose=None)
# =================Select all event id or picks from files============================
#event_id = {'S 65': 65, 'S 66': 66}
# ==============================Channels===================================
channels = raw.rename_channels({'1': 'Fp1','2': 'Fz','3': 'F3','4': 'F7','5': 'FT9','6': 'FC5','7': 'FC1','8': 'C3','9': 'T7','10': 'TP9','11': 'CP5', '12': 'CP1','13': 'Pz','14': 'P3','15': 'P7','16': 'O1','17': 'Oz','18': 'O2','19': 'P4','20': 'P8','21': 'TP10','22': 'CP6','23': 'CP2','24': 'Cz', '25': 'C4','26': 'T8','27': 'FT10','28': 'FC6','29': 'FC2','30': 'F4','31': 'F8','32': 'Fp2'})
# =========================Find event in segment===============================
events = mne.events_from_annotations(raw, event_id='auto', regexp='^(?![Bb][Aa][Dd]|[Ee][Dd][Gg][Ee]).*$', use_rounding=True, chunk_duration=None, verbose=None)


events
`_{'New Segment/': 99999, 'Stimulus/S  1': 1, 'Stimulus/S 64': 64, 'Stimulus/S 65': 65, 'Stimulus/S 66': 66, 'Stimulus/S 67': 67, 'Stimulus/S 68': 68, 'Stimulus/S 69': 69, 'Stimulus/S 70': 70, 'Stimulus/S 71': 71, 'Stimulus/S 72': 72, 'Stimulus/S 73': 73, 'Stimulus/S 74': 74, 'Stimulus/S 75': 75, 'Stimulus/S 76': 76, 'Stimulus/S 77': 77, 'Stimulus/S 78': 78, 'Stimulus/S 79': 79, 'Stimulus/S 80': 80, 'Stimulus/S 81': 81, 'Stimulus/S 82': 82, 'Stimulus/S 83': 83, 'Stimulus/S 84': 84, 'Stimulus/S 85': 85, 'Stimulus/S 86': 86, 'Stimulus/S 87': 87, 'Stimulus/S 88': 88, 'Stimulus/S 89': 89, 'Stimulus/S 90': 90, 'Stimulus/S 91': 91, 'Stimulus/S 92': 92, 'Stimulus/S 93': 93, 'Stimulus/S 95': 95, 'Stimulus/S 96': 96, 'Stimulus/S 97': 97, 'Stimulus/S 98': 98, 'Stimulus/S 99': 99, 'Stimulus/S100': 100, 'Stimulus/S101': 101, 'Stimulus/S102': 102, 'Stimulus/S103': 103, 'Stimulus/S104': 104, 'Stimulus/S105': 105, 'Stimulus/S106': 106, 'Stimulus/S107': 107, 'Stimulus/S108': 108, 'Stimulus/S109': 109, 'Stimulus/S110': 110, 'Stimulus/S111': 111, 'Stimulus/S222': 222, 'Stimulus/S224': 224, 'Stimulus/S225': 225, 'Stimulus/S226': 226})_`

# =====================Compute epochs and average============================
epochs = mne.Epochs(raw, events, event_id=[65, 66], tmin=-0.5, tmax=1.0, baseline=(-0.25, 0), picks=None,preload=False, reject=None, flat=None, proj=True, decim=1, reject_tmin=None, reject_tmax=None, detrend=None,on_missing='error', reject_by_annotation=True, metadata=None, verbose=None)



**Traceback (most recent call last):
  File "<input>", line 5, in <module>
  File "</volatile/home/WVxx/.local/lib/python3.7/site-packages/mne/externals/decorator.py:decorator-gen-204>", line 2, in __init__
  File "/volatile/home/WVxx/.local/lib/python3.7/site-packages/mne/utils/_logging.py", line 89, in wrapper
    return function(*args, **kwargs)
  File "/volatile/home/WVxx4/.local/lib/python3.7/site-packages/mne/epochs.py", line 1812, in __init__
    verbose=verbose)
  File "</volatile/home/WVxx/.local/lib/python3.7/site-packages/mne/externals/decorator.py:decorator-gen-195>", line 2, in __init__
  File "/volatile/home/WVxx/.local/lib/python3.7/site-packages/mne/utils/_logging.py", line 89, in wrapper
    return function(*args, **kwargs)
  File "/volatile/home/WVxx/.local/lib/python3.7/site-packages/mne/epochs.py", line 278, in __init__
    'type %s' % (events.dtype))
ValueError: events must be an array of type int, got type object**

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
massichcommented, Jun 17, 2019

can you run mne.sys_info()?

0reactions
agramfortcommented, Jun 18, 2019

ok

PR welcome

Read more comments on GitHub >

github_iconTop Results From Across the Web

'tuple' object has no attribute '_committed' error while updating ...
First, change input name to be able to identify which ProductImage was updated. <!-- <td><input type="file" name="image"></td> ...
Read more >
Issue 32259: Misleading "not iterable" Error Message when ...
I'm new with Python and I've been blocked for day on a "TypeError: 'Fraction' object is not iterable" error message, while the problem ......
Read more >
PostgreSQL DELETE FROM fails with `Error: attempted to ...
I have naturally tried to delete the offending tuples, only to end up with the same invisible tuple error over and over again....
Read more >
Tuples are ok - DEV Community ‍ ‍
There are opinions in the community that Tuple types should not be used ever. There are movements also against functions arguments, ...
Read more >
F.41 should suggest returning a struct, not a tuple #364 - GitHub
The truly global-view question is: "Which leads to better (clearer, less error-prone, etc.) calling code now and under anticipated future C++ ...
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