pace-neutrons / Horace

Horace is a suite of programs for the visualization and analysis of large datasets from time-of-flight neutron inelastic scattering spectrometers.
https://pace-neutrons.github.io/Horace/stable/
GNU General Public License v3.0
7 stars 4 forks source link

Feature request: ability for gen_sqw to handle weighted nxspe files and sum those at equivalent angles #900

Open mducle opened 1 year ago

mducle commented 1 year ago

Currently, Horace makes the assumption that each individual nxspe file which is combined into a sqw is:

  1. Equally weight (counted for the same amount of time).
  2. Has unique orientation (angle psi) or incident energy.

Neither of these conditions necessarily pertain during experiments. Often users would run a "quick" scan over with shorter runs (perhaps 5 min per angle) in order to see a broad overview of the data and then will perhaps re-run the same angles, or with finer angular steps with longer scans (perhaps 10 min per angle). For this to work in Horace, they would need to sum the equivalent angles before input into Horace (e.g. in Mantid), or to run several runs with the same amount of time as the first set (e.g. 2 sets of 5 min run at each angle instead of a single 10 min run). Furthermore, this increases the size of the sqw file which is proportional to the number of contributing nxspe files.


So, it would be good if gen_sqw could:

a. Accept an optional weight argument which is a length-N vector (same size as psi) of weights for each contributing nxspe file. b. Check the psi input argument for unique values and sum together nxspe files with psi values within a tolerance (say 0.1 degrees). At present users set the values of psi so could explicitly define which files should be summed, but we may move in future to reading the values of psi directly from the input data files - in principle the rotation angle modulo a phase (orientation where the u vector is parallel to the incident beam) is stored in the files already.

Implementing feature (a) will require somewhat extensive changes to the internals of Horace but would probably take not more than 1-person-month (full time). One (a) is implemented, (b) should be very easy (less than 1-person-week).


Comments sought from: @abuts @tgperring @davidvoneshen @mincentatties

abuts commented 1 year ago

Summation is not a problem though first request sounds a bit strange -- nxspe files are normalized by current (or something more advanced) so it is weighted signal which contributes to the final sqw. And you can easy weight signals in Mantid if it is necessary (do not see why))