Software Open Access
The paramspace package is an open-source Python package that makes it possible to conveniently define dictionary-based, multi-dimensional parameter spaces and iterate over them.
Why?
In Python, dictionaries provide a powerful tool to control program behaviour. Frequently, these configuration structures take the shape of highly nested dictionaries, where each hierarchical level holds the information required at that point of the program.
However, it is frequently desired to instantiate some program not with a single set of parameters but with a set of parameters. Especially for scientific purposes, e.g. numerical simulations, it is often required to perform many instantiations of the same program with different parameters, so-called parameter sweeps. For simple configuration structures, this can be easily achieved by basic control flow tools; however, this becomes increasingly difficult the more parameters are desired to be sweeped over or the further nested they are in the configuration hierarchy.
This is where the paramspace package comes in.
How?
At its core, the paramspace package supplies the ParamSpace class, which accepts a dictionary-like object. To define parameter dimensions, individual entries within that dictionary can be replaced by a ParamDim object, regardless of the position and nestedness within the dictionary. The parameter space is then the cartesian product of all parameter dimensions, each parameter opening a new dimension of the parameter space.
When iterating over the space, each returned value is a dictionary with one combination of parameters, ready to be passed on to run the desired program. This allows retaining a hierarchical configuration structure while at the same time being able to conveniently perform sweeps over parameters, e.g. to spawn simulations with.
Furthermore, the paramspace package integrates tightly with YAML, making it very simple to define multidimensional parameter spaces directly in a configuration file.
More information:
Name | Size | |
---|---|---|
blsqr/paramspace-v2.4.1-zenodo.zip
md5:a45b3a0117e860707f9bf462dd0f2c55 |
78.7 kB | Download |
All versions | This version | |
---|---|---|
Views | 62 | 62 |
Downloads | 3 | 3 |
Data volume | 236.0 kB | 236.0 kB |
Unique views | 45 | 45 |
Unique downloads | 3 | 3 |