You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the symbolic expressions are serialized, -1*param is stored as -param in the impact models, which sometimes cannot be deserialized back into a symbolic expression.
This can lead to an invalid_expr when loading the model.
Traceback (most recent call last):
File "C:\repositories\demo\run_impact_model.py", line 3, in <module>
model = ImpactModel.from_yaml("data/impact_model.yaml")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\repositories\demo\.venv\Lib\site-packages\apparun\impact_model.py", line 176, in from_yaml
return ImpactModel.from_dict(impact_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\repositories\demo\.venv\Lib\site-packages\apparun\impact_model.py", line 148, in from_dict
tree=ImpactTreeNode.from_dict(impact_model["tree"]),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\repositories\demo\.venv\Lib\site-packages\apparun\impact_tree.py", line 138, in from_dict
node = ImpactTreeNode(
^^^^^^^^^^^^^^^
File "C:\repositories\demo\.venv\Lib\site-packages\pydantic\main.py", line 250, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for ImpactTreeNode
models
[type=invalid_expr, input_value={'EFV3_CLIMATE_CHANGE': '... 21.707425626610416)))'}, input_type=dict]
A workaround is to manually replace each occurrence of -param by -1*param in the impact model.
Activity
[-]-1*param is serialized in -param[/-][+]-1*param is serialized as -param[/+]m-prl commentedon Jul 16, 2026
Fixed in release
0.4.5