[FieldTrip] Invisible data after ft_resampledata

Emilie Caspar ecaspar at ulb.ac.be
Thu Oct 21 14:40:17 CEST 2021


Dear fieldtrippers, 

I am trying to downsample my EEG data, originally recorded at 2048 Hz.

I run the following code:

    cfg = [];
    %cfg.channel = {'A1', 'B2', 'A5', 'B5', 'B6', 'B8', 'A15', 'B20', 'B15', 'B16', 'A13', 'B18', 'A27', 'A28', 'A31', 'A29', 'A30', 'A32', 'B32', 'A21', 'A31', 'B26', 'EXG1', 'EXG2', 'EXG3', 'EXG4'}%'B15';
    cfg.dataset    = [ file.name];
    cfg.bpfilter    = 'yes';
    cfg.bpfreq      = bpfilterRange;
    cfg.bpfiltord   = bpfilterOrder;
    cfg.reref       = 'yes';
    cfg.refchannel  = chansRef;
    allData_preprosses = ft_preprocessing(cfg);
    
    cfg = [];
    cfg.resamplefs = 512;
    data_DS = ft_resampledata(cfg, allData_preprosses);
    
    
When I look at individual trials for artefact rejection, something very weird happens. Basically some trials become ‘invisible’ (sorry, I don’t find any other way to describe it), see figure attached. It seems that the data do exit though because when I average my visible trials to the invisible ones, it results in an invisible ERPs graph. But when I remove the trials containing the invisible data, an ERP graph does appear (please don’t pay attention to the quality of the data, this is just an example without any cleaning).

It seems there is a logic to the phenomenon, because if I downsample to 1024Hz (so half of my initial 2048 Hz), only half of my data becomes invisible and if I downsample to 512Hz, a 3/4 of the data becomes invisible.

I have tried the same with a different coding, with this time downsampling before filtering as follows, but the output is exactly the same.

display('downsample each channel')
         cfgp         = [];
                cfgp.dataset = [file.name];
                cfgr            = [];
                cfgr.resamplefs = 512;
                display('Resampling')
                for i= chansAll
                    cfgp.channel = i;
                    datp         = ft_preprocessing(cfgp);
                    datr{i}      = ft_resampledata(cfgr, datp);
                    clear datp
                end
                cfg = [];
                datall = ft_appenddata(cfg, datr{:});
        
    display('Filters')
    
    cfg = [];
    cfg.dataset    = [ file.name];
    cfg.bpfilter    = 'yes';
    cfg.bpfreq      = bpfilterRange;
    cfg.bpfiltord   = bpfilterOrder;
    cfg.reref       = 'yes';
    cfg.refchannel  = chansRef;
    data_DS = ft_preprocessing(cfg, datall);


Does anyone have any idea regarding this phenomenon?

Thank you in advance!

Best regards, 

Emilie


---------------------------------------------
Emilie CASPAR

Associate Professor 

Department of Experimental Psychology, Ghent University
office: Henri Dunantlaan, 2 - Floor 2, Room 94

lab’s website: https://moralsocialbrain.com/ <https://moralsocialbrain.com/> 
personal website: https://emiliecaspar.home.blog/ <https://emiliecaspar.home.blog/>
Université libre de Bruxelles (office & contact): DB10.138 / +32 2 650 32 95


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20211021/e900e11a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Downsampling.001.jpeg
Type: image/jpeg
Size: 234266 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20211021/e900e11a/attachment-0001.jpeg>


More information about the fieldtrip mailing list