Skip to content

Conversation

rozyczko
Copy link
Member

Enhanced Parameter.full_value property:

  1. Check if callback returns a scipp Variable or raw number
  2. If raw number, convert to scipp scalar with original unit
  3. If dimensionless scipp Variable but original has unit, apply original unit
  4. Handle UnitError with fallback to preserve original unit and update value only

Also, added a test

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request does not contain a valid label. Please add one of the following labels: ['chore', 'fix', 'bugfix', 'bug', 'enhancement', 'feature', 'dependencies', 'documentation']

@rozyczko rozyczko added [scope] bug Bug report or fix (major.minor.PATCH) [priority] high Should be prioritized soon [area] Parameters and Descriptors Anything related to Parameters or Descriptors labels Sep 29, 2025
@henrikjacobsenfys
Copy link
Member

henrikjacobsenfys commented Sep 30, 2025

How do we know the unit of the callback when it's a raw number? Or more precisely, if it's a raw number, is there ever a situation where the unit of the callback is different from the one in self._scalar? I.e. self._scalar is in Å and the callback gives a numpy.float64 with implied unit nm? (Just trying to think of any way this might break, and this is the only one I could think of - the fix looks good to me)

@rozyczko
Copy link
Member Author

closed due to a better fix in #145

@rozyczko rozyczko closed this Sep 30, 2025
@rozyczko rozyczko deleted the full_value_check branch September 30, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[area] Parameters and Descriptors Anything related to Parameters or Descriptors [priority] high Should be prioritized soon [scope] bug Bug report or fix (major.minor.PATCH)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants