\(\renewcommand\AA{\unicode{x212B}}\)

SingleCrystalDiffuseReduction v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Single Crystal Diffuse Scattering Reduction, normalisation, symmetry and background substraction

See Also

ConvertToMD, MDNormSCDPreprocessIncoherent, MDNorm

Properties

Name

Direction

Type

Default

Description

Filename

Input

list of str lists

Mandatory

Files to combine in reduction. Allowed extensions: [‘_event.nxs’, ‘.nxs.h5’, ‘.nxs’]

Background

Input

string

Background run. Allowed extensions: [‘_event.nxs’, ‘.nxs.h5’, ‘.nxs’]

BackgroundScale

Input

number

1

The background will be scaled by this number before being subtracted.

FilterByTofMin

Input

number

Optional

Optional: To exclude events that do not fall within a range of times-of-flight. This is the minimum accepted value in microseconds. Keep blank to load all events.

FilterByTofMax

Input

number

Optional

Optional: To exclude events that do not fall within a range of times-of-flight. This is the maximum accepted value in microseconds. Keep blank to load all events.

ReuseSAFlux

Input

boolean

True

If True then if a previous SolidAngle and Flux has been loaded it will be reused otherwise it will be loaded.

SolidAngle

Input

string

Mandatory

An input workspace containing momentum integrated vanadium (a measure of the solid angle). See MDNormSCDPreprocessIncoherent for details. Allowed extensions: [‘.nxs’]

Flux

Input

string

Mandatory

An input workspace containing momentum dependent flux. See MDnormSCD for details. Allowed extensions: [‘.nxs’]

MomentumMin

Input

number

Optional

Minimum value in momentum. The max of this value and the flux momentum minimum will be used.

MomentumMax

Input

number

Optional

Maximum value in momentum. The min of this value and the flux momentum maximum will be used.

UBMatrix

Input

list of str lists

Mandatory

Path to an ISAW-style UB matrix text file. See LoadIsawUB. Allowed extensions: [‘.mat’, ‘.ub’, ‘.txt’]

SetGoniometer

Input

boolean

False

Set which Goniometer to use. See SetGoniometer

Goniometers

Input

string

None, Specify Individually

Set the axes and motor names according to goniometers that we define in the code (Universal defined for SNS). Allowed values: [‘None, Specify Individually’, ‘Universal’]

Axis0

Input

string

Axis0: name, x,y,z, 1/-1 (1 for ccw, -1 for cw rotation). A number of degrees can be used instead of name. Leave blank for no axis

Axis1

Input

string

Axis1: name, x,y,z, 1/-1 (1 for ccw, -1 for cw rotation). A number of degrees can be used instead of name. Leave blank for no axis

Axis2

Input

string

Axis2: name, x,y,z, 1/-1 (1 for ccw, -1 for cw rotation). A number of degrees can be used instead of name. Leave blank for no axis

OmegaOffset

Input

dbl list

Offset to apply to the omega rotation of the Goniometer. Need to provide one value for every run.

LoadInstrument

Input

string

Load a different instrument IDF onto the data from a file. See LoadInstrument. Allowed extensions: [‘.xml’]

ApplyCalibration

Input

TableWorkspace

Calibration will be applied using this TableWorkspace using ApplyCalibration.

DetCal

Input

string

Load an ISAW DetCal calibration onto the data from a file. See LoadIsawDetCal. Allowed extensions: [‘.detcal’]

CopyInstrumentParameters

Input

MatrixWorkspace

The input workpsace from which CopyInstrumentParameters will copy parameters to data

MaskFile

Input

string

Masking file for masking. Supported file format is XML and ISIS ASCII. See LoadMask. Allowed extensions: [‘.xml’, ‘.msk’]

SymmetryOperations

Input

string

If specified the symmetry will be applied, can be space group name, point group name, or list individual symmetries.

QDimension0

Input

dbl list

1,0,0

The first Q projection axis

QDimension1

Input

dbl list

0,1,0

The second Q projection axis

QDimension2

Input

dbl list

0,0,1

The third Q projection axis

Dimension0Binning

Input

dbl list

Binning for the 0th dimension. - Leave blank for complete integration - One value is interpreted as step - Two values are interpreted integration interval - Three values are interpreted as min, step, max

Dimension1Binning

Input

dbl list

Binning for the 1th dimension. - Leave blank for complete integration - One value is interpreted as step - Two values are interpreted integration interval - Three values are interpreted as min, step, max

Dimension2Binning

Input

dbl list

Binning for the 2th dimension. - Leave blank for complete integration - One value is interpreted as step - Two values are interpreted integration interval - Three values are interpreted as min, step, max

KeepTemporaryWorkspaces

Input

boolean

False

If True the normalization and data workspaces in addition to the normalized data will be outputted

OutputWorkspace

Output

Workspace

Mandatory

Output Workspace. If background is subtracted _data and _background workspaces will also be made.

Description

Developed for CORELLI but should work on any instrument. This workflow algorithm loops over a series of runs combining them with correct normalisation, subtract the background and apply symmetry. The resulting workspace is a MDHistoWorkspace containing a volume of scattering.

The input filename follows the syntax from MultipleFileProperty

This workflow makes use of ConvertToMD and MDNorm so these should be reviewed to better understand all the options. An example of creating the Solid Angle and Flux workspaces are included in MDNormSCD. MDNormSCDPreprocessIncoherent can be used to process Vanadium data for the Solid Angle and Flux workspaces.

The resulting workspaces can be saved and loaded with SaveMD and LoadMD respectively.

Masking

The mask from the solid angle workspace is copied to the data. Additional masking is provided by a masking file. A masking file can be created my masking a data file then saving it using SaveMask.

Background

The background is processed the same as the data except that the Goniometer is copied from the data before setting the UB matrix. If a background is included three workspaces are create. If “OutputWorkspace” is set to “ws” you will get the following.

“ws_normalizedBackground” containing the normalised background.

“ws_normalizedData” containing the normalised data.

And “ws” where

\[ws = ws\_normalizedData - ws\_normalizedBackground * BackgroundScale\]

Should the background scale not be correct this allows you to redo the background subtraction without rerunning the reduction.

If no background is used then the “ws” is just the normalised data.

Symmetries

The SymmetryOperations parameters can either be defined as a point or space group were all the symmetries for that group is applied, or you can specify individual symmetries to apply.

For example setting SymmetryOperations to space group “P 31 2 1”, point group “321” or “x,y,z; -y,x-y,z; -x+y,-x,z; y,x,-z; x-y,-y,-z; -x,-x+y,-z” are equivalent. Note these symmetries are on the real lattice not reciprocal.

Temporary Workspaces

If the KeepTemporaryWorkspaces option is True the data and the normalization in addition to the nomalized data will be outputted. This allows you to run separate instances of SingleCrystalDiffuseReduction and combine the results. They will have names “ws_data” and “ws_normalization” respectively.

Where

\[ws\_normalizedData = \frac{ws\_data}{ws\_normalization}\]

If background is subtracted there will be similar “ws_background_data” and “ws_background_normalization” for the background.

Where

\[ws\_normalizedBackground = \frac{ws\_background\_data}{ws\_backgournd\_normalization}\]

Workflow

../_images/ImageNotFound.png

diagram generation was disabled

Usage

Single file

SingleCrystalDiffuseReduction(Filename='CORELLI_29782',
                              SolidAngle='/SNS/CORELLI/shared/Vanadium/2016B/SolidAngle20160720NoCC.nxs',
                              Flux='/SNS/CORELLI/shared/Vanadium/2016B/Spectrum20160720NoCC.nxs',
                              UBMatrix="/SNS/CORELLI/IPTS-15526/shared/benzil_Hexagonal.mat",
                              OutputWorkspace='output',
                              SetGoniometer=True,
                              Axis0="BL9:Mot:Sample:Axis1,0,1,0,1",
                              Dimension0Binning='-10.05,0.1,10.05',
                              Dimension1Binning='-10.05,0.1,10.05',
                              Dimension2Binning='-0.1,0.1')
../_images/SingleCrystalDiffuseReduction_corelli_single.png

Multiple files

SingleCrystalDiffuseReduction(Filename='CORELLI_29782:29817:10',
                              SolidAngle='/SNS/CORELLI/shared/Vanadium/2016B/SolidAngle20160720NoCC.nxs',
                              Flux='/SNS/CORELLI/shared/Vanadium/2016B/Spectrum20160720NoCC.nxs',
                              UBMatrix="/SNS/CORELLI/IPTS-15526/shared/benzil_Hexagonal.mat",
                              OutputWorkspace='output',
                              SetGoniometer=True,
                              Axis0="BL9:Mot:Sample:Axis1,0,1,0,1",
                              Dimension0Binning='-10.05,0.1,10.05',
                              Dimension1Binning='-10.05,0.1,10.05',
                              Dimension2Binning='-0.1,0.1')
../_images/SingleCrystalDiffuseReduction_corelli_multiple.png

Single file with symmetry

SingleCrystalDiffuseReduction(Filename='CORELLI_29782',
                              SolidAngle='/SNS/CORELLI/shared/Vanadium/2016B/SolidAngle20160720NoCC.nxs',
                              Flux='/SNS/CORELLI/shared/Vanadium/2016B/Spectrum20160720NoCC.nxs',
                              UBMatrix="/SNS/CORELLI/IPTS-15526/shared/benzil_Hexagonal.mat",
                              OutputWorkspace='output',
                              SetGoniometer=True,
                              Axis0="BL9:Mot:Sample:Axis1,0,1,0,1",
                              Dimension0Binning='-10.05,0.1,10.05',
                              Dimension1Binning='-10.05,0.1,10.05',
                              Dimension2Binning='-0.1,0.1',
                              SymmetryOperations="P 31 2 1")
../_images/SingleCrystalDiffuseReduction_corelli_single_sym.png

Multiple files with symmetry

SingleCrystalDiffuseReduction(Filename='CORELLI_29782:29817:10',
                              SolidAngle='/SNS/CORELLI/shared/Vanadium/2016B/SolidAngle20160720NoCC.nxs',
                              Flux='/SNS/CORELLI/shared/Vanadium/2016B/Spectrum20160720NoCC.nxs',
                              UBMatrix="/SNS/CORELLI/IPTS-15526/shared/benzil_Hexagonal.mat",
                              OutputWorkspace='output',
                              SetGoniometer=True,
                              Axis0="BL9:Mot:Sample:Axis1,0,1,0,1",
                              Dimension0Binning='-10.05,0.1,10.05',
                              Dimension1Binning='-10.05,0.1,10.05',
                              Dimension2Binning='-0.1,0.1',
                              SymmetryOperations="P 31 2 1")
../_images/SingleCrystalDiffuseReduction_corelli_multiple_sym.png

Multiple files with symmetry and background substraction

SingleCrystalDiffuseReduction(Filename='CORELLI_29782:29817:10',
                              Background='CORELLI_28124',
                              BackgroundScale=0.95,
                              SolidAngle='/SNS/CORELLI/shared/Vanadium/2016B/SolidAngle20160720NoCC.nxs',
                              Flux='/SNS/CORELLI/shared/Vanadium/2016B/Spectrum20160720NoCC.nxs',
                              UBMatrix="/SNS/CORELLI/IPTS-15526/shared/benzil_Hexagonal.mat",
                              OutputWorkspace='output',
                              SetGoniometer=True,
                              Axis0="BL9:Mot:Sample:Axis1,0,1,0,1",
                              Dimension0Binning='-10.05,0.1,10.05',
                              Dimension1Binning='-10.05,0.1,10.05',
                              Dimension2Binning='-0.1,0.1',
                              SymmetryOperations="P 31 2 1")
../_images/SingleCrystalDiffuseReduction_corelli_multiple_sym_bkg.png

Reading in elastic Corelli autoreduced data

SingleCrystalDiffuseReduction(Filename=','.join('/SNS/CORELLI/IPTS-15526/shared/autoreduce/CORELLI_'+str(run)+'_elastic.nxs' for run in range(29782,29818,10)),
                              Background='/SNS/CORELLI/IPTS-15796/shared/autoreduce/CORELLI_28124_elastic.nxs',
                              BackgroundScale=0.95,
                              SolidAngle='/SNS/CORELLI/shared/Vanadium/2016B/SolidAngle20160720NoCC.nxs',
                              Flux='/SNS/CORELLI/shared/Vanadium/2016B/Spectrum20160720NoCC.nxs',
                              UBMatrix="/SNS/CORELLI/IPTS-15526/shared/benzil_Hexagonal.mat",
                              OutputWorkspace='output',
                              SetGoniometer=True,
                              Axis0="BL9:Mot:Sample:Axis1,0,1,0,1",
                              Dimension0Binning='-10.05,10.05,0.1',
                              Dimension1Binning='-10.05,10.05,0.1',
                              Dimension2Binning='-0.1,0.1',
                              SymmetryOperations="P 31 2 1")
../_images/SingleCrystalDiffuseReduction_corelli_multiple_sym_bkg_elastic.png

Defining the axis to be [H,H,0], [H,-H,0], [0,0,L]

SingleCrystalDiffuseReduction(Filename='CORELLI_29782:29817:10',
                              Background='CORELLI_28124',
                              BackgroundScale=0.95,
                              SolidAngle='/SNS/CORELLI/shared/Vanadium/2016B/SolidAngle20160720NoCC.nxs',
                              Flux='/SNS/CORELLI/shared/Vanadium/2016B/Spectrum20160720NoCC.nxs',
                              UBMatrix="/SNS/CORELLI/IPTS-15526/shared/benzil_Hexagonal.mat",
                              OutputWorkspace='output',
                              SetGoniometer=True,
                              Axis0="BL9:Mot:Sample:Axis1,0,1,0,1",
                              QDimension0='1,1,0',
                              QDimension1='1,-1,0',
                              QDimension2='0,0,1',
                              Dimension0Binning='-7.5375,0.075,7.5375',
                              Dimension1Binning='-13.165625,0.13100125,13.165625',
                              Dimension2Binning='-0.1,0.1',
                              SymmetryOperations="P 31 2 1")

import matplotlib.pyplot as plt
from mantid import plots
fig, ax = plt.subplots(subplot_kw={'projection':'mantid'})
c = ax.pcolormesh(mtd['output'],vmin=0, vmax=1e-5)
fig.colorbar(c)
plt.show()
../_images/SingleCrystalDiffuseReduction_corelli_multiple_sym_bkg_HH0.png

Source

Python: SingleCrystalDiffuseReduction.py