Implement function checkconfig that checks the consistency of cfgs, similar to checkdata for data structure.
Implement function checkconfig that checks consistency of cfgs:
For the user: input cfgs should be adjusted when necessary and possible, and feedback (warning/error) should be given when required options are missing or when forbidden or deprecated options are used. This should replace the current 'backward compatibility' code.
Internal use: checkconfig should control the relevant cfg options that are being passed on to other functions.
Output: only relevant cfg fields should be contained in the output (data.cfg), e.g. it should not contain unused default settings.
Overview of relevant functions (where checkconfig should be implemented):
preprocessing ——step1=done——
private/preproc (uses cfg.preproc)
artifact functions ——step1=done——
timelockanalysis ——step1=done——
freqanalysis ——step1=done——
sourceanalysis ——step1=done——
private/prepare_dipole_grid (uses cfg.grid)
statistics functions!!
perhaps also other private functions that take a cfg as input
Overview of existing relevant functions:
createsubcfg
checkconfig
check_cfg_unused
check_cfg_required
Add the check (objective 1) to the existing functions.
Required: check whether required options are present, give error when missing
Renamed: change old options/values into new ones + give warning
Deprecated: give warning when deprecated options are used
Forbidden: give error when forbidden option is used
Incorporate existing functions in checkconfig:
createsubcfg - done -
dataset2files - done -
Control the output cfg:
report on used/unused fields (trackconfig)
remove unused fields from output cfg (trackconfig)
remove large fields from output cfg (checksize)
trackconfig:
controlled via fieldtripdefs or overruled by cfg.trackconfig: 'report', 'cleanup', or 'off'
start of each FT function: cfg=checkconfig(cfg) » if user requests report or cleanup, configtracking is turned on
end of each FT function: cfg=checkconfig(cfg, 'trackconfig', 'off')
checksize:
controlled via fieldtripdefs or overruled by cfg.checksize: inf or number in bytes
end of each FT function: cfg=checkconfig(cfg, 'checksize', 'yes')
Back to top