scipp / essdiffraction

Diffraction data reduction for the European Spallation Source
https://scipp.github.io/essdiffraction/
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

[Requirement] WFM stitching #26

Open jl-wynen opened 7 months ago

jl-wynen commented 7 months ago

Executive summary

Perform WFM stitching of 2 frames of DREAM instrument

Context and background knowledge

Example plots on confluence: https://confluence.esss.lu.se/display/DAM/DREAM+-+WFM+stitching

References

DREAM specs:

DREAM instrument proposal (page 22)

WFM:

https://www.sciencedirect.com/science/article/abs/pii/S0168900213002386?via%3Dihub https://www.sciencedirect.com/science/article/abs/pii/S0168900220308640?via%3Dihub https://www.sciencedirect.com/science/article/abs/pii/S0168900212016142?via%3Dihub

Environment

This method will be used to reduce data detected by the mantle.

If csv files are used as inputs, choppers' settings have to be hard-coded or manually enterered by the users or read by a sort of characterisation file.

When ESS NeXus files will be used, these settings will be read from the metadata stored in the file.

Preconditions

Inputs

Scipp data structure (for mantle detector)

Methodology

WFM stitching has to be performed early in the reduction process for data collected by the mantle, i.e., after loading the relevant files.

Outputs

Scipp dataArray with same structure as input but with data stitched

Which interfaces are required?

Python module / function

Test cases

data_dream_HF_mil_closed_alldets_1e9.csv.zip shared on owncloud (this file was generated using mantle, endcap backward and forward and high resolution detectors)

Acceptance Criteria

Multidimensional (3, 2 and 1 D) data collected by mantle detector is stitched

Comments

Depends on https://github.com/scipp/scippneutron/pull/472

SimonHeybrock commented 7 months ago

Here is my (incomplete) idea to finally resolve the problem of finding the stitching parameters. Using the chopper cascade seems troublesome currently, so let us try calibration via a sample with known peak positions.

Approach:

  1. For each subframe, select a subregion in (time_offset,pixel) or (time_offset,theta) space that does not overlap the subframe bound. Select a peak in each. (see similar figure below, ignore the slightly different coords).
  2. The known $d$ of the peak together with a "source location" chosen, e.g., in the middle of the WFM/pulse-shaping choppers, yields TOF. We can thus define time_offset = tof + t_{0,i} for subframe i. 4.t_{0,i} is basically the center of a PSC opening. We know the opening angle and rotation speed, so defining open and close times is now simple. I think this is essentially a single "virtual" chopper, even if there are 2 choppers in practice.
  3. The virtual chopper together with source-pulse params can be fed into scippneutron.tof.chopper_cascade to compute subframe bounds at all detector positions. ~This does not require any other choppers, I think?~ ... but we still somehow need params for the other choppers. No idea yet how to solve that.
  4. Stitch frames using subframe bounds.
image
SimonHeybrock commented 7 months ago

The stitching code itself is now part of ScippNeutron (to be released), see scippneutron.tof.unwrap.to_time_of_flight. There is also scippneutron.tof.unwrap.time_of_flight_origin_wfm_from_chopper but it is unclear/questionable if this will be used in practice for defining the subframe bounds.