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

SpecularReflectionCalculateTheta v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Calculate the specular reflection two theta scattering angle (degrees) from the detector and sample locations .

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

An Input workspace to calculate the specular relection theta on.

AnalysisMode

Input

string

PointDetectorAnalysis

The type of analysis to perform. MultiDetectorAnalysis, LineDetectorAnalysis or MultiDetectorAnalysis. Used to help automatically determine the detector components to move. Allowed values: [‘PointDetectorAnalysis’, ‘LineDetectorAnalysis’, ‘MultiDetectorAnalysis’]

DetectorComponentName

Input

string

Name of the detector component i.e. point-detector. If these are not specified, the algorithm will attempt lookup using a standard naming convention.

SampleComponentName

Input

string

Name of the sample component i.e. some-surface-holder. If these are not specified, the algorithm will attempt lookup using a standard naming convention.

SpectrumNumbersOfDetectors

Input

int list

A list of spectrum numbers making up an effective point detector.

StrictSpectrumChecking

Input

boolean

True

Enable, disable strict spectrum checking. Strict spectrum checking protects against non-sequential integers in which spectrum numbers are not in {min, min+1, …, max}

TwoTheta

Output

number

Calculated two theta scattering angle in degrees.

Description

Uses the Specular reflection condition \(\theta_{In} \equiv \theta_{Out}\) to calculate and return a corrected \(\theta_{In}\).

\[2\centerdot\theta = tan^{-1}\left(\frac{UpOffset}{BeamOffset}\right)\]

The calculated theta value in degrees is returned by the algorithm.

Also see SpecularReflectionPositionCorrect v2

Usage

Example - Point detector theta calculation

# Set up an instrument with a 45 degree final two theta angle.
import os
instrument_def = os.path.join( config.getInstrumentDirectory() , "INTER_Definition.xml")
ws = LoadEmptyInstrument(instrument_def)
inst = ws.getInstrument()
ref_frame = inst.getReferenceFrame()
upoffset = ref_frame.vecPointingUp()
det_position = {ref_frame.pointingUpAxis(): 1.0, ref_frame.pointingAlongBeamAxis(): 1.0, ref_frame.pointingHorizontalAxis():0}
MoveInstrumentComponent(ws, 'point-detector',RelativePosition=False, **det_position)
MoveInstrumentComponent(ws, 'some-surface-holder',RelativePosition=False,  X=0, Y= 0, Z=0)

# Calculate the two theta.
two_theta = SpecularReflectionCalculateTheta(InputWorkspace=ws, DetectorComponentName='point-detector', AnalysisMode='PointDetectorAnalysis', Version=1)
print(two_theta)

Output:

90.0

Categories: AlgorithmIndex | Reflectometry

Source

C++ header: SpecularReflectionCalculateTheta.h

C++ source: SpecularReflectionCalculateTheta.cpp