expand_defaults#

Defined in: voxatlas.config.config

voxatlas.config.config.expand_defaults(cfg)[source]#

Merge a user configuration with VoxAtlas defaults.

What “Expand Defaults” Means#

VoxAtlas maintains a small built-in default configuration (voxatlas.config.defaults.DEFAULT_CONFIG). expand_defaults starts from a deep copy of that default mapping and then applies the user configuration on top.

This is a shallow top-level merge:

  • Only the first level of keys is merged (via dict.update).

  • If the user provides a top-level key, it replaces the default value for that key entirely.

  • Nested mappings are not deep-merged. For example, providing a pipeline mapping replaces the whole default pipeline mapping.

Concretely, given the default:

{"features": [], "pipeline": {"cache": True}}

The following user config:

{"pipeline": {"n_jobs": 4}}

Produces:

{"features": [], "pipeline": {"n_jobs": 4}}

(note how pipeline.cache is not preserved because nested dicts are not merged).

param cfg:

User-supplied configuration dictionary.

type cfg:

dict

returns:

Configuration with top-level defaults applied.

rtype:

dict

Notes

If you want to override just one pipeline option while keeping other defaults, pass the full desired pipeline mapping (or use load_and_prepare_config(), which is the recommended config entry point for most workflows).

Examples

>>> from voxatlas.config import expand_defaults
>>> cfg = expand_defaults({"features": ["acoustic.pitch.dummy"]})
>>> cfg["features"]
['acoustic.pitch.dummy']
>>> sorted(cfg["pipeline"].keys())
['cache']
Parameters:

cfg (dict)

Return type:

dict