Skip to content

Commit

Permalink
Merge pull request mantidproject#20878 from mantidproject/20638_BASIS…
Browse files Browse the repository at this point in the history
…Diffraction

BASISDiffraction: algorithm to ease determination of crystal sample orientation in BASIS
  • Loading branch information
peterfpeterson authored Oct 23, 2017
2 parents f2e4219 + e5c96e2 commit 00c7539
Show file tree
Hide file tree
Showing 11 changed files with 717 additions and 0 deletions.
523 changes: 523 additions & 0 deletions Framework/PythonInterface/plugins/algorithms/BASISDiffraction.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ddf3140c20c10ccfc896810948196a1d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0fe2a4c4331b6b60eea020006a430d52
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6cf08fa3318b7da770c51393ad06235c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
041d223e1dbc8cfcdc0a4bc869aacb0f
69 changes: 69 additions & 0 deletions Testing/SystemTests/tests/analysis/BASISDiffractionSystemTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from __future__ import (absolute_import, division, print_function)

import stresstesting
from mantid import config
from mantid.simpleapi import BASISDiffraction


class OrientedSampleTest(stresstesting.MantidStressTest):
"""
Run a reduction for a scan of runs probing different orientations
of a crystal.
"""

def __init__(self):
super(OrientedSampleTest, self).__init__()
self.config = None
self.setUp()

def setUp(self):
self.config = {p: config[p] for p in ('default.facility',
'default.instrument',
'datasearch.directories')}
config['default.facility'] = 'SNS'
config['default.instrument'] = 'BASIS'
config.appendDataSearchSubDir('BASIS/BASISDiffraction')

def tearDown(self):
config.update(self.config)

def requiredFiles(self):
return ['BASIS_Mask_default_diff.xml',
'BSS_74799_event.nxs',
'BSS_74800_event.nxs',
'BSS_64642_event.nxs',
'BSS_75527_event.nxs',
'BASISOrientedSample.nxs']

def runTest(self):
"""
Override parent method, does the work of running the test
"""
try:
BASISDiffraction(SingleCrystalDiffraction=True,
RunNumbers='74799-74800',
MaskFile='BASIS_Mask_default_diff.xml',
VanadiumRuns='64642',
BackgroundRun='75527',
PsiAngleLog='SE50Rot',
PsiOffset=-27.0,
LatticeSizes=[10.71, 10.71, 10.71],
LatticeAngles=[90.0, 90.0, 90.0],
VectorU=[1, 1, 0],
VectorV=[0, 0, 1],
Uproj=[1, 1, 0],
Vproj=[0, 0, 1],
Wproj=[1, -1, 0],
Nbins=300,
OutputWorkspace='peaky')
finally:
self.tearDown()

def validate(self):
"""
Inform of workspace output after runTest(), and associated file to
compare to.
:return: strings for workspace and file name
"""
self.tolerance = 0.1
return 'peaky', 'BASISOrientedSample.nxs'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
77dadcb61d908fc3d8cdff7422c03124
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
99018fa7987a17cb1556853df806ed64
117 changes: 117 additions & 0 deletions docs/source/algorithms/BASISDiffraction-v1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
.. algorithm::

.. summary::

.. alias::

.. properties::

Description
-----------

**Run numbers**:
The syntax for the run numbers designation allows runs to be segregated
into sets. The semicolon symbol ";" is used to separate the runs into sets.
Runs within each set are jointly reduced. However, when
*Single Crystal Diffraction* is selected, all run numbers provided will be reduced
together.

Examples:

- 2144-2147,2149,2156 is a single set. All runs jointly reduced.

- 2144-2147,2149;2156 is set 2144-2147,2149 and set 2156. The sets are reduced separately from each other (except for *Single Crystal Diffraction*).

**Mask file**: The default mask (BASIS_Mask_default_diff.xml) covers all
inelastic detectors as well as the tips of the diffraction tubes. The file
is in directory /SNS/BSS/shared/autoreduce/new_masks_08_12_2015.

**Lambda Range**: a list containing a minimum and maximum values are required.
Incoming neutrons with a wavelength outside this range will be filtered out.
The default range is [5.86, 6.75].

**OutputWorkspace**: a two-dimensional :ref:`MDHistoWorkspace <MDHistoWorkspace>`
containing the intensities projected onto the reciprocal slice, integrated over
the independent axis *Wproj*. The diffraction pattern can be visualized with
the `SliceViewer <http://www.mantidproject.org/SliceViewer>`_.

**Background runs**: one or more run numbers to describe the background, and a
scaling factor between zero and one.

**Vanadium runs**: a set of runs to be reduced jointly provide an incoherent
and isotropic scattering to determine instrument efficiency per detector. If
no vanadium is provided, all detectors are assumed to have the same efficiency

Determine Single Crystal Diffraction
====================================

Creates a diffraction pattern from a set of runs
implementing a rotational scan of the sample around the vertical axis. The
corresponding goniometer's rotation should be logged under log name
**PsiAngleLog**. Option **PsiOffset** allows user to enter a shift for this
angle.

Sample orientation
~~~~~~~~~~~~~~~~~~

**VectorU**: Vector along k_i, when goniometer is at offset.

**VectorV**: In plane vector perpendicular to VectorU, when goniometer is at
offset.

Diffraction preferences
~~~~~~~~~~~~~~~~~~~~~~~

Most of the scattering occurs in the plane defined by VectorU and VectorV.
Please choose Uproj and Vproj defining a plane that is as close as possible
to the scattering plane.

**Uproj**: Defines the first projection vector. Default (1,0,0).

**Vproj**: Defines the second projection vector. Default (0,1,0).

**Wproj**: Defines the third projection vector. Default (0,0,1).

**Nbins**: the diffraction pattern to be viewed is partitioned into an
Nbins x Nbins grid, each grid rectangle assigned a particular scattered
intensity.

If background is provided, two additional workspaces
are generated. Workspace *_bkg* will contain the scattered intensity by the
background, and workspace *_dat* will contain the scattered intensity by
the sample with *no* background subtracted.

*Timing*: 10 to 15 seconds per sample run. A typical scan made up of 50 runs
will take about 10 minutes to complete.

Usage
-----

**Determine single crystal diffraction pattern:**

.. code-block:: python
from mantid.simpleapi import BASISDiffraction
BASISDiffraction(SingleCrystalDiffraction=True,
RunNumbers='74799-74869',
VanadiumRuns='75524-75526',
BackgroundRuns='75527',
PsiAngleLog='SE50Rot',
PsiOffset=-27.0,
LatticeSizes=[10.71, 10.71, 10.71],
LatticeAngles=[90.0, 90.0, 90.0],
VectorU=[1, 1, 0],
VectorV=[0, 0, 1],
Uproj=[1, 1, 0],
Vproj=[0, 0, 1],
Wproj=[1, -1, 0],
Nbins=400,
OutputWorkspace='peaks')
.. figure:: /images/BASISDiffraction_syngle_crystal_diffraction.png

.. categories::

.. sourcelink::


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/source/release/v3.12.0/spectroscopy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ Direct Geometry
Indirect Geometry
-----------------

- New algorithm :ref:`BASISDiffraction <algm-BASISDiffraction-v1>` to determine the orientation of crystal samples for the BASIS beamline.

:ref:`Release 3.12.0 <v3.12.0>`

0 comments on commit 00c7539

Please sign in to comment.