make_bciprm.m - Why do we preserve parameter meta info?

Locked
boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

make_bciprm.m - Why do we preserve parameter meta info?

Post by boulay » 12 Sep 2012, 11:45

make_bciprm.m, lines 143-

Code: Select all

for i = 1:numel(fn)
    if isfield(p, fn{i}) % if it already exists, preserve the meta-info from previous occurrences, and update the Value
        s = p.(fn{i});
        if isfield(s, 'NumericValue'), s = rmfield(s, 'NumericValue'); end
        s.Value = arg.(fn{i}).Value;
    else  % otherwise use the whole new substructure
        s = arg.(fn{i});
    end
    p.(fn{i}) = s;
end
What is the benefit to preserving previous occurrence's meta info? For example, when overwriting spatial filters, why would we want to preserve the older RowLabels and ColumnLabels?

jhill
Posts: 31
Joined: 17 Nov 2009, 15:15

Re: make_bciprm.m - Why do we preserve parameter meta info?

Post by jhill » 17 Sep 2012, 13:17

The reason this exists is that, in general, BCI2000 operates on the principle that parameter meta-info (Section, Type, DefaultValue, LowRange, HighRange and Comment) are defined at the beginning (by the filter that registers the parameter) and subsequently unchanged by the loading of parameter files. So I used the principle "earlier is more definitive".

But it's a good point re column/row labels: these things should override previous settings, as they do when loading parameter fragments. I've checked in a new version of make_bciprm.m which allows this. (It still keeps the old column labels and row labels if they are *not* overwritten, however: this allows re-usable things like a sparse SpatialFilter parameter's In Out Wt column labels, or the column labels of the Classifier parameter, to be retained even if the user supplies a label-less matrix on the command-line.)

Locked

Who is online

Users browsing this forum: No registered users and 1 guest