Skip to content

Use Transformations instead of GufeKeys for StrategyResults#23

Open
ianmkenney wants to merge 1 commit intomainfrom
feat/no_keys
Open

Use Transformations instead of GufeKeys for StrategyResults#23
ianmkenney wants to merge 1 commit intomainfrom
feat/no_keys

Conversation

@ianmkenney
Copy link
Copy Markdown
Member

Related Issues

Fixes #15

Description

This PR changes how Transformations and their weights are represented within a StrategyResult instance. Previously, the _weights attribute was a dictionary with GufeKeys as keys and Optional[float] as values. Since we should not assume GufeKeys are stable, we should keep track of Transformations directly instead.

However, since Transformations cannot be used as dictionary keys (see OpenFreeEnergy/gufe#714), the mapping needs to be internally represented in a compatible format. Instead of dict[Transformation | NonTransformation, float | None], we'll instead use list[list[Transformation | NonTransformation, float | None]].

Inputs to init and outputs of resolve are still dictionaries, though their keys are now Transformations, not GufeKeys

Changes

  • All instances of GufeKey in signatures are changed to Transformation | NonTransformation
  • New validation method for StrategyResult that checks types of keys and values of input mapping. Failure to validate raises StrategyResultValidationError.
  • Initialization weights parameter and resolve return are now of type dict[Transformation | NonTransformation, float | None].

Checklist

  • Documentation updated
  • Added or modified tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StrategyResult weights should use Transformation objects over GufeKey internally

1 participant