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

LoadILLPolarizationFactors v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Loads ILL formatted reflectometry polarization efficiency factors.

Properties

Name

Direction

Type

Default

Description

Filename

Input

string

Mandatory

Path to the polarization efficiency file.

OutputWorkspace

Output

MatrixWorkspace

Mandatory

An output workspace containing the efficiencies at the reference workspace’s wavelength points.

WavelengthReference

Input

MatrixWorkspace

Mandatory

A reference workspace to get the wavelength axis from.

Description

This algorithm loads reflectometry polarization efficiency data from ILL’s IDL-style text files. The output is a workspace with the efficiency factors calculated for each bin or point in the first spectrum of the WavelengthReference workspace. The output workspace is populated with five histograms carrying the following vertical axis labels:

P1

the probability of neutrons not being correctly polarized

P2

the probability of neutrons not being correctly analyzed

F1

the probability of neutron polarization being flipped at the pre-sample flipper

F2

the probability of neutron polarization being flipped at the post-sample flipper

Phi

the combined polarizer-analyzer efficiencies

Note, that the order of the histograms in the output workspace is unspecified. The histograms should be identified by the above labels instead.

The errors in the output histograms are estimated by multiplying the efficiencies by constant factors.

Usage

Note

To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.

Example - Loading sample data and corresponding efficiencies

# We need reference wavelengths. Lets use some real data for that.
# Load direct beam for detector angle calibration.
db = LoadILLReflectometry(Filename='ILL/D17/317369.nxs',
                          XUnit='TimeOfFlight')
rb = LoadILLReflectometry(Filename='ILL/D17/317370.nxs',
                          Measurement='ReflectedBeam',
                          BraggAngle=0.8,
                          XUnit='TimeOfFlight')
# Sum over the reflected beam.
rb_grouped = GroupDetectors(rb, GroupingPattern='201-203')
rb_in_wavelength = ConvertUnits(rb_grouped, Target='Wavelength')
rb_cropped = CropWorkspace(rb_in_wavelength, XMin=0)
pol_factors = LoadILLPolarizationFactors(Filename='ILL/D17/PolarizationFactors.txt',
                                         WavelengthReference=rb_cropped)
# Grab the vertical axis.
axis = pol_factors.getAxis(1)
axisSize = axis.length()
factors = []
for i in range(axisSize):
    factors.append(axis.label(i))
print("The following factors were loaded from the file: {}".format(factors))

Output:

The following factors were loaded from the file: ['F1', 'F2', 'P1', 'P2', 'Phi']

Categories: AlgorithmIndex | DataHandling\Text | ILL\Reflectometry

Source

C++ header: LoadILLPolarizationFactors.h

C++ source: LoadILLPolarizationFactors.cpp