[FieldTrip] ft_appenddata issue - "cannot append this data"

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Thu Mar 23 12:52:37 CET 2023


Hi Thilan,

If you read the docstring of ft_resampledata in detail, you will find the answer: rather than using cfg.resamplefs, you could use cfg.time = EEG_proc_ftddata.time

Good luck,
Jan-Mathijs

On 23 Mar 2023, at 11:16, Thilan Tudor via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Thank you! Yes, when I run isequal to compare the time of LFP_proc_ftdata and EEG_proc_ftdata variables it returns logical = 0. After importing the LFP data, it needs to be resampled to 100 Hz since the EEG data has a sampling rate of 100Hz.

When I look at the cell array for EEG_proc_ftdata.time, each cell in the array goes from 0.01 s to 30 s in 0.01 increments, whereas for LFP_proc_ftdata.time it is from (0.0070 s to 29.997 s in 0.01 increments). When looking at LFP_data (the LFP data before the 250 Hz to 100 Hz resampling), LFP_data.time is a cell array 1 x 1332  of 1 x 7500 double as expected, with time starting at 0.004 and going up in 0.004 increments.

Is there a way to get the time to align between the two so that they are equivalent (after LFP data is resampled from 250-->100Hz)?

Thanks!

The resampling code is:
cfg = [];
cfg.resamplefs = 100;
LFP = ft_resampledata(cfg, LFP_data.ftdata);

cfg = [];
cfg.refchannel = 'all';
cfg.reref = 'yes';
cfg.refmethod = 'bipolar';
cfg.bpfilter = 'yes';
cfg.bpfreq = [1,49];
LFP_proc_ftdata = ft_preprocessing(cfg,LFP);

On Thu, Mar 23, 2023 at 12:14 AM Schoffelen, J.M. (Jan Mathijs) via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
Hi Thilan,

Have you checked the code? The section in ft_appenddata between line 128-136 should give you pointers to what is going on.

My conclusion would be that the condition on line 131 is not met - specifically  isequaltime=False - which causes the error.

I need to check the equality of the ’time’ field for the LFP_proc_ftdata and EEG_proc_ftdata variables. If this field numerically non-identical, the data cannot be appended.

Good luck,

Jan-Mathijs


On 22 Mar 2023, at 22:11, Thilan Tudor via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hi,

Thanks in advance for the help.

I am trying to use ft_appenddata to merge EEG and iEEG (LFP) data as input to run connectivity analysis with ft_connectivity (after processing this merged data with ft_freqanalysis).

EEG data has the following channels: 'F3', 'C3', 'A2', 'O1', 'F4', 'A1', 'C4', 'O2'
LFP data has the following channels: 'LFP1-LFP2', 'LFP2-LFP3'

For my same-subject data, I have the following (output from ft_preprocessing):

LFP_proc_ftdata =

  struct with fields:

     trialinfo: [1332×1 double]
       fsample: 100
    sampleinfo: [1332×2 double]
         trial: {1×1332 cell}
          time: {1×1332 cell}
         label: {2×1 cell}
           cfg: [1×1 struct]

 EEG_proc_ftdata =

  struct with fields:

     trialinfo: [1332×1 double]
       fsample: 100
    sampleinfo: [1332×2 double]
         trial: {1×1332 cell}
          time: {1×1332 cell}
         label: {8×1 cell}
           cfg: [1×1 struct]


I get the following error when I run

cfg = [];
data_merged = ft_appenddata(cfg, proc_ftdata, LFP_proc_ftdata);

Warning: the data has overlapping segments or originates from different recordings on disk
Warning: please consider specifying cfg.keepsampleinfo='no'
Error using ft_appenddata
cannot append this data

Even when I specify cfg.keepsampleinfo='no', I still get "cannot append this data". Is the issue is that there are no common channels between the datasets to run ft_appenddata?


_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7EgJtIjBH4urqXOsBt5AumsNVHmu3S-3OBeM3r5i7lv7AHktdaX0eNtbGne-Z8uDf5YfGcYGvHYdvhiSI1GkIpJaG9i2RSMNIwnbSw$

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!85q1OwXkjDNCTlGyqirxD582tiN7U_mYQ23ISy7RHnL__GzJvb0joHwSjFMQ_6XMRPv5qd9jSM_28NAwAX2zQ0vvLX82hRTz7KumfA$ <https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!4HhTFhkQ4NNnYYjqXft8VorsOkAYUK4Utu8BmpP1ux2p-XxhGA4ZdzEpJFf1G397hNrXInhzxNPTYxe0CjmUIyLftA$>
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!53ecOY0O6i3upaQ-_1d4vjyH14--_GCRA0MVyi3px6OMoAj18bnxtyCjjm8vpd2a5Sy_RFlnpNFnA8AudJWSR8WbNMj5id0iq01-yg$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230323/74553215/attachment.htm>


More information about the fieldtrip mailing list