[FieldTrip] Issue with NaN values using ft_artifact_zvalue

Schubert, E.S. (Sophie) E.S.Schubert at umcutrecht.nl
Wed Jul 3 16:13:52 CEST 2024


Dear FieldTrip Support Team,

I am writing to seek assistance with an issue I am encountering while using the ft_artifact_zvalue function in FieldTrip for artifact rejection. Despite my data containing no NaN values initially, I receive an error during the bandpass filtering process indicating that the input is expected to be finite.

Here is a detailed description of the problem:
searching for artifacts in 2 channels
Warning: data contains NaNs, not all processing methods are robust to NaNs, so the NaNs
might spread
Warning: data contains NaN values
Error using filtfilt>efiltfilt
Error using filtfilt
Expected input to be finite.

Error in filtfilt (line 102)
        y = efiltfilt(b,a,x);

Error in filter_with_correction (line 73)
    filt = filtfilt(B, A, dat')';

Error in ft_preproc_bandpassfilter (line 300)
    filt = filter_with_correction(B,A,dat,dir,usefftfilt);

Error in preproc (line 405)
if strcmp(cfg.bpfilter, 'yes'),     dat = ft_preproc_bandpassfilter(dat, fsample, cfg.bpfreq, cfg.bpfiltord, cfg.bpfilttype, cfg.bpfiltdir, cfg.bpinstabilityfix, cfg.bpfiltdf, cfg.bpfiltwintype, cfg.bpfiltdev, cfg.plotfiltresp, cfg.usefftfilt); end

Error in ft_artifact_zvalue (line 315)
  thisdat = preproc(thisdat, cfg.artfctdef.zvalue.channel, offset2time(0, hdr.Fs, size(thisdat,2)), cfg.artfctdef.zvalue, fltpadding, fltpadding);

The code that I use:
frontalEye = {'EOG LOC-A2', 'EOG ROC-A2'}; % for artifact rejection
cfg = [];
cfg.artfctdef.zvalue.channel = frontalEye;
cfg.artfctdef.zvalue.cutoff = 2.5;
cfg.artfctdef.zvalue.trlpadding = 0;
cfg.artfctdef.zvalue.artpadding = 0.4;
cfg.artfctdef.zvalue.fltpadding = 0.1;
cfg.artfctdef.zvalue.bpfilter = 'yes';
cfg.artfctdef.zvalue.bpfreq = [0.5 2];
cfg.artfctdef.zvalue.bpfiltord = 4;
cfg.artfctdef.zvalue.bpfilttype = 'but';
cfg.artfctdef.zvalue.hilbert = 'yes';
cfg.artfctdef.zvalue.interactive = 'no';
[cfg, artifact_EOG_eye] = ft_artifact_zvalue(cfg, data_segmented);

Important notes:

  1.  I have checked and verified that the data does not contain any NaN values before the filtering process.
  2.  I have tried different configurations, including setting the padding to 0, which prevents the error

It appears that NaN values are being introduced during the filtering process, but I am unable to determine the cause. I understand that the filterpadding specifies how much extra data around each trial's segment is read from the file. This extra data (padding) is used to mitigate edge artifacts that can occur after applying filters to the data. However, given the encountered error, I am uncertain if I am utilizing this function correctly. Could you please provide guidance on how to resolve this issue?

Thank you for your support!

Kind regards,

Sophie Schubert


------------------------------------------------------------------------------

De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht
ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct
te informeren door het bericht te retourneren. Het Universitair Medisch
Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W.
(Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij
de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197.

Denk s.v.p aan het milieu voor u deze e-mail afdrukt.

------------------------------------------------------------------------------

This message may contain confidential information and is intended exclusively
for the addressee. If you receive this message unintentionally, please do not
use the contents but notify the sender immediately by return e-mail. University
Medical Center Utrecht is a legal person by public law and is registered at
the Chamber of Commerce for Midden-Nederland under no. 30244197.

Please consider the environment before printing this e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240703/8acb1d25/attachment.htm>


More information about the fieldtrip mailing list