[FieldTrip] Filtering the raw data
arnodelorme at gmail.com
Fri Aug 26 19:36:18 CEST 2022
Yes, that makes sense. I think it aligns with my thinking because you can only use ft_definetrials once on a given dataset (since it does not take “data,” as input, only a dataset on disk). So if you really want to filter the continuous data, you need to load the data as one trial, filter it, resave it and then reload it and define multiple trials.
> Dear Arno,
> I assume that your statement pertains to a situation where the filtering is done on a (very) long stretch of data before epoching, or where the filtering is done on epoched - potentially padded by an arbitrary amount of data to avoid edge artifacts of the filter - data?
> The ft_preprocessing function either works on in-memory data (when called as ft_preprocessing(cfg, data)) or reads in some specified data on-the-fly, and applies some processing to it (when called as ft_preprocessing(cfg)). In the former case, the data are processed per epoch, so a filter indeed may produce edge artifacts if the data and the filter characteristics don’t like each other. In the former case, if the input cfg.trl already defines epochs, the processing is also per epoch, but edge effects of filters may be alleviated by liberally using the cfg.padding option. This is documented here: https://www.fieldtriptoolbox.org/faq/how_does_the_filter_padding_in_preprocessing_work/
> If you want to apply a (highpass)filter to the full data record, then ft_preprocessing needs to be instructed to read in the whole data as a single epoch (by an appropriate defintion of cfg.trl), and then, ft_redefinetrial can be used to chop up this single long epoch into the experimental epochs of interest.
> Does this align with your assessment?
> Best wishes,
More information about the fieldtrip