Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify AMOR/reflectometry workflow #107
Simplify AMOR/reflectometry workflow #107
Changes from all commits
0703e10
3776e33
320ecd2
47dd79f
74d6b66
0e17ad5
5f9c989
840dbab
a414155
8fafbe3
a613608
5015491
9afa893
48d6313
57217ab
acfcc05
514df9b
375b979
459b459
d8319fa
28ac9f7
1d81812
afd5ce9
c0bef22
c0ce521
6eed68b
59b5a0a
efe8434
c65c39e
9b28032
c43c854
33d832b
a9b25fd
a206792
f399b6a
3abbe62
b76dadd
b9eae74
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not very user friendly. Ideally, the code that uses these should convert to the unit it needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand it's messy and somewhat error prone to have unit conversion code all over the package (forgetting a unit conversion somewhere might lead to
UnitErrors
and having extraneous unit conversions in every provider obscures the intention of the code, which is also bad user experience) 🤔It's easiest to have unit conversion code on the boundaries of the application and only work with a set of predetermined units in the "internal" code.
One way to achieve that would be to create a separate provider just for converting the unit of the input to the common unit. But doing that for every input would clutter the workflow graph and make it considerably less readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree. It is often very difficult to understand which units are required by any given piece of code. And we don't encode them in our interfaces.
Yes, the same as using an incorrect unit in a parameter. Except that the latter
UnitErrors
are user errors and it is typically very difficulty to figure out which unit was wrong because those errors can happen after many processing steps.True. That is a tradeoff. But we accepted that tradeoff in ScippNeutron in favour of reducing the number of user-facing
UnitError
s. In fact, we took great care to make coord transform kernels work with any units and do conversions in an optimal way.I don't expect the same amount of care in all code. But I do think that users should not have to know which units are required. Especially given that the requirements are not document anywhere.