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

SpecularReflectionPositionCorrect v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Correct detector positions vertically based on the specular reflection condition.

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

An input workspace to correct.

TwoThetaIn

Input

number

Mandatory

Input two theta angle in degrees.

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}

OutputWorkspace

Output

MatrixWorkspace

Mandatory

An output workspace.

Description

Uses the specular reflection condition \(\theta_{In} \equiv \theta_{Out}\) along with the Beam direction offeset to vertically shift the detectors into a corrected location.

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

For LineDetectors and MultiDetectors, the algorithm uses an average of grouped detector locations to determine the detector position.

Also see SpecularReflectionCalculateTheta v2

Categories: AlgorithmIndex | Reflectometry

Source

C++ header: SpecularReflectionPositionCorrect.h

C++ source: SpecularReflectionPositionCorrect.cpp

Usage

Example - Correct Point Detector position example

# Set up an instrument so that the sample is 1.0 distance from the base of a point detector.
import os
instrument_def = os.path.join( config.getInstrumentDirectory() , "INTER_Definition.xml")
ws = LoadEmptyInstrument(instrument_def)
inst = ws.getInstrument()
ref_frame = inst.getReferenceFrame()
vertical_position = {ref_frame.pointingUpAxis(): 0, ref_frame.pointingAlongBeamAxis(): 1.0, ref_frame.pointingHorizontalAxis():0}
MoveInstrumentComponent(ws, 'point-detector',RelativePosition=False, **vertical_position)
MoveInstrumentComponent(ws, 'some-surface-holder',RelativePosition=False,  X=0, Y= 0, Z=0)

# Correct the detector position. Has a 45 degree incident beam angle.
corrected_ws = SpecularReflectionPositionCorrect(InputWorkspace=ws, DetectorComponentName='point-detector', AnalysisMode='PointDetectorAnalysis', TwoThetaIn=45.0, Version=1)

# Get the detector position post correction. We expect that the vertical offset of the point detector == 1.0
inst = corrected_ws.getInstrument()
det_pos = inst.getComponentByName('point-detector').getPos()
print(det_pos)

Output:

[0,0.414214,1]

Categories: AlgorithmIndex | Reflectometry

Source

C++ header: SpecularReflectionPositionCorrect.h

C++ source: SpecularReflectionPositionCorrect.cpp