Skip to content

sig.options

Olivier Lartillot edited this page Sep 20, 2018 · 3 revisions

Description

sig.options construct the optionsChosen structure array containing the specific option choices, based on the optionsAvailable structure array and on the arguments given when calling the operator

optionsAvailable structure array

The structure array is composed of a certain number of fields corresponding to different options.

Each field (i.e., each option) has a name, which will be used as keyword in the operator code, and a value, which is itself a structure array.

Each option structure array is composed of the following fields:

  • a key field indicating the keyword(s) used to indicate this particular option when calling the operator. For instance, for a given operator sig.operator, options.thresh.key = 'Threshold' indicates that the thresh option is accessible through the operator syntax sig.operator(..., 'Threshold',...). Instead of a single string, a cell array of strings can be used instead to indicate accepted variant for the keyword.
  • a type field, whose value is one of the following strings:
    • Boolean
    • Numeric
    • String
    • Unit
    • ..?
  • a default field, indicating the default option choice when the option has not been defined while calling the operator.
  • a keydefault field, indicating the default option choice when the option has been toggled on while calling the operator, but without specification of option value.

optionsAvailable structure array should generally be initiated using the following syntax:

optionsAvailable = sig.Signal.signaloptions('FrameAuto',fl,fh); where:

  • fl is the default frame length in second (when 'Frame' keyword is invoked)
  • fh is the default frame hop between 0 and 1 (when 'Frame' keyword is invoked)

Examples

sig.signal:

    options = sig.Signal.signaloptions('FrameAuto',.05,.5);
    
       center.key = 'Center';
       center.type = 'Boolean';
       center.default = sig.Signal.default.Center;
    options.center = center;

       channel.key = {'Channel','Channels'};
       channel.type = 'Numeric';
       channel.default = [];
    options.channel = channel;
    
       freqband.key = {'FreqBand','FreqBands'};
       freqband.type = 'Numeric';
       freqband.default = [];
    options.freqband = freqband;
    
        sampling.key = 'Sampling';
        sampling.type = 'Numeric';
    options.sampling = sampling;

        extract.key = {'Extract','Excerpt'};
        extract.type = 'Unit';
        extract.number = 2;
        extract.default = [];
        extract.unit = {'s','sp'};
    options.extract = extract;
    
        trim.key = {'Trim'};
        trim.type = 'Boolean';
        trim.default = 0;
    options.trim = trim;
    
        trimwhere.type = 'String';
        trimwhere.choice = {'JustStart','JustEnd','BothEnds'};
        trimwhere.default = 'BothEnds';
    options.trimwhere = trimwhere;
    
        trimthreshold.key = 'TrimThreshold';
        trimthreshold.type = 'Numeric';
        trimthreshold.default = .06;
    options.trimthreshold = trimthreshold;
    
        fwr.key = 'FWR';
        fwr.type = 'Boolean';
        fwr.default = 0;
    options.fwr = fwr;
    
        detrend.key = 'Detrend';
        detrend.type = 'Numeric';
        detrend.default = 0;
        detrend.keydefault = 0.01;
    options.detrend = detrend;
Clone this wiki locally