[Mne_analysis] Epoching with stimulus in the first sample of raw data

Leonardo Barbosa lsbarbosa at gmail.com
Tue Sep 6 21:23:47 EDT 2016
Search archives:

Hello Mainak,

Thank you for the idea! I set a filter for MNE e-mails and did no see the
reply.

I end up moving the event one sample into the future and decreasing the
epochs by one sample. Since they are long sessions, it should be fine.

Best Regards,
Leonardo

PS: dgw, since the data was already visually inspected elsewhere, I was
hopping to avoid re-doing the work. So the raw data is not really an
option...

2016-08-24 14:58 GMT-05:00 Mainak Jas <mainakjas at gmail.com>:

> Hi Leonardo,
>
> Since find_events returns to you a plain numpy array, a simple fix could
> be to just add add your event manually to the array. Something like:
>
> pick_stim = mne.pick_channels(raw.info['ch_names'], ['STIM'])
> stim_data = raw[pick_stim][0][0]
> session_id = stim_data[0]
> events = np.vstack(([raw.first_samp, 0, session_id], events))
>
> It's a bit hackish but should do your job.
>
> Mainak
>
>
>
>
> On Thu, Aug 25, 2016 at 12:43 AM, Leonardo Barbosa <lsbarbosa at gmail.com>
> wrote:
>
>> Dear MNErs,
>>
>> This is my first project trying to use MNE in "real" data, and I'm trying
>> to move datasets from eeglab / fieldtrip to MNE
>>
>> I run into some trouble trying to epoch the data.
>>
>> The data is a continuous dataset with different sessions.
>> I have a STIM channel with numbers 1 and 2 for each type of session.
>> *One pulse every 2 min starting at the first sample*.
>> I then exported the data using
>>
>> fieldtrip2fiff
>>
>> making sure the channel's unit and kind were correctly set.
>>
>> However, after importing the raw, when I tried to find the events to do
>> the epoching using this function
>>
>> events = mne.find_events(raw, stim_channel='STIM')
>>
>> MNE droped the first event saying
>>
>> Removing orphaned offset at the beginning of the file.
>>
>> I looked at the _find_events code and realized that the event pulse
>> should have at least one empty sample before it.
>> I tried to change the consecutive parameter to no avail.
>>
>> What would be the best way to keep the first event / session?
>>
>> I imagine it is rare to have a stimulus already in the first sample of a
>> continuous data, but I would like to avoid losing the first session of each
>> subject or recoding the stimulus at the EEGLAB/fieldtrip if possible.
>>
>> Thank you,
>> Leonardo
>>
>>
>> _______________________________________________
>> 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.
>>
>>
>
> _______________________________________________
> 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/20160906/3a22a67d/attachment.html 


More information about the Mne_analysis mailing list