mhrv.defaults

mhrv_get_all_defaults()

mhrv.defaults.mhrv_get_all_defaults(params_struct)

Returns all parameter default values of the mhrv toolbox in a map.

Parameters

params_struct – Optional. The parameter structure to work on. If not provided, this function will search traverse the globally defined toolbox parameters.

The returned map contains keys that correspond the the unique id’s of parameters, e.g dfa.n_max. The map’s values are structures containing the value of the parameter and metadata fields.

mhrv_get_default()

mhrv.defaults.mhrv_get_default(param_id, meta)

Returns the default value configured for a parameter. This function attemps to get the value of a parameter as configured by a user config file. If it can’t find a user-specified default for the parameter, it throws an error.

Parameters
  • param_id – Unique id of the parameter This is made up of the keys in the defaults file leading to the parameter (not including the ‘value’ key), joined by a ‘.’ character (example: ‘hrv_freq.methods’).

  • meta – Optional. A fieldname to return from the parameter structure (instead of the structure itself). Can be value/description/name/units.

Returns

A structure containing the following fields:

  • value: The user-configured parameter value, if exists, otherwise returns the ‘default_value’.

  • name: The user-friendly/display name of the parameter.

  • description: A description about the parameter.

  • units: The units the parameter is specified in.

Note

If a value for ‘meta’ was specified, only the corresponding field will be returned.

mhrv_load_defaults()

mhrv.defaults.mhrv_load_defaults(varargin)

Loads an mhrv defaults file, setting it’s values as default for all toolbox functions. Optionally, all current parameter defaults will be cleared.

Usage:
mhrv_load_defaults [--clear]
mhrv_load_defaults [--clear] <defaults_filename>
mhrv_load_defaults(defaults_filename, 'param1', value1, 'param2', value2, ...)

This function loads the parameter values from the default mhrv parameters file and sets them as the default value for the various toolbox functions.

The second usage form loads the parameter values from an arbitrary mhrv parameters file (.yml). The given file can be a name of a file on the matlab path, or, if it’s not found there, it will be interpreted as a path (absolute or relative to pwd).

The third usage form also allows overriding or adding specific parameters with custom values given to the function. In this form, the filename is optional; the function will also accept just key-value pairs.

Note: This function clears all current default parameters if the ‘–clear’ option is given. Otherwise, it merges the loaded values with the previously existing parameter defaults.

mhrv_parameter()

mhrv.defaults.mhrv_parameter(value, description, name, units)

Creates a parameter structure for use with the mhrv toolbox.

Parameters
  • value – The parameter’s value. Can be any matlab object.

  • description – Informative description of the parameter.

  • name – User friendly/display name of the parameter.

  • units – Parameters units.

Note

All inputs are optional and default to an empty string if not provided.

Returns

An object representing the parameter. Can be added to the defaults with the mhrv_set_default or mhrv_load_defaults functions.

mhrv_save_defaults()

mhrv.defaults.mhrv_save_defaults(output_filename)

Save the current default values of all parameters defined in the toolbox to a file.

Usage:
mhrv_save_defaults <output_filename>

This function saves the current default values of all parameters in the toolbox to a specified output file. The file will be in YAML format. If the output_filename parameters doesn’t specify a .yml extension, it will be added.

mhrv_set_default()

mhrv.defaults.mhrv_set_default(varargin)

Sets (overrides) current default parameter value(s) with new values.

Usage:
mhrv_set_default('param1', value1, 'param2', value2, ...)

This function allows overriding specific parameters with custom values given to the function. The input should consist of key-value pairs, where the keys use the ‘.’ character to separate heirarchy levels (e.g. ‘rqrs.gqconf’).