-
Notifications
You must be signed in to change notification settings - Fork 1
Add WavelengthDetector and WavelengthMonitor to GenericTofWorkflow #302
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
SimonHeybrock
left a comment
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.
Two questions aside from comments below:
- Should downstream packages that compute this differently remove/prune this do avoid confusion if they use a different domain type, do avoid users computing the false one?
- Could the TOF lookup produce wavelength directly to avoid the extra intermediate step?
| return ToaDetector[RunType](result) | ||
|
|
||
|
|
||
| def detector_wavalength_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.
Spelling
| Total length of the flight path from the source to the detector. | ||
| """ | ||
| return WavelengthDetector[RunType]( | ||
| detector_data.assign_coords(Ltotal=ltotal).transform_coords( |
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 thought this is (or should) already be added when computing TOF?
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.
We don't add the Ltotal coord on the TofDetector.
We just add source_position and sample_position in the coord transform graph and compute Ltotal from that, but it doesn't make it in the output (see https://github.com/scipp/essreduce/blob/main/src/ess/reduce/time_of_flight/eto_to_tof.py#L335)
source_position and sample_position don't make it either in the output.
This was what we did during the Scipp retreat (before that, I think we were adding these coords to the output).
It does mean that now, if you have a data array which is the TofDetector, you can't compute wavelength from just that. It is no longer self-contained.
Should we add the coords back in?
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.
Not sure about our reasoning in October. Wouldn't you think it is conceptually sensible and safer to add it as a coord? I don't think the positions are necessary, but TOF only makes sense with a known Ltotal, right? In a sense they form a pair.
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.
Yes, I agree. I'll add Ltotal then!
| ltotal: DetectorLtotal[RunType], | ||
| graph: CoordTransformGraph, |
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.
Feels a bit odd to have both of these here. If both ltotal and tof is given by the inputs, why do we need a transform graph? Does passing it here give a false promise that the wavelength computation can be influenced via the graph? It might lead to surprising bugs if the graph does some special flightpath correction but then gets silently ignored.
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 we instead forget about the graph and transform coords and compute the wavelength manually using the formula?
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.
Yes, or import the underlying function, not the entire graph?
Good question, I am not sure how best to do this actually.
Did you mean just compute wavelength and not have a |
The latter. |
|
Just the question about |
Add the ability to compute
WavelengthDetectorandWavelengthMonitortoGenericTofWorkflow.This can be overridden in downstream packages:
WavelengthDetector[RunType, Numerator]but it is still useful to have a default implementation here (for e.g. livedata)