Skip to content

Weird error with dependent parameters depending on order of operations #190

@henrikjacobsenfys

Description

@henrikjacobsenfys
from easyscience.variable import DescriptorNumber, Parameter

angstrom = DescriptorNumber("angstrom", 1e-10, unit="m")

jump_length = Parameter(
    name="jump_length",
    value=float(1.0),
    fixed=False,
    unit="angstrom",
)

# expression = "1/angstrom * jump_length"
expression = "jump_length / angstrom"


map =  {
            "jump_length": jump_length,
            "angstrom": angstrom,
        }

a = Parameter(name='a',value=1.0)
a.make_dependent_on(
    dependency_expression=expression,
    dependency_map=map,
)

The above code produces this error
Image

but using expression = "1/angstrom * jump_length" , which is the same math, does not lead to this error.

Metadata

Metadata

Labels

[priority] highShould be prioritized soon[scope] bugBug report or fix (major.minor.PATCH)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions