Back to the main page.

Bug 2164 - The ft_artifact_zvalue function

Status CLOSED INVALID
Reported 2013-05-13 22:02:00 +0200
Modified 2019-08-10 12:03:59 +0200
Product: FieldTrip
Component: preproc
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P3 normal
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Sahand Babapoor - 2013-05-13 22:02:58 +0200

Hi, When I use "ft_artifact_zvalue" from version 20130512 I encounter the following error message: "Error using ft_fetch_data (line 123) some of the requested samples occur twice in the data Error in ft_artifact_zvalue (line 262) dat{trlop} = ft_fetch_data(data, 'header', hdr, 'begsample', trl(trlop,1)-fltpadding, 'endsample', trl(trlop,2)+fltpadding, 'chanindx', sgnind, 'checkboundary', strcmp(cfg.continuous,'no Error in SFC_preprocessing (line 121) [zcfgART, artifact] = ft_artifact_zvalue(zcfg,data);" To fix this, I have changed the line 40 in ft_fetch_data from "allowoverlap = ft_getopt(varargin, 'allowoverlap', false);" to "allowoverlap = ft_getopt(varargin, 'allowoverlap', true);". This fixes the error message. I was wondering if the change I have made in ft_fetch_data will affect the performance of other fieldtrip functions. Thanks a lot for your time. Best regards, Sahand


Robert Oostenveld - 2013-05-13 22:15:28 +0200

Dear Sahar What makes you think it is an error in the code? The error that you are seeing suggests that you have overlapping data segments, i.e. the same piece of data happens in trial N and in trial N+1. That is a situation with which ft_artifact_zvalue cannot deal with as the same piece of data cannot be checked twice for artifacts. Please check what is in your data.sampleinfo, and specifically if there is overlap between subsequent trials. Something that may help is to plot it like this figure hold on for i=1:size(data.sampleinfo,1) begsample = data.sampleinfo(i,1); endsample = data.sampleinfo(i,2); numsample = endsample-begsample+1; plot(begsample:endsample, ones(1,nsample)*i, '.') end it results in a staircase-like figure where the stairs should not be overlapping. If the problem is indeed in the overlapping trials, it is not a bug but an intended feature of the code and you should solve the problem in your data representation. best regards Robert


Sahand Babapoor - 2013-05-13 23:08:18 +0200

Thanks a lot Robert. Actually, there is overlap in the data and I should fix that. Best regards, Sahand (In reply to comment #1)


Robert Oostenveld - 2013-05-14 10:54:50 +0200

good to hear that it is not a problem with the code.


Robert Oostenveld - 2019-08-10 12:03:59 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue describing the issue on https://github.com/fieldtrip/fieldtrip/issues.