Skip to content

Commit

Permalink
resolve local obj data for comparing
Browse files Browse the repository at this point in the history
  • Loading branch information
rugeli committed Jul 15, 2024
1 parent 190b58f commit 167b702
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cellpack/autopack/DBRecipeHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,19 @@ def resolve_object_data(self, object_data, prep_recipe_data):
Resolve the object data from the local data.
"""
for key in CompositionDoc.KEY_TO_DICT_MAPPING:
if key in object_data and isinstance(object_data[key], str):
target_dict = CompositionDoc.KEY_TO_DICT_MAPPING[key]
object_data[key] = prep_recipe_data[target_dict][object_data[key]]
if key in object_data:
# single gradient and inherited object
if isinstance(object_data[key], str):
target_dict = CompositionDoc.KEY_TO_DICT_MAPPING[key]
object_data[key] = prep_recipe_data[target_dict][object_data[key]]
# combined gradients
elif isinstance(object_data[key], list):
new_grad_list = []
for grad in object_data[key]:
new_grad_list.append(
{grad: prep_recipe_data["gradients"][grad]}
)
object_data[key] = new_grad_list

def resolve_local_regions(self, local_data, recipe_data, db):
"""
Expand Down

0 comments on commit 167b702

Please sign in to comment.