Back to the main page.

Bug 2916 - negative trlpadding incorrectly disallowed with in-memory data

Status CLOSED FIXED
Reported 2015-06-25 15:52:00 +0200
Modified 2015-07-15 13:31:07 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P5 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Robin - 2015-06-25 15:52:01 +0200

I am using current git version: 24a884a When attempting to use a negative trlpadding with in-memory data I get the following error: Error using ft_artifact_zvalue (line 193) negative trlpadding is only allowed with in-memory data I think this is because in ft_artifact_zvalue lines 190-194 perform this check inside the section for in-memory data (the else clause of if ~hasdata). I think lines 190-194 should be moved to start at 188. diff --git a/ft_artifact_zvalue.m b/ft_artifact_zvalue.m index f82f2ad..b98685e 100644 --- a/ft_artifact_zvalue.m +++ b/ft_artifact_zvalue.m @@ -185,13 +185,12 @@ if ~hasdata cfg = ft_checkconfig(cfg, 'dataset2files', 'yes'); hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat); trl = cfg.trl; - -else % check whether the value for trlpadding makes sense % negative trlpadding only allowed with in-memory data if cfg.artfctdef.zvalue.trlpadding < 0 error('negative trlpadding is only allowed with in-memory data'); end +else % check if the input data is valid for this function data = ft_checkdata(data, 'datatype', 'raw', 'hassampleinfo', 'yes'); cfg = ft_checkconfig(cfg, 'forbidden', {'dataset', 'headerfile', 'datafile'})


Robert Oostenveld - 2015-06-26 07:05:49 +0200

thanks for the report. I am trying to understand what it is supposed to do. If you ear data from disk, either positive and negative trial padding should be allowed, right? And if you have data in memory, only negative, but not positive trial padding should be supported (i.e. cut a section off). should it then not be (on line 192) if cfg.artfctdef.zvalue.trlpadding > 0 error('you cannot use positive trlpadding with in-memory data'); end ??


Robin - 2015-06-26 12:44:34 +0200

That makes sense to me! I think functionally the negative trlpadding was only for in-memory data (it says so in the documentation) so I assumed the check was necessary, but I think the positive check you suggest makes more sense.


Robert Oostenveld - 2015-06-26 17:41:16 +0200

(In reply to Robin from comment #2) ok, done. It will be on the ftp this evening and on git in ~15 minutes. mac011> svn commit ft_artifact_zvalue.m Sending ft_artifact_zvalue.m Transmitting file data . Committed revision 10487. thanks, Robert


Robert Oostenveld - 2015-07-15 13:31:07 +0200

closed several bugs at once that were recently fixed