Hello,
I would like to clarify my understanding on what the process_detrend function does. If I select the entire file, it will look for a trend that goes from first to last sample point of the epoch, right? If there is a trend within, let's say, 100 to 200 ms in an epoch of 400ms, that trend won't be removed, am I right?
Is there a way, for instance, to look for a linear trend from the first 20ms of data to the last 20ms of data in the epoch?
Thanks in advance,
Fran
Hello,
If you select whole file the process_detrend tries to find a linear line through your data indicating a trend, which usually happens do to electrodes drying etc. This line is then substracted from the data. Combining that with removing the mean gives a signal which is perfectly centered around zero, especially if this is done windowed, so differences in slopes can be taken into account.
Why would you want to look at only the first 20 ms and the last 20 ms?
For the rest of the questions i'm not knowledgeable enough to answer them unfortunately. The function on which this one is based is referenced in detrend : https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_polyremoval.m
Kind regards,
Steven
Correct.
If there is a trend within, let's say, 100 to 200 ms in an epoch of 400ms, that trend won't be removed, am I right?
It would remove the trend estimated from whatever time window you used in input to estimate the trend.
Is there a way, for instance, to look for a linear trend from the first 20ms of data to the last 20ms of data in the epoch?
Set the option "Trend estimation" from time_start+20ms to time_stop-20ms.
Brainstorm won't do this automatically for you, but this is easy to do from a script.
To get started with Brainstorm scripting:
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting
Upon closer inspection, I believe I may be missing something or I did not understand the last instruction from Francois.
Let's imagine an epoch of 1 to 250 samples. If I select "all data" option, as confirmed, I would only remove a linear trend that goes from sample 1 to sample 250. So if that linear trend occurs from sample 10 to sample 240, for instance, it won't be removed, and actually I would like to remove that. What I am looking for is some more flexibility in the selection of the time window where the trend is estimated. So I want to look for and remove a linear trend that starts during any of the first 10 samples and ends within any of the last 10 samples of my whole epoch.
Trying the last instruction from Francois, what I realize I end up doing is just estimating the trend skipping the first and last 20ms of data. That is, these 20 miliseconds are not included in the time-vector where the trend is estimated.
Could you please clarify this for me?
Apologies in advance, and thank you.
Fran
1 Like