[Mne_analysis] [merge/add/replace events & save - not?]

Virginie van Wassenhove virginie.van.wassenhove at gmail.com
Thu Aug 2 12:13:17 EDT 2018
Search archives:

        External Email - Use Caution        

Hi,it works great on a good majority of the data - it may be tricky when
the stim channel baseline is not zero.

Functional code example + outputs below:
================================================
evts = []
evts = mne.find_events(sss, stim_channel=stim_channel, output='onset',
                         min_duration=0.001, uint_cast=True,
initial_event=True)
print(evts)

2 events found
Event IDs: [1 2]
[[ 55511      0      1]
 [355513      0      2]]

#______replace event value
newevts = evts

for t in (0, len(evts)-1):
    if evts[t][2]==1:
        newevts[t][2]= 102
    if evts[t][2]==2:
        newevts[t][2]= 202

#______add and save
sss.add_events(newevts, stim_channel, replace=True)
sss.save(main_dir + 'blah_nosss.fif', overwrite=True, verbose=False)

#___TEST________________________
tmp  = mne.io.Raw(main_dir + 'blah_nosss.fif',
allow_maxshield=True,preload=True)
blah = mne.find_events(tmp, stim_channel=stim_channel, output='onset',
                         min_duration=0.001, uint_cast=True,
initial_event=True)
print(blah)
2 events found
Event IDs: [102 202]
[[ 55511      0    102]
 [355513      0    202]]
===================================================


Best,




Virginie van Wassenhove
*https://brainthemind.com/ <https://brainthemind.com/>*





On Thu, Aug 2, 2018 at 4:24 PM Virginie van Wassenhove <
virginie.van.wassenhove at gmail.com> wrote:

>         External Email - Use Caution
>
> Great, should be useful yes!
> Thx
>
>
> Virginie van Wassenhove
> *https://brainthemind.com/ <https://brainthemind.com/>*
>
>
>
>
>
> On Thu, Aug 2, 2018 at 12:15 PM Alexandre Gramfort <
> alexandre.gramfort at inria.fr> wrote:
>
>>         External Email - Use Caution
>>
>> Thanks Virginie for clarifying.
>>
>> Here is a PR that should help addressing your use case.
>>
>> https://github.com/mne-tools/mne-python/pull/5386
>>
>> HTH
>> Alex
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>>
>> 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
>> http://www.partners.org/complianceline . 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/20180802/a21c2b64/attachment.html 


More information about the Mne_analysis mailing list