[Mne_analysis] shifting time-scale in RAW data

Lau Møller Andersen lau.andersen at cnru.dk
Tue Apr 29 09:25:56 EDT 2014
Search archives:

Thanks, Martin

Luckily, I did have a sampling frequency of 1 kHz, but I will use your suggestion because of its generality.

Thanks

Lau
Den 29/04/2014 kl. 15.21 skrev Martin Luessi <mluessi at nmr.mgh.harvard.edu>:

> On 04/29/14 05:54, Stephen Politzer-Ahles wrote:
>> Hi Lau,
>> 
>> I thought there was a function for this on raw data but I can no longer
>> find it (so I too would be interested to hear what others have to say).
>> But it should be possible to do this in sort of a hack-ish way by just
>> shifting the times of the events in the event table. For example:
>> 
>> # Get the event list events = mne.find_events( raw, min_duration = .002 )
>> 
>> # Adjust the trigger latencies
>> events[:,0] = [ x + 25 for x in events[:,0] ]
> 
> Note that the first column in "events" contains the time in samples, not
> milliseconds. So this will be incorrect unless your sampling frequency
> is 1kHz. To shift it by 25ms I would use
> 
> import numpy as np
> 
> events[:,0] += np.round(25e-3 * raw.info['sfreq'])
> 
> Best,
> 
> Martin
> 
>> 
>> Alternatively, I suppose you could just pull out bigger epochs (e.g., 25
>> ms longer than you intend) in the beginning, then use evoked.shift_time
>> later, and make sure to leave off the first 25 ms of the epoch in your
>> plotting and analysis. But yes, it would be great if there is a cleaner
>> way to do this.
>> 
>> Best,
>> Steve
>> 
>> 
>> 
>> Stephen Politzer-Ahles
>> New York University, Abu Dhabi
>> Neuroscience of Language Lab
>> http://www.nyu.edu/projects/politzer-ahles/
>> 
>> 
>> On Tue, Apr 29, 2014 at 1:34 PM, Lau Møller Andersen
>> <lau.andersen at cnru.dk <mailto:lau.andersen at cnru.dk>> wrote:
>> 
>>    Dear list
>> 
>>    I am aware of how to shift the time-scale in evoked files:
>>    http://martinos.org/mne/stable/auto_examples/plot_shift_evoked.html#example-plot-shift-evoked-py
>> 
>>    But is it possible to do it already on the raw file? (I have a
>>    trigger delay of 25 msec.)
>> 
>>    The reason for this being preferable in my view is that if you do it
>>    after having epoched, you effectively include 25 msec of data before
>>    the epoch that does not belong to the epoch. Furthermore, you
>>    exclude 25 msec of data at the end of the epoch that does belong in
>>    the epoch.
>> 
>>    Best Wishes
>> 
>>    Lau
>>    _______________________________________________
>>    Mne_analysis mailing list
>>    Mne_analysis at nmr.mgh.harvard.edu
>>    <mailto: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
>> 
> 
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

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


More information about the Mne_analysis mailing list