-
Notifications
You must be signed in to change notification settings - Fork 2
Use generic tof workflow #160
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
Conversation
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.
Looks good, just some minor comments.
| "DREAM_simple_pwd_workflow/Cave_TOF_Monitor_van_can.dat": "md5:e63456c347fb36a362a0b5ae2556b3cf", # noqa: E501 | ||
| "DREAM_simple_pwd_workflow/Cave_TOF_Monitor_vana_inc_coh.dat": "md5:701d66792f20eb283a4ce76bae0c8f8f", # noqa: E501 | ||
| "DREAM-high-flux-tof-lookup-table.h5": "md5:404145a970ed1188e524cba10194610e", # noqa: E501 | ||
| "DREAM-high-flux-tof-lookup-table.h5": "md5:1b95a359fa7b0d8b4277806ece9bf279", # noqa: E501 |
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 this the 2d table?
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, with additional coords (I think I updated the notebook that generates it?)
src/ess/dream/workflow.py
Outdated
| return ReducerSoftwares( | ||
| [ | ||
| Software.from_package_metadata('essdiffraction'), | ||
| # Software.from_package_metadata('essdiffraction'), |
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?
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.
Left over from local development.
It's an issue for me because of the way I locally 'installed' our packages (using symbolic links instead of a pip install).
I'll change it back.
f51f882 to
2d391a8
Compare
…into use-generic-tof-wf
|
The issue with the docs build is apparently when I insert this provider Without it, no error in the docs. |
No generic type? |
src/ess/powder/conversion.py
Outdated
| def load_tof_lookup_table( | ||
| filename: TimeOfFlightLookupTableFilename, | ||
| ) -> TimeOfFlightLookupTable: | ||
| return TimeOfFlightLookupTable(sc.io.load_hdf5(filename)) |
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 this still used? If so, why is there no such provider in essreduce?
src/ess/powder/types.py
Outdated
| """Monitor data with time-of-flight coordinate.""" | ||
|
|
||
|
|
||
| TimeOfFlightLookupTableFilename = NewType("TimeOfFlightLookupTableFilename", str) |
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 this not generic across instruments? Why not define in essreduce?
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, let's do that
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.
So you can either load a lookup table from file, or build it from a simulation.
I'm assuming that the default should be that you want to load the table from a file (this is what most people will want to do).
What would be a convenient way to switch between this mode, and building from simulation?
At the moment, i'm having to know which provider to import and then insert in the workflow, as done in the tests here: https://github.com/scipp/essdiffraction/pull/160/files#diff-397d502aff143b028a421a4e43ded449baae3d8b2ae6711bee74734d7aa1c9e5R146
Is this ok for now? It's not many lines of code, but knowing the import path is annoying. Should I add that particular provider to the __init__ of the time_of_flight submodule to make it more accessible?
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.
When computing the LUT, don't you actually need a whole bunch of extra bits in the pipeline, such as loading choppers?
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.
Hmm yes. It seems that in the test here I've stopped the workflow at the SimulationResults, which is computed once, without reading choppers from the files.
However, in the TBL workflow in essimaging, I'm using the choppers from the file in a provider to make the SimulationResults: https://github.com/scipp/essimaging/blob/main/src/ess/tbl/conversion.py#L66
Looking at that provider, I'm thinking I should probably also read the source_position from the nexus file.
So we would need to insert at least these two providers. Should we make 2 different workflows? One that loads lookup table from file, and one that builds it on-the-fly?
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.
You can also consider adding a keyword argument so this can be selecting on workflow creation.
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.
That would probably be convenient. However, does this mean I now have 6 cases instead of the 3 here?
@register_workflow
def DreamGeant4MonitorHistogramWorkflow() -> sciline.Pipeline:
"""
Workflow with default parameters for the Dream Geant4 simulation, using a
histogrammed monitor for the normalization.
"""
return DreamGeant4Workflow(run_norm=RunNormalization.monitor_histogram)
@register_workflow
def DreamGeant4MonitorIntegratedWorkflow() -> sciline.Pipeline:
"""
Workflow with default parameters for the Dream Geant4 simulation, using
integrated counts of the monitor for the normalization.
"""
return DreamGeant4Workflow(run_norm=RunNormalization.monitor_integrated)
@register_workflow
def DreamGeant4ProtonChargeWorkflow() -> sciline.Pipeline:
"""
Workflow with default parameters for the Dream Geant4 simulation, using
proton charge for the normalization.
"""
return DreamGeant4Workflow(run_norm=RunNormalization.proton_charge)Won't this grow exponentially?
I guess this is mostly for the widgets, it doesn't really affect the rest if I add an argument to the underlying DreamGeant4Workflow?
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.
You are right that some things are a bit too inflexible right now. Maybe we need to support workflow (creation) parameters in the widgets?
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.
Looks good.
Again, can't approve.
Note that dependencies will need updating again after we release essreduce==25.05.1.
|
Updated essreduce, should be good to go if builds pass. |
Needs scipp/essreduce#233