[FieldTrip] Padding before start of recorded data
Stephen Whitmarsh
stephen.whitmarsh at gmail.com
Thu Sep 10 19:54:01 CEST 2020
Dear Emma,
Concerning the practicalities, i.e. your second question, I think that does
just require a simple manual hack of the data, as that data doesn't exist
and ft_preprocessing will add zero's/mirrored data for you. As you suggest,
you could add the data after you do the trial segmentation (i.e.
ft_preprocessing / ft_redefinetrials), making sure you add to both the
data.trial{n} and data.time{n} field. It would just be once early in your
pipeline, so not too much of a hassle I think.
However, my opinion on the 'legitimacy' of adding zero's or mirroring the
data would be negative, however. This data you want to add does not exist
in reality, and by mirroring the data, or padding with zeros you are
creating artificial data that will bleed into the analyses of your
baseline. You simply can't claim an estimate of power where you don't have
real data.
My 2 cents would be to try to:
1) add nan's instead of zero's or mirroring, so that subsequent
wavelet/mtmconvol frequency analsises will return nan's when estimating
power using those timepoints.
2) to deal with filter ringing you can try to demean or detrend your data
first, or apply a taper, but keep in mind that detrending could create some
subtle effects on slow ERP components. Just take a good look at the effects
it has on the raw data and ERPs, as it might not even be necessary to go to
too much length for two trials.
This way you might be able to salvage as much as possible the baseline, by
using e.g. only the second half of the baseline?
I hope this helps,
Stephen
Op do 10 sep. 2020 om 19:13 schreef Ward, E.G.E. (Emma) <e.ward at psych.ru.nl
>:
> Dear mailing list,
>
>
> I am currently preparing infant EEG data for a wavelet analysis,
> specifically to look at gamma and theta, and have a question about trial
> length and padding.
>
>
> I have 0.5s baseline followed by 2s trials in which the stimulus is
> present onscreen. We were planning to define trials that are extra long,
> that is, with one second of true data before the baseline period and one
> second of true data after the stimulus offset, in order to avoid edge
> artifacts in filtering and wavelet analysis. (This in addition to
> more mirror padding for the wavelet transform step itself.) But, I have
> one or two participants for whom the beginning of the first stimulus is
> too close to the beginning of the recording, with no space for the extra
> second in front of the baseline period.
>
>
> Because this is infant data and we don't have so many trials, I would like
> to avoid losing the first trial in these cases, if possible. I am therefore
> thinking about a solution in which, only for infants whose first trial was
> too close to the beginning of the recording, I do some kind of additional
> padding at the beginning of the first trial.
>
>
> My questions are:
>
>
> 1) is this a legitimate and useful approach? The extra time being cut is
> really just data padding anyway, but for these one or two infants the
> padding method would then be different (perhaps taking the first sample of
> the first trial and filling back to the desired length, or mirroring the
> pre-stimulus data we do have, or something else if someone has a
> suggestion).
>
>
> 2) if this approach is indeed legitimate and useful, how could I best go
> about it? My ft_definetrial is currently happily defining trials with begin
> samples before 0, it's only when I get to my ft_preprocessing step that I
> get an error for the participant with not enough data, but I don't yet see
> an easy way to incorporate this adjustment into the preprocessing, whereas
> in my trialfun I'm already looping over trials to make the trl matrix, and
> can include a "if trialBeginSample < 0..." type statement.
>
>
> It is of course also entirely possible that defining extra-long trials is
> for some reason less advisable than padding using cfg.pad and cfg.padding
> during my other steps, so if that's the case I'm also happy to hear it.
>
>
> Thanks for any suggestions or thoughts you might have!
>
>
> Best wishes,
>
>
> Emma Ward, MSc
> Postdoctoral researcher, FU Berlin
> e-mail: e.ward at donders.ru.nl (will soon change)
> website: https://sites.google.com/view/emma-k-ward
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200910/936599dd/attachment.htm>
More information about the fieldtrip
mailing list