From 6a1d91d9ea1c0e032760abc9c3150ec875a640f3 Mon Sep 17 00:00:00 2001 From: nanglo123 Date: Thu, 19 Dec 2024 10:57:21 -0500 Subject: [PATCH 1/3] Rename template names if already present --- mira/metamodel/ops.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mira/metamodel/ops.py b/mira/metamodel/ops.py index 3a8f2051d..6de58269a 100644 --- a/mira/metamodel/ops.py +++ b/mira/metamodel/ops.py @@ -139,7 +139,7 @@ def stratify( # List of new templates templates = [] - + template_names = set() # Figure out excluded concepts if concepts_to_stratify is None: if concepts_to_preserve is None: @@ -178,12 +178,17 @@ def stratify( # we will stratify controllers separately stratify_controllers = (ncontrollers > 0) and cartesian_control + template_name_index = 0 # Generate a derived template for each stratum for stratum, stratum_idx in stratum_index_map.items(): template_strata = [] new_template = deepcopy(template) new_template.name = \ f"{template.name if template.name else 't'}_{stratum}" + while new_template.name in template_names: + new_template.name = new_template.name + str(template_name_index) + template_name_index += 1 + template_names.add(new_template.name) # We have to make sure that we only add the stratum to the # list of template strata if we stratified any of the non-controllers # in this first for loop From 78883995dae7324fe5b6118b553915721dc9ad44 Mon Sep 17 00:00:00 2001 From: nanglo123 Date: Thu, 19 Dec 2024 11:02:12 -0500 Subject: [PATCH 2/3] Add transition id to GroupedControlledConversions when ingesting petrient --- mira/sources/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mira/sources/util.py b/mira/sources/util.py index ee72f81d6..a5807bf82 100644 --- a/mira/sources/util.py +++ b/mira/sources/util.py @@ -157,6 +157,7 @@ def transition_to_templates( subject=input_concepts[0], outcome=output_concepts[0], rate_law=transition_rate, + name=transition_id, display_name=transition_name, ) From 55d18c565502488ffd55a9a6a87c53750711ad7f Mon Sep 17 00:00:00 2001 From: nanglo123 Date: Thu, 19 Dec 2024 13:04:22 -0500 Subject: [PATCH 3/3] Revert renaming convention in stratify --- mira/metamodel/ops.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mira/metamodel/ops.py b/mira/metamodel/ops.py index 6de58269a..3a8f2051d 100644 --- a/mira/metamodel/ops.py +++ b/mira/metamodel/ops.py @@ -139,7 +139,7 @@ def stratify( # List of new templates templates = [] - template_names = set() + # Figure out excluded concepts if concepts_to_stratify is None: if concepts_to_preserve is None: @@ -178,17 +178,12 @@ def stratify( # we will stratify controllers separately stratify_controllers = (ncontrollers > 0) and cartesian_control - template_name_index = 0 # Generate a derived template for each stratum for stratum, stratum_idx in stratum_index_map.items(): template_strata = [] new_template = deepcopy(template) new_template.name = \ f"{template.name if template.name else 't'}_{stratum}" - while new_template.name in template_names: - new_template.name = new_template.name + str(template_name_index) - template_name_index += 1 - template_names.add(new_template.name) # We have to make sure that we only add the stratum to the # list of template strata if we stratified any of the non-controllers # in this first for loop