Ticket #177 (closed: fixed)

Opened 12 years ago

Last modified 5 years ago

Add a unit version from tof->wavelength that includes frame unwrapping

Reported by: Nick Draper Owned by: Russell Taylor
Priority: major Milestone: Iteration 11
Component: Keywords:
Cc: Blocked By:
Blocking: Tester:

Description

This may just be added as an option to the existing conversion. This should start by using a parameter input to give the lref.

Further details from Paolo Here is a brief summary of the unwrapping issue. This should be used for white-beam instruments with choppers. The chopper cut the range of wavelengths, so all detectors (including monitors) should be reduced to the same wavelength range. This is done using a “reference” flightpath, Lref, which is (usually, see below) the flightpath of the farthest detectors. If we call Tmin and Tmax the beginning and end of the frame, for each detector D at total flightpath Ld we can define the following times:

T1=Tmax-Tmin*(1-Ld/Lref)

T2=Ld/Lref*Tmax

If Ld<Lref then T1>T2

Neutron velocities (and hence wavelengths) for the detector D are calculated in the following way:

  1. Tmin<T<T2:

Velocities are calculated in the usual way: v=Ld/T

  1. T2<T<T1

Data at these times are ignored (i.e., they are not used in the wavelength-converted histograms)

  1. T1<T<Tmax

Velocities for these points are calculated using the formula v=Ld/(T-Tmax+Tmin)

Note that the maximum and maximum velocities for the points that are actually *used* are:

vmax=Ld/(T1-Tmax+Tmin)=Lref/Tmin

vmin=Ld/T2=Lref/Tmax

In other words, these velocities are the same for all detectors, so the wavelength range in the transformed histogram will correspondingly be the same.

Occasionally, it may be that some detectors (typically downstream monitors) may be at a *longer* flightpath than Lref. This depends entirely on the chopper aperture/setting. These detectors are “frame-overlapped” – in other words, there is an ambiguity in the definition of the wavelength for certain points, which should therefore be excluded. These points are at the very beginning and at the very end of the frame for a range Dt (equal on both sides) given by

Dt=(Tmax-Tmin)*(1-Lreg/Ld)

In other words, points between Tmin and Tmin+Dt and between Tmax-Dt and Tmax should be excluded. For all other points, velocities and wavelengths are calculated in the normal way (i.e., according to 1.)

Change History

comment:1 Changed 12 years ago by Nick Draper

  • Owner set to Russell Taylor

comment:2 Changed 12 years ago by Russell Taylor

(In [1200]) Add a const version of the Workspace shared pointer typedef. Re #177.

comment:3 Changed 12 years ago by Russell Taylor

(In [1201]) Turns out that was a bad idea (or at least one that requires more thought). Not quite sure why BuildServer was happy because my machine sure wasn't. Re #177.

comment:4 Changed 12 years ago by Russell Taylor

(In [1205]) Small error found in create-Workspace-from-parent method. Re #177.

comment:5 Changed 12 years ago by Russell Taylor

  • Status changed from new to assigned

comment:6 Changed 12 years ago by Nick Draper

  • Milestone changed from Iteration 10 to Iteration 11

comment:7 Changed 12 years ago by Russell Taylor

(In [1275]) Adding an Unwrap algorithm to deal with frame unwrapping (and conversion to wavelength). Re #177.

comment:8 Changed 12 years ago by Russell Taylor

(In [1328]) Added handling of frame overlapping in Unwrap algorithm. Re #177.

comment:9 Changed 12 years ago by Russell Taylor

(In [1343]) Added (incomplete) HRP definition file. Re #177.

comment:10 Changed 12 years ago by Russell Taylor

(In [1344]) Very subtle change required to avoid problems with bounds checking in the VS vector implementation. Re #177.

comment:11 Changed 12 years ago by Russell Taylor

(In [1345]) Add test data files for unwrapping. Re #177.

comment:12 Changed 12 years ago by Russell Taylor

(In [1346]) Modified DiffractionFocussing to throw if reading the grouping file fails. Adding most basic of tests for Unwrap, DiffractionFocussing & AlignDetectors. Re #177.

comment:13 Changed 12 years ago by Russell Taylor

(In [1347]) Put wrong extension on test file. Re #177.

comment:14 Changed 12 years ago by Russell Taylor

(In [1348]) Trying to fix tests. Re #177.

comment:15 Changed 12 years ago by Russell Taylor

  • Status changed from assigned to closed
  • Resolution set to fixed

This is done, though an extended test should be written. Also, Paolo has the following ideas for how this algorithm could be generalised a little:

With respect to the original algorithm, I think we should make a couple of very simple changes to make it more amenable for use with the geometry. I refer to the notations I used in my previous e-mail (I still have a copy if you need it). This approach should work with all white-beam instruments (most instruments at ISIS, except for the chopper spectrometers).

The input parameters are:

DeltaT, vmax, vmin, Lref. If Lref is present, vmax and vmin can have default values. If vmax and vmin are present, Lref is not used.

The default values are:

DeltaT=Tmax-Tmin (these being the min and max times in the TOF frame)

vmax=Lref/Tmin

vmin=Lref/Tmax

Then, the calculation proceeds in a very similar way as before, with the definitions:

T1=DeltaT+Ld/vmax or T1=DeltaT if vmax=infinity or a negative number

T2=Ld/vmin

Neutron velocities (and hence wavelengths) for the detector D at distance Ld are calculated in the following way:

  1. Tmin<T<T2:

Velocities are calculated in the usual way: v=Ld/T

  1. T2<T<T1

Data at these times are ignored (i.e., they are not used in the wavelength-converted histograms)

  1. T1<T<Tmax

Velocities for these points are calculated using the formula v=Ld/(T-DeltaT)

As I noted in the previous e-mail, some of the detectors (particularly transmission monitors) can be frame-overlapped. This happens for

Ld>DeltaT*(1/vmin-1/vmax)-1

In this case, T1<T2, and all the points between T1 and T2 should be masked out. This will result in a useful wavelength range that is smaller than for the other detectors.

Should we have access to geometrical/frequency/phase information of the choppers, the input values can all be calculated (and Lref becomes unnecessary) as follows (I write this for future reference):

vmax=d_chop/Topen

vmin=d_chop/Tclose

DeltaT=1/Frequency

Note that there could be more than one chopper, in which case vmax=min(vmax1, vmax2…), vmin=max(vmin1, vmin2…), and DeltaT=max(DeltaT1, DeltaT2…).

Topen and Tclose can be calculated from the chopper phase, which should be logged, and from the chopper opening angle alpha and the offset between the pick-up and the slit opening, which are geometrical properties.

Topen=phase+offset/(2*Pi*frequency)

Tclose=Topen+alpha/(2*Pi*frequency)

If Tclose>DeltaT then Tclose=Tclose-DeltaT and Topen=Topen-DeltaT (this can be iterated, although it is unlikely that anyone would set the choppers more than one frame ahead)

Note also that Topen can be zero or negative, in which case vmax=infinity or a negative number (the case is dealt with above).

comment:16 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 1025

Note: See TracTickets for help on using tickets.