Replies: 2 comments 6 replies
-
|
@huegle thanks for starting this discussion. :-) For the ESS_butterfly approach we took the approach to
AFAIK this should work within Mantid - but I may be wrong? |
Beta Was this translation helpful? Give feedback.
-
|
Added complication: I will be on vacation for a week :-). I will take down my request on mantid for now, attach it below, and we can come to a clever conclusion once I'm back. I would hate for them to waste time on this if there are better ways. The LoadMcStas algorithm currently reads 6 columns per neutron (Intensity, Position, Position, Neutron_ID, Pixel_ID, Time_Of_Flight), but assumes only a single pulse. I would like to add an option to read an optional 7th column: "Source_Pulse_Index" to allow conversion between TOF and wall time. Background information: This will add a 7th column called "Source_Pulse_Index" to the resulting nexus file data, which will allow conversion between TOF and wall time similar to what happens in experimental event data. Caveat: nothing will be sorted, pulse_indexes and TOFs will appear rather randomly in the data because that is how it was generated in the simulation. Also, because of issues with uservars in McStas, the index might end up being a double instead of an integer. Below are the relevant bits of the ai-generated response (ChatGPT 5.5 "thinking") to my rather crude sketch of an algorithm. Proposed feature Extend LoadMcStas to recognize a 7-column event dataset when the final column is a source pulse index, then convert that pulse index into the event pulse time. 1. Add a new optional property:For an event with source pulse index n, the pulse time should be: 2. Allow either standard 6-column data or 7-column data with Source_Pulse_Index:Replace the strict 6-column check: with schema-aware logic: 3. Populate event pulse time from Source_Pulse_Index:Replace the current hard-coded pulse time:
with: This requires:
The conversion assumes that Mantid event pulse times are stored in nanoseconds relative to the workspace time origin. 4. Emit a warning when Source_Pulse_Index is usedBackground: When using the above method the assign pulse ids, the intensity of the original single pulse is distributed amongst all the newly created pulses. It's not Mantid's job to fix that, and depending on how exactly the user choses to generate the pulse id in his simulation, it might not actually happen that way. Either way, it will be a good idea to add a warning. When Source_Pulse_Index is detected, LoadMcStas should emit a warning that it assigns event pulse times but does not alter event weights. Suggested warning text: This warning should be emitted once per load or once per event dataset, not once per event. Non-goals This feature does not add synthetic chopper logs such as motor speed or time-to-digital converter (TDC) timestamps. This feature does not modify or renormalize event weights. This feature does not define Source_Pulse_Index as a standard McStas convention. It only adds optional support in LoadMcStas for files that contain this explicitly named column. Any chopper logs, pulse normalization, or absolute intensity correction should be handled by the simulation workflow, the McStas instrument definition, or a separate downstream algorithm. Thank you for your consideration! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have (like others) recently worked a bit with correlation choppers, pulsed sources and event data, and realized that mantid's loadmcstas assumes only a single pulse (because that is almost always what we simulate). I have submitted a feature request to mantid that adds optional reading of a new column titled "Source_Pulse_Index" to it (mantidproject/mantid#41458). How exactly one wants to generate that column is left to the user, but the way I did it is to add a time offset to the trace at the start of the instrument, and subtract that offset again before detection, to make sure that the TOF within the pulse is correct. Below is the short form of the instrument:
This of course messes with the statistical weight (the single pulse intensity is now distributed over a lot of pulses), I guess that is the risk (and responsibility) I'll have to take when inserting EXTENDs. Either way, it should not be on mantid to fix that.
I think this capability for loadmcstas should come in handy, and might be useful for future, not one-off applications. It could for example be expanded for other uservars.
Sorry for dropping this in both places at once, it's kind of a chicken-and-egg problem. If there are major problems you see with the idea, now would be a great time to discuss!
Beta Was this translation helpful? Give feedback.
All reactions