on_missing and time-frequency

Hello,

2 issues:

1. Using mne.Epochs with on_missing='ignore' continues to return an error -
and crashes the script.

The error is returned irrespective of the argument I put in. It doesn't
work in ipython or in spyder albeit others report it works in ipython but
not in spyder.

2. I was giving a quick shot at TF analysis in sensor space using
"tfr_morlet" - although it runs fine, the returned power and itc are not in
readable format or am I missing someting? e.g. "power.plot_topo" is not
recognized. This was run in spyder with updated mne-python.

Any help appreciated!

Best,
-V

Hi Virginie,

2014-10-01 10:48 GMT+02:00 Virginie van Wassenhove <
virginie.van.wassenhove at gmail.com>:

Hello,

2 issues:

1. Using mne.Epochs with on_missing='ignore' continues to return an error
- and crashes the script.

thanks for reporting, we'll file a bug report and inquire.

The error is returned irrespective of the argument I put in. It doesn't
work in ipython or in spyder albeit others report it works in ipython but
not in spyder.

2. I was giving a quick shot at TF analysis in sensor space using
"tfr_morlet" - although it runs fine, the returned power and itc are not in
readable format or am I missing someting? e.g. "power.plot_topo" is not
recognized. This was run in spyder with updated mne-python.

In which sense is the format not readable, how does this look like?
What does it mean that "power.plot_topo" is not recognized?

-Denis

Any help appreciated!

Best,
-V

--
Virginie van Wassenhove
Exec Dir NeuroSpin MEG
Group leader, Brain Dynamics
CEA.DSV.I2BM.NeuroSpin - INSERM Cognitive Neuroimaging Unit
B?t 145 Point Courrier 156
Gif s/ Yvette F-91191 FRANCE

+33(0)1.69.08.1667
Virginie.van.Wassenhove at gmail.com
https://sites.google.com/site/virginievanwassenhove/

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141001/f0fab1f9/attachment.html

One more thing. When you construct the Epochs with on_missing='ignore' and
you have a crash, how does the error message look like? Can you rule out
that for some reason None of the events in your event_id is found in the
third column of `events`. In that case ignoring would not help.

-D

2014-10-01 12:58 GMT+02:00 Denis-Alexander Engemann <
denis.engemann at gmail.com>:

Hi Virginie,

2014-10-01 10:48 GMT+02:00 Virginie van Wassenhove <
virginie.van.wassenhove at gmail.com>:

Hello,

2 issues:

1. Using mne.Epochs with on_missing='ignore' continues to return an error
- and crashes the script.

thanks for reporting, we'll file a bug report and inquire.

The error is returned irrespective of the argument I put in. It doesn't
work in ipython or in spyder albeit others report it works in ipython but
not in spyder.

2. I was giving a quick shot at TF analysis in sensor space using
"tfr_morlet" - although it runs fine, the returned power and itc are not in
readable format or am I missing someting? e.g. "power.plot_topo" is not
recognized. This was run in spyder with updated mne-python.

In which sense is the format not readable, how does this look like?
What does it mean that "power.plot_topo" is not recognized?

-Denis

Any help appreciated!

Best,
-V

--
Virginie van Wassenhove
Exec Dir NeuroSpin MEG
Group leader, Brain Dynamics
CEA.DSV.I2BM.NeuroSpin - INSERM Cognitive Neuroimaging Unit
B?t 145 Point Courrier 156
Gif s/ Yvette F-91191 FRANCE

+33(0)1.69.08.1667
Virginie.van.Wassenhove at gmail.com
https://sites.google.com/site/virginievanwassenhove/

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you
in error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141001/422d3ba6/attachment.html

Yes, I know in advance that is in some conditions and in some runs, no
events will be found which is the reason why I want to use the "ignore"
option when that happens. Am I understanding this option incorrectly? What
is the "on_missing" referring to o.w.?

the error message is :
"ValueError: no desired events found."

Thanks!
V

2. I was giving a quick shot at TF analysis in sensor space using
"tfr_morlet" - although it runs fine, the returned power and itc are not in
readable format or am I missing someting? e.g. "power.plot_topo" is not
recognized. This was run in spyder with updated mne-python.

In which sense is the format not readable, how does this look like?

What does it mean that "power.plot_topo" is not recognized?

I had to close that console, lost the 2 hours computations and I can't tell
you the exact "format" value it was reporting when calling the apparently
non-existent "power" variable despite having computed it for 2 hours. I'll
try that again and be more specific.

Is it possible that "power._getdata()" need to be used to actually load the
results of tfr_morlet in a spyder console?

for "power.pot_topo", I need to recompute and I'll tell you.

Later, thanks!
V

Hi Virginie

1. this is in fact an issue with the documentation, not a bug. The 'ignore'
option will avoid crashes if one or many events are missing but at least
one remains. If all events are missing nothing will be ignored, currently
the constructor needs at east one event. We might want to rethink the
semantics. Out of curiosity, what are you doing with epochs for which you
know in advance that events and ids don't match? In other words, would
there be a use case for the behavior you expected from 'ignore'? If it's
just to avoid crashes when no event is found, I would manually check that
and skip computations if nothing is found. For example (in a loop that
iterates over datasets or subjects):

if not np.any(np.in1d(event_ids.values(), events[:, 2])):
    continue

2. the second issue sounds mysterious to me, I don't `smell` what might be
going on there.

2014-10-01 14:05 GMT+02:00 Virginie van Wassenhove <
virginie.van.wassenhove at gmail.com>:

2. I was giving a quick shot at TF analysis in sensor space using
"tfr_morlet" - although it runs fine, the returned power and itc are not in
readable format or am I missing someting? e.g. "power.plot_topo" is not
recognized. This was run in spyder with updated mne-python.

In which sense is the format not readable, how does this look like?

What does it mean that "power.plot_topo" is not recognized?

I had to close that console, lost the 2 hours computations and I can't
tell you the exact "format" value it was reporting when calling the
apparently non-existent "power" variable despite having computed it for 2
hours. I'll try that again and be more specific.

So you imply that power = tfr_morlet completed (after 2 hours?) but that
`power` was not found?

Is it possible that "power._getdata()" need to be used to actually load
the results of tfr_morlet in a spyder console?

This should not be necessay, this one is private and should be ignored for
regular usage.

-Denis

for "power.pot_topo", I need to recompute and I'll tell you.

Later, thanks!
V

-Denis

Any help appreciated!

Best,
-V

--
Virginie van Wassenhove
Exec Dir NeuroSpin MEG
Group leader, Brain Dynamics
CEA.DSV.I2BM.NeuroSpin - INSERM Cognitive Neuroimaging Unit
B?t 145 Point Courrier 156
Gif s/ Yvette F-91191 FRANCE

+33(0)1.69.08.1667
Virginie.van.Wassenhove at gmail.com
https://sites.google.com/site/virginievanwassenhove/

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom
it is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you
in error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you
in error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

--
Virginie van Wassenhove
Exec Dir NeuroSpin MEG
Group leader, Brain Dynamics
CEA.DSV.I2BM.NeuroSpin - INSERM Cognitive Neuroimaging Unit
B?t 145 Point Courrier 156
Gif s/ Yvette F-91191 FRANCE

+33(0)1.69.08.1667
Virginie.van.Wassenhove at gmail.com
https://sites.google.com/site/virginievanwassenhove/

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141001/b27f8f93/attachment.html

1. this is in fact an issue with the documentation, not a bug. The
'ignore' option will avoid crashes if one or many events are missing but at
least one remains. If all events are missing nothing will be ignored,
currently the constructor needs at east one event. We might want to rethink
the semantics. Out of curiosity, what are you doing with epochs for which
you know in advance that events and ids don't match? In other words, would
there be a use case for the behavior you expected from 'ignore'? If it's
just to avoid crashes when no event is found, I would manually check that
and skip computations if nothing is found. For example (in a loop that
iterates over datasets or subjects):

if not np.any(np.in1d(event_ids.values(), events[:, 2])):
    continue

The reason is purely pragmatic for batch processing (all runs of all
participants; in some runs there may be some conditions missing due to the
nature of the task)

2. the second issue sounds mysterious to me, I don't `smell` what might be
going on there.

I might have found the bug.
-V

The reason is purely pragmatic for batch processing (all runs of all
participants; in some runs there may be some conditions missing due to the
nature of the task)

either we have it crash at epochs creation or it will crash later.

I think you should detect it and address the problem
on your side when running your batch script.

ALex

Ok thanks. You may want to clarify the "no_missing" option on the wiki.
Cheers,
V

ok bug fixed, tfr_morlet works great along with the superb figure suite
tools!
very nifty!
-V

quick test outcome on 1 participant: some lovely parietal alpha and low
gamma
40 min with n_jobs= 4, 2s epoch, decimfactor=3 (333 Hz)
[image: Inline image 1]

nice to hear it works

how would you phrase the doc? It is currently:

    on_missing : str
        What to do if an event id is not found in the recording.
        Valid keys are 'error' | 'warning' | 'ignore'
        Default is 'error'. If on_missing is 'warning' it will proceed but
        warn, if 'ignore' it will proceed silently.

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141002/e38ecb57/attachment.html

simply specify that "if no event id are found in the data, an error will be
automatically generated irrespective of the str"

however, i am still unclear about what "no_missing" means: how would
mne.epochs know in advance whether an event should be there or not (hence
that it is missing)?
-V

Thanks Virginie,

I opened a PR, which is based on your suggestion.

2014-10-02 22:42 GMT+02:00 Virginie van Wassenhove <
virginie.van.wassenhove at gmail.com>:

simply specify that "if no event id are found in the data, an error will
be automatically generated irrespective of the str"

however, i am still unclear about what "no_missing" means: how would
mne.epochs know in advance whether an event should be there or not (hence
that it is missing)?

The mismatch is produced as follows:

You pass an event_id that will be a dict in most cases, e.g. {'left': 1,
'right':2}.

Second you pass events at which to segment the continuous recordings.
For simplicity let's assume we only have two of them.

np.array([[1, 0, 14], [1, 0, 2]])

In this case the event id 'left' is not found in the events (not in the
data) and 'on_missing' becomes relevant.

For the sourcecode see:

If no event id is found at all and 'on_missing' is set to 'ignore' it will
crash here:

-Denis

-V

nice to hear it works

how would you phrase the doc? It is currently:

     on_missing : str
        What to do if an event id is not found in the recording.
        Valid keys are 'error' | 'warning' | 'ignore'
        Default is 'error'. If on_missing is 'warning' it will proceed but
        warn, if 'ignore' it will proceed silently.

Alex

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141003/ea291354/attachment.html