From 55772ea30172e0509e729188ffd2f544f9582895 Mon Sep 17 00:00:00 2001 From: Robert Oostenveld Date: Wed, 7 Apr 2021 15:26:28 +0200 Subject: [PATCH] explicitly forbid cfg.trial (without "s") to prevent typos affecting the analyses --- ft_badchannel.m | 2 +- ft_badsegment.m | 2 +- ft_channelnormalise.m | 2 +- ft_channelrepair.m | 1 + ft_componentanalysis.m | 2 +- ft_connectivityanalysis.m | 2 +- ft_connectivityplot.m | 2 +- ft_crossfrequencyanalysis.m | 2 +- ft_databrowser.m | 2 +- ft_denoise_dssp.m | 2 +- ft_denoise_pca.m | 2 +- ft_denoise_prewhiten.m | 2 +- ft_denoise_synthetic.m | 3 ++- ft_denoise_tsr.m | 2 +- ft_detect_movement.m | 2 +- ft_dipolefitting.m | 2 +- ft_dipolesimulation.m | 2 +- ft_electrodeplacement.m | 2 +- ft_electroderealign.m | 2 +- ft_electrodermalactivity.m | 2 +- ft_eventtiminganalysis.m | 2 +- ft_freqanalysis.m | 2 +- ft_freqdescriptives.m | 2 +- ft_freqgrandaverage.m | 2 +- ft_freqstatistics.m | 2 +- ft_globalmeanfield.m | 2 +- ft_heartrate.m | 2 +- ft_lateralizedpotential.m | 2 +- ft_megplanar.m | 2 +- ft_megrealign.m | 2 +- ft_multiplotER.m | 2 +- ft_multiplotTFR.m | 2 +- ft_mvaranalysis.m | 2 +- ft_prepare_layout.m | 2 +- ft_prepare_leadfield.m | 2 +- ft_prepare_neighbours.m | 2 +- ft_preprocessing.m | 2 +- ft_redefinetrial.m | 14 ++++++++------ ft_rejectvisual.m | 2 +- ft_removetemplateartifact.m | 2 +- ft_resampledata.m | 1 + ft_respiration.m | 2 +- ft_scalpcurrentdensity.m | 3 +++ ft_singleplotER.m | 2 +- ft_singleplotTFR.m | 2 +- ft_sourceanalysis.m | 2 +- ft_stratify.m | 2 +- ft_timelockanalysis.m | 2 +- ft_timelockbaseline.m | 2 +- ft_timelockgrandaverage.m | 2 +- ft_timelockstatistics.m | 2 +- private/topoplot_common.m | 2 +- 52 files changed, 62 insertions(+), 54 deletions(-) diff --git a/ft_badchannel.m b/ft_badchannel.m index 6fc47b30f7..878cbb52b2 100644 --- a/ft_badchannel.m +++ b/ft_badchannel.m @@ -105,7 +105,7 @@ data = ft_checkdata(data, 'datatype', 'raw', 'feedback', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'required', 'metric'); % ensure that the preproc specific options are located in the cfg.preproc substructure diff --git a/ft_badsegment.m b/ft_badsegment.m index 2cc30e74b0..c9eb4176e1 100644 --- a/ft_badsegment.m +++ b/ft_badsegment.m @@ -104,7 +104,7 @@ data = ft_checkdata(data, 'datatype', 'raw', 'feedback', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'required', 'metric'); % ensure that the preproc specific options are located in the cfg.preproc substructure diff --git a/ft_channelnormalise.m b/ft_channelnormalise.m index 20039dca78..286c13b855 100644 --- a/ft_channelnormalise.m +++ b/ft_channelnormalise.m @@ -72,7 +72,7 @@ data = ft_checkdata(data, 'datatype', 'raw', 'feedback', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.channel = ft_getopt(cfg, 'channel', 'all'); diff --git a/ft_channelrepair.m b/ft_channelrepair.m index b8c917160f..2df53ac602 100644 --- a/ft_channelrepair.m +++ b/ft_channelrepair.m @@ -85,6 +85,7 @@ end % check if the input cfg is valid for this function +cfg = ft_checkconfig(cfg, 'forbidden', {'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamedval', {'method', 'nearest', 'weighted'}); cfg = ft_checkconfig(cfg, 'renamed', {'elecfile', 'elec'}); cfg = ft_checkconfig(cfg, 'renamed', {'gradfile', 'grad'}); diff --git a/ft_componentanalysis.m b/ft_componentanalysis.m index 4ed6af1bb0..cc67acdf1a 100644 --- a/ft_componentanalysis.m +++ b/ft_componentanalysis.m @@ -185,7 +185,7 @@ data = ft_checkdata(data, 'datatype', 'raw', 'feedback', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'forbidden', {'detrend'}); cfg = ft_checkconfig(cfg, 'renamed', {'blc', 'demean'}); cfg = ft_checkconfig(cfg, 'renamedval', {'method', 'predetermined mixing matrix', 'predetermined unmixing matrix'}); diff --git a/ft_connectivityanalysis.m b/ft_connectivityanalysis.m index ba3da9c4a4..99b7190b59 100644 --- a/ft_connectivityanalysis.m +++ b/ft_connectivityanalysis.m @@ -141,7 +141,7 @@ % data = ft_checkdata(data, 'datatype', {'raw', 'timelock', 'freq', 'source'}); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.feedback = ft_getopt(cfg, 'feedback', 'none'); diff --git a/ft_connectivityplot.m b/ft_connectivityplot.m index 0091d8dd52..ca158cbd83 100644 --- a/ft_connectivityplot.m +++ b/ft_connectivityplot.m @@ -62,7 +62,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'zparam', 'parameter'}); cfg = ft_checkconfig(cfg, 'renamed', {'color', 'linecolor'}); cfg = ft_checkconfig(cfg, 'renamed', {'graphcolor', 'linecolor'}); diff --git a/ft_crossfrequencyanalysis.m b/ft_crossfrequencyanalysis.m index 97d040defc..80f283f4a6 100644 --- a/ft_crossfrequencyanalysis.m +++ b/ft_crossfrequencyanalysis.m @@ -108,7 +108,7 @@ freqhigh = ft_checkdata(freqhigh, 'datatype', 'freq', 'feedback', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % FIXME the below is a bit hacky but it does the trick if isfield(cfg, 'chanlow') && isfield(cfg, 'chanhigh') diff --git a/ft_databrowser.m b/ft_databrowser.m index c2c1a2db81..e8c3fce155 100644 --- a/ft_databrowser.m +++ b/ft_databrowser.m @@ -162,7 +162,7 @@ hascomp = hasdata && ft_datatype(data, 'comp'); % can be 'raw+comp' or 'timelock+comp' % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'unused', {'comps', 'inputfile', 'outputfile'}); cfg = ft_checkconfig(cfg, 'renamed', {'zscale', 'ylim'}); cfg = ft_checkconfig(cfg, 'renamedval', {'ylim', 'auto', 'maxabs'}); diff --git a/ft_denoise_dssp.m b/ft_denoise_dssp.m index 70e1bee920..930fafb0f9 100644 --- a/ft_denoise_dssp.m +++ b/ft_denoise_dssp.m @@ -48,7 +48,7 @@ datain = ft_checkdata(datain, 'datatype', {'raw'}); % FIXME how about timelock and freq? % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'hdmfile', 'headmodel'}); cfg = ft_checkconfig(cfg, 'renamed', {'vol', 'headmodel'}); cfg = ft_checkconfig(cfg, 'renamed', {'grid', 'sourcemodel'}); diff --git a/ft_denoise_pca.m b/ft_denoise_pca.m index dab0e3a86e..5bb59e3ee6 100644 --- a/ft_denoise_pca.m +++ b/ft_denoise_pca.m @@ -82,7 +82,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.refchannel = ft_getopt(cfg, 'refchannel', 'MEGREF'); diff --git a/ft_denoise_prewhiten.m b/ft_denoise_prewhiten.m index 1d3e803518..fe9976abc2 100644 --- a/ft_denoise_prewhiten.m +++ b/ft_denoise_prewhiten.m @@ -67,7 +67,7 @@ noise = ft_checkdata(noise, 'datatype', { 'timelock' 'freq'}, 'haschantype', 'yes', 'haschanunit', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.channel = ft_getopt(cfg, 'channel', 'all'); diff --git a/ft_denoise_synthetic.m b/ft_denoise_synthetic.m index 4cb084eefb..e532b4918e 100644 --- a/ft_denoise_synthetic.m +++ b/ft_denoise_synthetic.m @@ -60,7 +60,8 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'required', {'gradient'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'trial'}); % prevent accidental typos, see issue 1729 +cfg = ft_checkconfig(cfg, 'required', {'gradient'}); % set the defaults cfg.trials = ft_getopt(cfg, 'trials', 'all', 1); diff --git a/ft_denoise_tsr.m b/ft_denoise_tsr.m index 06ab9ef5eb..361b3a3380 100644 --- a/ft_denoise_tsr.m +++ b/ft_denoise_tsr.m @@ -114,7 +114,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.nfold = ft_getopt(cfg, 'nfold', 1); diff --git a/ft_detect_movement.m b/ft_detect_movement.m index 03822a12a6..1dcf0a8af8 100644 --- a/ft_detect_movement.m +++ b/ft_detect_movement.m @@ -90,7 +90,7 @@ data = ft_checkdata(data, 'datatype', {'raw'}, 'feedback', 'yes', 'hassampleinfo', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.method = ft_getopt(cfg, 'method', 'velocity2D'); diff --git a/ft_dipolefitting.m b/ft_dipolefitting.m index b9e984a278..c816662ffe 100644 --- a/ft_dipolefitting.m +++ b/ft_dipolefitting.m @@ -147,7 +147,7 @@ data = ft_checkdata(data, 'datatype', {'comp', 'timelock', 'freq'}, 'feedback', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'elecfile', 'elec'}); cfg = ft_checkconfig(cfg, 'renamed', {'gradfile', 'grad'}); cfg = ft_checkconfig(cfg, 'renamed', {'optofile', 'opto'}); diff --git a/ft_dipolesimulation.m b/ft_dipolesimulation.m index d579d3619e..3b2d0658fd 100644 --- a/ft_dipolesimulation.m +++ b/ft_dipolesimulation.m @@ -100,7 +100,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'elecfile', 'elec'}); cfg = ft_checkconfig(cfg, 'renamed', {'gradfile', 'grad'}); cfg = ft_checkconfig(cfg, 'renamed', {'optofile', 'opto'}); diff --git a/ft_electrodeplacement.m b/ft_electrodeplacement.m index a38f6a9193..8a066a239a 100644 --- a/ft_electrodeplacement.m +++ b/ft_electrodeplacement.m @@ -134,7 +134,7 @@ % see http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=2837 % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'viewdim', 'axisratio'}); cfg = ft_checkconfig(cfg, 'renamedval', {'method', 'mri', 'volume'}); cfg = ft_checkconfig(cfg, 'renamed', {'newfigure', 'figure'}); diff --git a/ft_electroderealign.m b/ft_electroderealign.m index 134b21667b..cf77aafc61 100644 --- a/ft_electroderealign.m +++ b/ft_electroderealign.m @@ -172,7 +172,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'forbidden', {'outline'}); cfg = ft_checkconfig(cfg, 'renamed', {'template', 'target'}); cfg = ft_checkconfig(cfg, 'renamedval', {'method', 'realignfiducials', 'fiducial'}); diff --git a/ft_electrodermalactivity.m b/ft_electrodermalactivity.m index 11c0a06c98..03abd81886 100644 --- a/ft_electrodermalactivity.m +++ b/ft_electrodermalactivity.m @@ -71,7 +71,7 @@ datain = ft_checkdata(datain, 'datatype', 'raw', 'feedback', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % set the default options cfg.channel = ft_getopt(cfg, 'channel', {}); diff --git a/ft_eventtiminganalysis.m b/ft_eventtiminganalysis.m index b02503026f..b8b1ff4d37 100644 --- a/ft_eventtiminganalysis.m +++ b/ft_eventtiminganalysis.m @@ -115,7 +115,7 @@ data = ft_checkdata(data, 'datatype', {'raw+comp', 'raw'}, 'feedback', 'yes', 'hassampleinfo', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'required', {'method'}); % set the defaults diff --git a/ft_freqanalysis.m b/ft_freqanalysis.m index 87326c1d69..e61e348801 100644 --- a/ft_freqanalysis.m +++ b/ft_freqanalysis.m @@ -229,7 +229,7 @@ data = ft_checkdata(data, 'datatype', {'raw', 'raw+comp', 'mvar'}, 'feedback', 'yes', 'hassampleinfo', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'label', 'channel'}); cfg = ft_checkconfig(cfg, 'renamed', {'sgn', 'channel'}); cfg = ft_checkconfig(cfg, 'renamed', {'labelcmb', 'channelcmb'}); diff --git a/ft_freqdescriptives.m b/ft_freqdescriptives.m index 68b151e759..1c13815d64 100644 --- a/ft_freqdescriptives.m +++ b/ft_freqdescriptives.m @@ -88,7 +88,7 @@ freq = ft_checkdata(freq, 'cmbrepresentation', 'sparsewithpow', 'channelcmb', {}); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'jacknife', 'jackknife'}); % throw warnings for the deprecated options diff --git a/ft_freqgrandaverage.m b/ft_freqgrandaverage.m index 5164fcdd1e..fde0d13987 100644 --- a/ft_freqgrandaverage.m +++ b/ft_freqgrandaverage.m @@ -76,7 +76,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.keepindividual = ft_getopt(cfg, 'keepindividual', 'no'); diff --git a/ft_freqstatistics.m b/ft_freqstatistics.m index 788cb409db..c8997ead4c 100644 --- a/ft_freqstatistics.m +++ b/ft_freqstatistics.m @@ -92,7 +92,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'required', {'method', 'design'}); cfg = ft_checkconfig(cfg, 'renamed', {'approach', 'method'}); cfg = ft_checkconfig(cfg, 'forbidden', {'transform'}); diff --git a/ft_globalmeanfield.m b/ft_globalmeanfield.m index aada5ccb67..df5970009e 100644 --- a/ft_globalmeanfield.m +++ b/ft_globalmeanfield.m @@ -79,7 +79,7 @@ datain = ft_checkdata(datain, 'datatype', {'timelock'}, 'feedback', 'yes', 'hassampleinfo', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.method = ft_getopt(cfg, 'method', 'amplitude'); diff --git a/ft_heartrate.m b/ft_heartrate.m index 7eef53d0f8..c5b1d72246 100644 --- a/ft_heartrate.m +++ b/ft_heartrate.m @@ -99,7 +99,7 @@ cfg = ft_checkconfig(cfg, 'forbidden', 'medianwindow'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'ectopicbeat_corr', 'ectopicbeatcorrect'}); % for backward compatibility cfg = ft_checkconfig(cfg, 'renamed', {'corr_threshold', 'ectopicbeatthreshold'}); % for backward compatibility diff --git a/ft_lateralizedpotential.m b/ft_lateralizedpotential.m index 0fa045c728..8140e1aaae 100644 --- a/ft_lateralizedpotential.m +++ b/ft_lateralizedpotential.m @@ -91,7 +91,7 @@ avgR = ft_checkdata(avgR, 'datatype', 'timelock'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % set the defaults if ~isfield(cfg, 'channelcmb') diff --git a/ft_megplanar.m b/ft_megplanar.m index 8379345633..eafe0092a5 100644 --- a/ft_megplanar.m +++ b/ft_megplanar.m @@ -111,7 +111,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'hdmfile', 'headmodel'}); cfg = ft_checkconfig(cfg, 'renamed', {'vol', 'headmodel'}); cfg = ft_checkconfig(cfg, 'renamed', {'grid', 'sourcemodel'}); diff --git a/ft_megrealign.m b/ft_megrealign.m index 7e5541ec47..8f0852f32e 100644 --- a/ft_megrealign.m +++ b/ft_megrealign.m @@ -122,7 +122,7 @@ data = ft_checkdata(data, 'datatype', 'raw', 'feedback', 'yes', 'hassampleinfo', 'yes', 'ismeg', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'plot3d', 'feedback'}); cfg = ft_checkconfig(cfg, 'renamedval', {'headshape', 'headmodel', []}); cfg = ft_checkconfig(cfg, 'required', {'inwardshift', 'template'}); diff --git a/ft_multiplotER.m b/ft_multiplotER.m index a221b3f13e..f49f36ed58 100644 --- a/ft_multiplotER.m +++ b/ft_multiplotER.m @@ -173,7 +173,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'unused', {'cohtargetchannel'}); cfg = ft_checkconfig(cfg, 'renamed', {'cohrefchannel', 'refchannel'}); cfg = ft_checkconfig(cfg, 'renamed', {'hlim', 'xlim'}); diff --git a/ft_multiplotTFR.m b/ft_multiplotTFR.m index d56ad8cb1a..b5efb4a650 100644 --- a/ft_multiplotTFR.m +++ b/ft_multiplotTFR.m @@ -179,7 +179,7 @@ data = ft_checkdata(data, 'datatype', 'freq'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'cohrefchannel', 'refchannel'}); cfg = ft_checkconfig(cfg, 'renamed', {'matrixside', 'directionality'}); cfg = ft_checkconfig(cfg, 'renamed', {'zparam', 'parameter'}); diff --git a/ft_mvaranalysis.m b/ft_mvaranalysis.m index 4f800a861d..67cff13875 100644 --- a/ft_mvaranalysis.m +++ b/ft_mvaranalysis.m @@ -125,7 +125,7 @@ data = ft_checkdata(data, 'datatype', 'raw', 'hassampleinfo', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'blc', 'demean'}); cfg = ft_checkconfig(cfg, 'renamed', {'blcwindow', 'baselinewindow'}); diff --git a/ft_prepare_layout.m b/ft_prepare_layout.m index 0dd56f378b..f11e6a9d39 100644 --- a/ft_prepare_layout.m +++ b/ft_prepare_layout.m @@ -162,7 +162,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'elecfile', 'elec'}); cfg = ft_checkconfig(cfg, 'renamed', {'gradfile', 'grad'}); cfg = ft_checkconfig(cfg, 'renamed', {'optofile', 'opto'}); diff --git a/ft_prepare_leadfield.m b/ft_prepare_leadfield.m index 4668940d03..55557b11bb 100644 --- a/ft_prepare_leadfield.m +++ b/ft_prepare_leadfield.m @@ -131,7 +131,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'hdmfile', 'headmodel'}); cfg = ft_checkconfig(cfg, 'renamed', {'vol', 'headmodel'}); cfg = ft_checkconfig(cfg, 'renamed', {'grid', 'sourcemodel'}); diff --git a/ft_prepare_neighbours.m b/ft_prepare_neighbours.m index 76f6fe978c..1c377f4953 100644 --- a/ft_prepare_neighbours.m +++ b/ft_prepare_neighbours.m @@ -105,7 +105,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'required', {'method'}); cfg = ft_checkconfig(cfg, 'renamed', {'elecfile', 'elec'}); cfg = ft_checkconfig(cfg, 'renamed', {'gradfile', 'grad'}); diff --git a/ft_preprocessing.m b/ft_preprocessing.m index f9d0daa899..febebbc3fb 100644 --- a/ft_preprocessing.m +++ b/ft_preprocessing.m @@ -200,7 +200,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'blc', 'demean'}); cfg = ft_checkconfig(cfg, 'renamed', {'blcwindow', 'baselinewindow'}); cfg = ft_checkconfig(cfg, 'renamed', {'output', 'export'}); diff --git a/ft_redefinetrial.m b/ft_redefinetrial.m index 4c9eaf2c08..b13f51455c 100644 --- a/ft_redefinetrial.m +++ b/ft_redefinetrial.m @@ -90,7 +90,14 @@ return end -% ft_checkdata is done further down +% store original datatype +dtype = ft_datatype(data); + +% check if the input data is valid for this function, this will convert it to raw if needed +data = ft_checkdata(data, 'datatype', {'raw+comp', 'raw'}, 'feedback', 'yes'); + +% check if the input cfg is valid for this function +cfg = ft_checkconfig(cfg, 'forbidden', {'trial'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.offset = ft_getopt(cfg, 'offset', []); @@ -104,16 +111,11 @@ cfg.length = ft_getopt(cfg, 'length', []); cfg.overlap = ft_getopt(cfg, 'overlap', 0); -% store original datatype -dtype = ft_datatype(data); - % deal with the special case of timelock rpt_chan_time with 1 trial oneRptTimelock = (strcmp(dtype, 'timelock') &&... strcmp(data.dimord, 'rpt_chan_time') &&... size(data.trial, 1) == 1); -% check if the input data is valid for this function, this will convert it to raw if needed -data = ft_checkdata(data, 'datatype', {'raw+comp', 'raw'}, 'feedback', 'yes'); % select trials of interest if ~strcmp(cfg.trials, 'all') diff --git a/ft_rejectvisual.m b/ft_rejectvisual.m index d8b756913d..f540f06f4e 100644 --- a/ft_rejectvisual.m +++ b/ft_rejectvisual.m @@ -134,7 +134,7 @@ data = ft_checkdata(data, 'datatype', {'raw+comp', 'raw'}, 'feedback', 'yes', 'hassampleinfo', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamedval', {'metric', 'absmax', 'maxabs'}); cfg = ft_checkconfig(cfg, 'renamedval', {'method', 'absmax', 'maxabs'}); diff --git a/ft_removetemplateartifact.m b/ft_removetemplateartifact.m index 28476a1021..6cd54145f1 100644 --- a/ft_removetemplateartifact.m +++ b/ft_removetemplateartifact.m @@ -73,7 +73,7 @@ template = ft_checkdata(template, 'datatype', 'timelock'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.channel = ft_getopt(cfg, 'channel', 'all'); diff --git a/ft_resampledata.m b/ft_resampledata.m index ee6358e078..438e2c50c7 100644 --- a/ft_resampledata.m +++ b/ft_resampledata.m @@ -83,6 +83,7 @@ % ft_checkdata is done further down % check if the input cfg is valid for this function +cfg = ft_checkconfig(cfg, 'forbidden', {'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'blc', 'demean'}); cfg = ft_checkconfig(cfg, 'renamed', {'resamplemethod', 'method'}); cfg = ft_checkconfig(cfg, 'renamed', {'fsample', 'resamplefs'}); diff --git a/ft_respiration.m b/ft_respiration.m index 7442d2e478..223518088d 100644 --- a/ft_respiration.m +++ b/ft_respiration.m @@ -68,7 +68,7 @@ datain = ft_checkdata(datain, 'datatype', 'raw', 'feedback', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % set the default options cfg.channel = ft_getopt(cfg, 'channel', {}); diff --git a/ft_scalpcurrentdensity.m b/ft_scalpcurrentdensity.m index a94f1019af..fbc6505226 100644 --- a/ft_scalpcurrentdensity.m +++ b/ft_scalpcurrentdensity.m @@ -117,6 +117,9 @@ return end +% check if the input cfg is valid for this function +cfg = ft_checkconfig(cfg, 'forbidden', {'trial'}); % prevent accidental typos, see issue 1729 + % set the defaults cfg.method = ft_getopt(cfg, 'method', 'spline'); cfg.conductivity = ft_getopt(cfg, 'conductivity', 0.33); % in S/m diff --git a/ft_singleplotER.m b/ft_singleplotER.m index 5d6f79553b..1cb5ab3b9f 100644 --- a/ft_singleplotER.m +++ b/ft_singleplotER.m @@ -149,7 +149,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'unused', {'cohtargetchannel'}); cfg = ft_checkconfig(cfg, 'renamedval', {'zlim', 'absmax', 'maxabs'}); cfg = ft_checkconfig(cfg, 'renamedval', {'directionality', 'feedforward', 'outflow'}); diff --git a/ft_singleplotTFR.m b/ft_singleplotTFR.m index 4faefbe36e..b23c1a162a 100644 --- a/ft_singleplotTFR.m +++ b/ft_singleplotTFR.m @@ -135,7 +135,7 @@ data = ft_checkdata(data, 'datatype', 'freq'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'unused', {'cohtargetchannel'}); cfg = ft_checkconfig(cfg, 'renamed', {'matrixside', 'directionality'}); cfg = ft_checkconfig(cfg, 'renamedval', {'zlim', 'absmax', 'maxabs'}); diff --git a/ft_sourceanalysis.m b/ft_sourceanalysis.m index be4224a781..5270fc6980 100644 --- a/ft_sourceanalysis.m +++ b/ft_sourceanalysis.m @@ -175,7 +175,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'forbidden', {'parallel', 'trials'}); cfg = ft_checkconfig(cfg, 'forbidden', {'foi', 'toi'}); cfg = ft_checkconfig(cfg, 'renamed', {'toilim', 'latency'}); diff --git a/ft_stratify.m b/ft_stratify.m index f2b2850456..0f34ec6645 100644 --- a/ft_stratify.m +++ b/ft_stratify.m @@ -79,7 +79,7 @@ % stratification % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.method = ft_getopt(cfg, 'method', 'histogram'); diff --git a/ft_timelockanalysis.m b/ft_timelockanalysis.m index 7bef59eb8c..5dca0b5fe0 100644 --- a/ft_timelockanalysis.m +++ b/ft_timelockanalysis.m @@ -101,7 +101,7 @@ data = ft_checkdata(data, 'datatype', {'raw+comp', 'raw'}, 'feedback', 'yes', 'hassampleinfo', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'forbidden', {'normalizecov', 'normalizevar'}); cfg = ft_checkconfig(cfg, 'forbidden', {'blcovariance', 'blcovariancewindow'}); cfg = ft_checkconfig(cfg, 'renamed', {'blc', 'demean'}); diff --git a/ft_timelockbaseline.m b/ft_timelockbaseline.m index 13efa04adc..e12b8f2a02 100644 --- a/ft_timelockbaseline.m +++ b/ft_timelockbaseline.m @@ -68,7 +68,7 @@ timelock = ft_checkdata(timelock, 'datatype', {'timelock+comp', 'timelock'}, 'feedback', 'yes'); % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'renamed', {'blc', 'demean'}); cfg = ft_checkconfig(cfg, 'renamed', {'blcwindow', 'baselinewindow'}); cfg = ft_checkconfig(cfg, 'forbidden', 'baselinetype'); diff --git a/ft_timelockgrandaverage.m b/ft_timelockgrandaverage.m index 240f1b8fca..4771e03e51 100644 --- a/ft_timelockgrandaverage.m +++ b/ft_timelockgrandaverage.m @@ -104,7 +104,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 % set the defaults cfg.keepindividual = ft_getopt(cfg, 'keepindividual', 'no'); diff --git a/ft_timelockstatistics.m b/ft_timelockstatistics.m index ac3e225b58..1777b411d1 100644 --- a/ft_timelockstatistics.m +++ b/ft_timelockstatistics.m @@ -78,7 +78,7 @@ end % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); % prevent accidental typos, see issue 1729 cfg = ft_checkconfig(cfg, 'forbidden', {'trials'}); % this used to be present until 24 Dec 2014, but was deemed too confusing by Robert cfg = ft_checkconfig(cfg, 'required', {'method', 'design'}); diff --git a/private/topoplot_common.m b/private/topoplot_common.m index 9022b870a0..b01cfa37d9 100644 --- a/private/topoplot_common.m +++ b/private/topoplot_common.m @@ -35,7 +35,7 @@ %% Section 1: general cfg handling that is independent from the data % check if the input cfg is valid for this function -cfg = ft_checkconfig(cfg, 'forbidden', {'channels'}); +cfg = ft_checkconfig(cfg, 'forbidden', {'channels', 'trial'}); % prevent accidental typos cfg = ft_checkconfig(cfg, 'unused', {'cohtargetchannel'}); cfg = ft_checkconfig(cfg, 'renamed', {'cohrefchannel' 'refchannel'}); cfg = ft_checkconfig(cfg, 'renamed', {'zparam', 'parameter'});