-
Notifications
You must be signed in to change notification settings - Fork 1
Move the tof lookup table error threshold to the GenericTofWorkflow #313
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
base: main
Are you sure you want to change the base?
Conversation
| "pulse_stride", | ||
| "distance_resolution", | ||
| "time_resolution", | ||
| "error_threshold", |
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.
Note that the table may or may not have a error_threshold coord. If it does not, trying to remove it using drop_coords would raise. So we filter it out here.
|
|
||
| # Default parameters | ||
| wf[PulseStrideOffset] = None | ||
| wf[LookupTableRelativeErrorThreshold] = 1.0 |
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.
Should the default be something like np.inf?
| ErrorLimitedTofLookupTable, | ||
| LookupTableRelativeErrorThreshold, | ||
| MonitorLtotal, | ||
| PulseStrideOffset, | ||
| TimeOfFlightLookupTable, |
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.
Do we worry about inconsistent naming, TimeOfFlightLookupTable vs LookupTableRelativeErrorThreshold etc.?
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.
Do you mean should LookupTableRelativeErrorThreshold be changed to TofLookupTableRelativeErrorThreshold?
As it's sort of a new param we are adding to the GenericTofWorkflow, now would probably be the best time to make the change.
As for TimeOfFlightLookupTable vs TofLookupTable, this has already been changed and the old TimeOfFlightLookupTable is kept as an alias for retro-compatibility.
| # TODO: The error threshold could be made dependent on the time-of-flight or | ||
| # distance, instead of being a single value for the whole table. | ||
| da = table.array | ||
| relative_error = sc.stddevs(da.data) / sc.values(da.data) |
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.
Is da.data guaranteed to be positive?
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.
The data will either be time-of-flight or wavelength, so yes they will always be positive.
|
|
||
| # Default parameters | ||
| wf[PulseStrideOffset] = None | ||
| wf[LookupTableRelativeErrorThreshold] = 1.0 |
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.
Why this (new) default?
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 don't know, it seems to have worked fine for the 3 examples (v20, dream, ordin) that I tried.
But as I mention above in a comment, I was wondering if it should just be Inf as a default value...
See discussion here: scipp/essdiffraction#236 (comment)
Instead of hard-coding the error threshold on the LUTs saved to disk, we mask later, in the
GenericTofWorkflow.The
LookupTableRelativeErrorThresholdis now a parameter of the mainGenericTofWorkflowinstead of the workflow that builds the table, and can be set by the user.This means that scientists can control what threshold they want to apply.
We set a default value on the workflow so that we don't break existing workflows and notebooks.