SIMEXP / psom

pipeline system for octave and matlab
http://psom.simexp-lab.org
Other
24 stars 13 forks source link

psom_defaults #126

Closed pbellec closed 6 years ago

pbellec commented 6 years ago

the psom_struct_defaults function could be simplified.

Defining the default options would look like

def.warp.fwhm = 2; def.warp.nb_iter = 4; def.verbose = true; def.write = NaN;

And now the user would specify

opt.warp.fwhm = 5; opt.write = true;

You would apply the defaults like this

opt = psom_defaults(def,opt);

which should output in that case: opt.warp.fwhm = 5; opt.warp.nb_iter = 4; opt.verbose = true; opt.write = true;

this behaviour would work recursively on any structure depth.

if opt.write is not specfied, psom_defaults return an error (because of the NaN default).

pbellec commented 6 years ago

feedback by @poquirion: if a field is present in opt but not in def, keep it and issue a warning. Have a second argument to turn off the warnings.