$$\renewcommand\AA{\unicode{x212B}}$$

# FlipperEfficiency v1¶

## Summary¶

Calculate the efficiency of the polarization flipper.

## Properties¶

Name

Direction

Type

Default

Description

InputWorkspace

Input

WorkspaceGroup

Mandatory

Group workspace containing flipper transmissions for all 4 polarization states.

SpinStates

Input

string

11,10,01,00

Order of individual spin states in the input group workspace, e.g. “01,11,00,10”

OutputWorkspace

Output

MatrixWorkspace

Workspace containing the wavelength-dependent efficiency for the flipper.

OutputFilePath

Input

string

File name or path for the output to be saved to.

## Description¶

Calculates the efficiency of a single flipper as a function of wavelength, as described by Wildes [1] and by Krycka et al. [2]. The input workspace must be a group of four single spectrum workspaces, each representing the transmission of a known spin state as specified by the SpinStates parameter. These four spin state transmissions are used to calculate the proportion of neutrons lost to the flipper as a function of wavelength.

The polarization of the flipper $$P_{F}$$ is given by:

$P_F = \frac{(\frac{T_{11} - T_{10}}{T_{11} + T_{10}})}{(\frac{T_{00} - T_{01}}{T_{00} + T_{01}})}$

Since the efficiency $$\epsilon_{F}$$ is equal to $$\frac{1 + P_{F}}{2}$$, we can calculate the efficiency of the flipper directly using:

$\epsilon_{F} = \frac{T_{11}T_{00} - T_{10}T_{01}}{(T_{11} + T_{10})(T_{00} - T_{01})}$

The errors are calculated as follows:

$\sigma_{\epsilon_{F}} = \sqrt{| \frac{\delta \epsilon_{F}}{\delta T_{11}}|^2 * \sigma^2_{T_{11}} + | \frac{\delta \epsilon_{F}}{\delta T_{00}}|^2 * \sigma^2_{T_{00}} + | \frac{\delta \epsilon_{F}}{\delta T_{10}}|^2 * \sigma^2_{T_{10}} + | \frac{\delta \epsilon_{F}}{\delta T_{01}}|^2 * \sigma^2_{T_{01}}}$

Where:

$\frac{\delta \epsilon_{F}}{\delta T_{11}} = \frac{T_{10} * (T_{00} + T_{01})}{(T_{11} + T_{10})^2 * (T_{00} - T_{01})}$
$\frac{\delta \epsilon_{F}}{\delta T_{00}} = \frac{T_{01} * (T_{10} - T_{11})}{(T_{11} + T_{10}) * (T_{00} - T_{01})^2}$
$\frac{\delta \epsilon_{F}}{\delta T_{10}} = \frac{-T_{11} * (T_{00} + T_{01})}{(T_{11} + T_{10})^2 * (T_{00} - T_{01})}$
$\frac{\delta \epsilon_{F}}{\delta T_{01}} = \frac{T_{00} * (T_{11} - T_{10})}{(T_{11} + T_{10}) * (T_{00} - T_{01})^2}$

### Outputs¶

If an output file path is provided, a NeXus file containing the output workspace will be saved. If an absolute path is provided, the output workspace will be saved to the given path. If only a filename or a relative path is provided, the output workspace will be saved with that filename into the location set in the Default Save Directory field of the File -> Manage User Directories window.

A workspace will not be output by the algorithm unless an output workspace name is provided.

An output workspace name, output file path, or both must be given.

## Usage¶

Example - Calculate Flipper Efficiency

CreateSampleWorkspace(OutputWorkspace='out_00', Function='User Defined', UserDefinedFunction='name=Lorentzian, Amplitude=48000, PeakCentre=2.65, FWHM=1.2', XUnit='wavelength', NumBanks=1, BankPixelWidth=1, XMin=0, XMax=16.5, BinWidth=0.1)
CreateSampleWorkspace(OutputWorkspace='out_11', Function='User Defined', UserDefinedFunction='name=Lorentzian, Amplitude=47000, PeakCentre=2.65, FWHM=1.2', XUnit='wavelength', NumBanks=1, BankPixelWidth=1, XMin=0, XMax=16.5, BinWidth=0.1)
CreateSampleWorkspace(OutputWorkspace='out_10', Function='User Defined', UserDefinedFunction='name=Lorentzian, Amplitude=22685, PeakCentre=2.55, FWHM=0.6', XUnit='wavelength', NumBanks=1, BankPixelWidth=1, XMin=0, XMax=16.5, BinWidth=0.1)
CreateSampleWorkspace(OutputWorkspace='out_01', Function='User Defined', UserDefinedFunction='name=Lorentzian, Amplitude=22685, PeakCentre=2.55, FWHM=0.6', XUnit='wavelength', NumBanks=1, BankPixelWidth=1, XMin=0, XMax=16.5, BinWidth=0.1)

group = GroupWorkspaces(['out_00','out_11','out_10','out_01'])

group = ConvertUnits(group, "Wavelength")

out = FlipperEfficiency(group, SpinStates="00, 11, 10, 01")

print("Flipper efficiency at a wavelength of " + str(mtd['out'].dataX(0)[3]) + " Å is " + str(mtd['out'].dataY(0)[3]))

Output:

Flipper efficiency at a wavelength of 0.3 Å is ...

## References¶

Categories: AlgorithmIndex | SANS\PolarizationCorrections