[Mne_analysis] help with mne.event.define_target_events

Aaron Newman Aaron.Newman at dal.ca
Thu Feb 9 13:29:22 EST 2017
Search archives:

Thanks Jaakko!  That didn't quite work, but was close enough to help me
figure it out. For the record, the working solution is:


# set up dummy first trial to set array dimensions
events_adj = [[0,0,0,]]

for key, value in event_id.items():
    events_tmp, lag_tmp = mne.event.define_target_events(events,
sound_onset, value,
                                                  raw.info['sfreq'],
code_tmin, code_tmax,
                                                  new_id=event_id_adj[key],
                                                  fill_na=None)
    events_adj = numpy.concatenate((events_adj, events_tmp))


The trick was initialising the events_adj array with a [0, 0, 0] entry,
otherwise the np.concatenate call fails. This doesn't strike me as the most
elegant solution, but it does work!

Also, you were correct that there's no need to sort the new events array
afterwards; MNE manages just fine.

Best,
Aaron
-- 

Aaron J Newman, PhD

Professor

Director, RADIANT CREATE Neurotechnology Innovation Training Program

Director, NeuroCognitive Imaging Lab (NCIL)

FACULTY OF SCIENCE

Department of Psychology & Neuroscience

FACULTY OF MEDICINE

Departments of Pediatrics, Psychiatry, and Surgery

Aaron.Newman at dal.ca

+1.902.488.1973 | fax: +1.902.494.6585

Box 15000, Life Sciences Centre, Halifax NS B3H 4R2 Canada

DALHOUSIE UNIVERSITY

NCIL.science <http://ncil.science/>
dal.ca/RADIANT <http://www.dal.ca/RADIANT>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170209/826a38b4/attachment.html 


More information about the Mne_analysis mailing list