easy_vic_build.tools.params_func.params_set
Module easy_vic_build.tools.params_func.params_set.
Functions
|
|
|
|
|
Classes
|
Initialize ParamManager with nested parameter dictionaries. |
- class easy_vic_build.tools.params_func.params_set.ParamManager(param_dicts: dict)[source]
Bases:
objectInitialize ParamManager with nested parameter dictionaries.
- Parameters:
param_dicts (dict) –
Nested parameter dictionary, e.g.: {
- ”rvic_params”: {
- “VELOCITY”: {
“default”: [1.5], “boundary”: [0.5, 800.0], “type”: float, “optimal”: None,
}
}
- __init__(param_dicts: dict)[source]
Initialize ParamManager with nested parameter dictionaries.
- Parameters:
param_dicts (dict) –
Nested parameter dictionary, e.g.: {
- ”rvic_params”: {
- “VELOCITY”: {
“default”: [1.5], “boundary”: [0.5, 800.0], “type”: float, “optimal”: None,
}
}
- vector_free_mask()[source]
Get a boolean mask indicating which elements of the flattened vector correspond to free parameters.
- Return type:
list of bool
- to_vector(field='default', get_free=False)[source]
Flatten parameters into a single list (vector) from specified field.
- Parameters:
field (str) – The key inside parameter dict to extract (e.g. ‘default’ or ‘optimal’).
- Returns:
Flattened parameter values.
- Return type:
list
- to_dict(vector=None, field='optimal', get_free=False)[source]
Build and return a full parameter dictionary with values filled from: - the internal template (if vector is None), or - the provided vector (if vector is given), written to field.
- Parameters:
vector (list or None) – Flat parameter values to write to the specified field. If None, use existing field values.
field (str) – The field to populate in the returned structure (e.g. “default” or “optimal”).
- Returns:
A new parameter dictionary with updated field values.
- Return type:
dict
- get_vector_info(get_free=False)[source]
Get combined information of parameters as vectors.
- Returns:
- {
“defaults”: list of default values, “optimal”: list of optimal values, “types”: list of parameter types, “bounds”: list of (min, max) tuples, “names”: list of parameter full names like “group.param”
}
- Return type:
dict
- vector_bounds(get_free=True)[source]
Return a flat list of (min, max) tuples for each scalar parameter.
Each boundary must be specified as a list of two lists: e.g., boundary = [[min1, min2, …], [max1, max2, …]]
- vector_types(get_free=True)[source]
Get flattened list of parameter types.
- Return type:
list of types
- vector_names(get_free=False)[source]
Get flattened list of parameter names as “group.param”.
- Return type:
list of str
- save(filepath, param_dict=None)[source]
Save current parameter structure to a JSON file.
- Parameters:
filepath (str) – Path to save JSON file.