Skip to content

full_value assignment fails when unit present #143

@rozyczko

Description

@rozyczko

PROBLEM:

  • UnitError when accessing Parameter.full_value after interface assignment
  • Error message: "Expected unit Å, got dimensionless"
  • Occurred when accessing: any parameter in any library after redoing bindings of the interface
  • Also affected arithmetic operations between parameters

ROOT CAUSE:

  • When model.interface = calculator is assigned, generate_bindings() sets up callbacks
  • The callback function returns raw numpy.float64 values (dimensionless)
  • Parameter.full_value property tries to compare dimensionless callback value with scipp.Variable that has units
  • This comparison: scalar != self._scalar triggered UnitError

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions