Ticket #10169 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Multiple scattering correction for Vesuvio

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: critical Milestone: Release 3.3
Component: Indirect Inelastic Keywords:
Cc: Blocked By: #10178
Blocking: Tester: Roman Tolchenov

Description (last modified by Martyn Gigg) (diff)

Until we get our generic multiple scattering framework in place we need to support multiple scattering corrections for Vesuvio at ISIS based on their old VMS code.

I can't attach the code but we essentially need an algorithm that can do the calculation for

multiple scattering and attenuation in a plane slab *
sample, for inverse geometry.                                            
* S(q,w) is isotropic and described by the impulse approximation.

It will be called something like VesuvioMSCorrection.

Attachments

MSCalc-VMS.jpg (471.1 KB) - added by Martyn Gigg 6 years ago.

Change History

comment:1 Changed 6 years ago by Martyn Gigg

  • Description modified (diff)

comment:2 Changed 6 years ago by Martyn Gigg

  • Status changed from new to assigned
  • Description modified (diff)

comment:3 Changed 6 years ago by Martyn Gigg

  • Blocked By 10178 added

comment:4 Changed 6 years ago by Martyn Gigg

  • Status changed from assigned to inprogress

Add a SampleShapeValidator type

It is used for checking that a workspace has a valid sample shape. Refs #10169

Changeset: 8ac50cb8b0d19a5b13ab019de3ad07baa8665531

comment:5 Changed 6 years ago by Martyn Gigg

Add unit & performance test for V3D::rotate.

Refs #10169

Changeset: 660c36a138f7a9dc0ff79739d0e751af408a3b17

comment:6 Changed 6 years ago by Martyn Gigg

Fix doxygen warnings in SampleShapeValidator

Refs #10169

Changeset: 86d75d393245c1ecc139acd3ad840d9281c4ef1e

comment:7 Changed 6 years ago by Martyn Gigg

Improve performance of V3D::rotate.

Avoids instantiating two additional matrices for the calculation. Refs #10169

Changeset: 576347b030ee2b752c54f31caf5ac7c9157eeb63

comment:8 Changed 6 years ago by Martyn Gigg

Checkpoint CalculateMSVesuvio

Refs #10169

Changeset: 769898783948258b70b4d87719f74ac894c34e92

comment:9 Changed 6 years ago by Martyn Gigg

Add code for calculation of first scattering.

Refs #10169

Changeset: 56052cfc29f7dca3bed952e29ad550028d0267e7

comment:10 Changed 6 years ago by Martyn Gigg

Check point CalculateMSVesuvio

Refs #10169

Changeset: 37b3a7e4ce66db6aa355f91a7364578d990c3e37

comment:11 Changed 6 years ago by Martyn Gigg

Finished off algorithm. Needs further testing.

Refs #10169

Changeset: 5ba4dc5864d367a88c2deda927b3e96d32d81e9c

comment:12 Changed 6 years ago by Martyn Gigg

Futher debugging on Vesuvio MS calculation.

We now get something that looks like a distribution but it doesn't match the VMS output yet. Refs #10169

Changeset: 843a44604f3bf52bf027bc0814e4521966f513bd

comment:13 Changed 6 years ago by Martyn Gigg

Add error in tof to Vesuvio resolution parameters

Refs #10169

Changeset: a3083f7128437d53ed1425844999737f9a5289c7

comment:14 Changed 6 years ago by Martyn Gigg

Fix a few more bugs in calculation.

  1. Use resolution parameter for generating initial tof
  2. Use correct coordinate system for generating random scatter direction.

Refs #10169

Changeset: 65d01b5d6497d120bcedfcf092712767ee23c7fc

comment:15 Changed 6 years ago by Martyn Gigg

Fix error in operator precedance when calculating scatter length

Refs #10169

Changeset: 23b58b02e6c7d4e3d1c643238c1a45f30527e6d2

comment:16 Changed 6 years ago by Martyn Gigg

Fix bug in e1 range determination.

Refs #10169

Changeset: 472d2edb5dbdad9b7a95a88c76cbcb7fd00762da

comment:17 Changed 6 years ago by Martyn Gigg

Fix bug in binning data to final workspace.

Refs #10169

Changeset: 4ef012d9d851a490505e44bf008bffdd5e3a9af4

comment:18 Changed 6 years ago by Martyn Gigg

Convert umbra and penumbra values to metres internally.

Refs #10169

Changeset: 9a9fd6dc1449472209d687add4fd29173c8a4a26

comment:19 Changed 6 years ago by Martyn Gigg

Fix scattering angle calculation on final detector event.

Refs #10169

Changeset: 19bbbd325d2182815b138e8e0916058bc09a44cc

comment:20 Changed 6 years ago by Martyn Gigg

Fix loop terminator for uranium final energy.

Refs #10169

Changeset: 303294c4a2aaaa7ad239fa5958bc52826ac7e3af

comment:21 Changed 6 years ago by Martyn Gigg

Update the Vesuvio detector shape to match reality.

Refs #10169

Changeset: 2cebd8705ad339f47fc2f925fd9254211f34cdbe

comment:22 Changed 6 years ago by Martyn Gigg

Fix problems with computing the final detector position.

Refs #10169

Changeset: 7a84ddf84fdf8b7609d77eea5c8caaf487181172

comment:23 Changed 6 years ago by Martyn Gigg

Fix indexing bug with scatter points.

Refs #10169

Changeset: 8a6602d338ff565c93f23b9149ac776b60a9fe9a

comment:24 Changed 6 years ago by Martyn Gigg

Fix scope problem with setting detector position.

Refs #10169

Changeset: d60b642293208727e2b468841ba62898566929fc

comment:25 Changed 6 years ago by Martyn Gigg

Implement value check for unit test.

Fixed problem with setting initial detector position & shape uncovered here. Refs #10169

Changeset: 8b08ecb737c0005c2cb4973f7865c9f9195d3998

comment:26 Changed 6 years ago by Martyn Gigg

Remove some unused properties.

Refs #10169

Changeset: 91644b76858608238f497c1e2b19cf603c8a976d

comment:27 Changed 6 years ago by Martyn Gigg

Add static function to retrieve resolution parameters

Follows on from how ConvertToYSpace fills the detector parameters Refs #10169

Changeset: 8afc45c4be650466fad1edf18f1b72e5a9682e80

comment:28 Changed 6 years ago by Martyn Gigg

Refactoring to improve readability

Refs #10169

Changeset: e1ab08d600271303ed283e2303125598ba180228

comment:29 Changed 6 years ago by Martyn Gigg

Add properties to control the number of scatterings, runs & events

Refs #10169

Changeset: 3365277a0c6885bdef53d65b936007e79f9af065

comment:30 Changed 6 years ago by Martyn Gigg

Separate helpers into different file

The main algorithm code is easier to read this way. Refs #10169

Changeset: 6deac0b8390a9a693cf65b9780d711a043b20dbd

comment:31 Changed 6 years ago by Martyn Gigg

First performance enhancement

Use STL algorithms for value searching and static storage for constant arrays. Refs #10169

Changeset: 6c990d0e9904e8abfc1230e1fc3933c92fe4f2ce

comment:32 Changed 6 years ago by Martyn Gigg

Remove call to copy constructor in V3D::distance

When called millions of times in a loop, e.g. Monte Carlo, then this can make a noticeably difference. Refs #10169

Changeset: 355f90da867b79dcf358da3d849d03856e8ebe24

comment:33 Changed 6 years ago by Martyn Gigg

Use a list instead of a vector inside intersection tests.

The lists are small so traversal time is not an issue but it is quicker to push back to a list. Refs #10169

Changeset: 9986c9e3ec6c37045a0c5bd3f498e63bd05da9ab

comment:34 Changed 6 years ago by Martyn Gigg

A few minor things to improve efficiency for intersection calcs

Refs #10169

Changeset: bfd7075d8219f63bb5fd353866ff011895ca1e22

comment:35 Changed 6 years ago by Martyn Gigg

Reduce the number of events per run.

It brings the unit test time down to an acceptable place. Refs #10169

Changeset: de1fa94c6fe714988d96a5c7c1e791a38a28b07a

comment:36 Changed 6 years ago by Martyn Gigg

Add include line for std::accumulate.

Refs #10169

Changeset: 68bf42abc5949dd3de7fed5dc64d82b216fb171d

comment:37 Changed 6 years ago by Martyn Gigg

Fix boost random usage for older boost versions.

Refs #10169

Changeset: ed583fa2afffa5da424c05fe8e4f15fa6204e0ed

comment:38 Changed 6 years ago by Martyn Gigg

Fix ambiguity error on intel compiler.

Refs #10169

Changeset: 8b32bd0d0e1ad1ec8cf1f374ea387985a154be60

comment:39 Changed 6 years ago by Martyn Gigg

Change the category the algorithm to an allowed existing one.

Refs #10169

Changeset: 512cc0ea1eff07c59386bd91dcacab626fbd8807

comment:40 Changed 6 years ago by Martyn Gigg

Branch: feature/10169_vesuvio_mscorr

Tester: Assuming you have the Vesuvio test data, the following script should run the algorithm correction. The output should look very similar to the attached picture from the VMS manual.

from mantid.simpleapi import *

runs = "14188-14195"
spectra = "135-182"
diff_type="SingleDifference" # Allowed values=Single,Double,Thick
ip_file = "IP0004_10.par"

raw_ws = LoadVesuvio(Filename=runs, SpectrumList=spectra,
                     Mode=diff_type,InstrumentParFile=ip_file,SumSpectra=False)
raw_ws = CropWorkspace(raw_ws,XMin=50.0,XMax=562.0)
raw_ws = Rebin(raw_ws, Params=[49.5, 1.0, 562.5])

## Multiple Scattering ##
# Create sample shape
height = 0.1 # y-dir (m)
width = 0.1 # x-dir (m)
thick = 0.005 # z-dir (m)

half_height, half_width, half_thick = 0.5*height, 0.5*width, 0.5*thick
xml_str = \
   " <cuboid id=\"sample-shape\"> " \
    + "<left-front-bottom-point x=\"%f\" y=\"%f\" z=\"%f\" /> " % (half_width,-half_height,half_thick) \
    + "<left-front-top-point x=\"%f\" y=\"%f\" z=\"%f\" /> " % (half_width, half_height, half_thick) \
    + "<left-back-bottom-point x=\"%f\" y=\"%f\" z=\"%f\" /> " % (half_width, -half_height, -half_thick) \
    + "<right-front-bottom-point x=\"%f\" y=\"%f\" z=\"%f\" /> " % (-half_width, -half_height, half_thick) \
    + "</cuboid>"
CreateSampleShape(raw_ws, xml_str)
atom_props = [1.007900, 0.9272392, 5.003738, 16.00000, 3.2587662E-02, 13.92299, 27.50000, 4.0172841E-02, 15.07701]
tot_scatter, ms_scatter = CalculateMSVesuvio(raw_ws, NoOfMasses=3,SampleDensity=241,AtomicProperties=atom_props,
                                             BeamRadius=2.5)
tot_scatter = SumSpectra(InputWorkspace=tot_scatter)
ms_scatter = SumSpectra(InputWorkspace=ms_scatter)

Changed 6 years ago by Martyn Gigg

comment:41 Changed 6 years ago by Martyn Gigg

Attachment Caption: Plot of spectrum 135-182, where black line is data, red line is total scattering contribution and green line is multiple scattering contribution.

The data is actually after subtraction so ignore the black line. This algorithm simply calculates the red & green lines.

Last edited 6 years ago by Martyn Gigg (previous) (diff)

comment:42 Changed 6 years ago by Martyn Gigg

Add documentation file for algorithm.

Refs #10169

Changeset: 6e4da70533e2834f46c6db42bd9554b9a07f62ac

comment:43 Changed 6 years ago by Martyn Gigg

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:44 Changed 6 years ago by Roman Tolchenov

  • Status changed from verify to verifying
  • Tester set to Roman Tolchenov

comment:45 Changed 6 years ago by Martyn Gigg

  • Status changed from verifying to closed

Merge branch 'master' into feature/10169_vesuvio_mscorr

Conflicts:

Code/Mantid/instrument/VESUVIO_Parameters.xml

Full changeset: 383f2957d3ee0f5d979e9b3abe97d3c38cd23244

comment:46 Changed 6 years ago by Roman Tolchenov

Merge remote-tracking branch 'origin/feature/10169_vesuvio_mscorr'

Full changeset: a8c3ff4a158aedbb8faa60fb43cf62b0b909cebb

comment:47 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 11011

Note: See TracTickets for help on using tickets.