Skip to content

Commit

Permalink
Generate description and context based on key and stratum for parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
nanglo123 committed Aug 16, 2024
1 parent 3043c9a commit aca8184
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mira/metamodel/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def stratify(
params_to_stratify=params_to_stratify,
params_to_preserve=params_to_preserve)
for old_param, new_param in param_mappings.items():
all_param_mappings[old_param].add(new_param)
all_param_mappings[old_param].add((stratum,new_param))
templates.append(new_template)
# Otherwise we are stratifying controllers separately
else:
Expand Down Expand Up @@ -246,7 +246,7 @@ def stratify(
params_to_stratify=params_to_stratify,
params_to_preserve=params_to_preserve)
for old_param, new_param in param_mappings.items():
all_param_mappings[old_param].add(new_param)
all_param_mappings[old_param].add((stratum,new_param))
templates.append(stratified_template)

parameters = {}
Expand All @@ -261,9 +261,13 @@ def stratify(
parameters[parameter_key] = parameter
# We otherwise generate variants of the parameter based
# on the previously complied parameter mappings
for stratified_param in all_param_mappings[parameter_key]:
for stratified_param_tuple in all_param_mappings[parameter_key]:
d = deepcopy(parameter)
stratum = stratified_param_tuple[0]
stratified_param = stratified_param_tuple[1]
d.name = stratified_param
d.description = f"{d.description} stratified by {key}"
d.with_context(inplace=True,**{key:stratum})
parameters[stratified_param] = d

# Create new initial values for each of the strata
Expand Down

0 comments on commit aca8184

Please sign in to comment.