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

SANSISISPolarizationCorrections v1

Summary

Wrapper algorithm that calculates a spin leakage calibration and correction for a PA-SANS setup. In ISIS, compatible with ZOOM and LARMOR instruments.

See Also

HeliumAnalyserEfficiency, PolarizerEfficiency, FlipperEfficiency, PolarizationEfficiencyCor

Properties

Name

Direction

Type

Default

Description

UserFilePath

Input

string

Mandatory

Allowed extensions: [‘.toml’]

TransmissionRuns

Input

str list

Input transmission runs. Comma separated run numbers of the transmission runs. Used for calibration of efficiencies.

ScatteringRuns

Input

str list

Input scattering runs. Comma separated run numbers to which to apply corrections.

DirectBeamRun

Input

string

Direct beam run. Used for calibration of efficiencies.

DepolarizedCellRun

Input

string

Depolarized cell run. Used for calibration of efficiencies.

ReductionType

Input

string

CalibrationAndCorrection

The type of reduction: Choose Calibration to generate and save efficiency files, Correction to apply efficiency corrections to scattering data, or CalibrationAndCorrections to do both. Allowed values: [‘Calibration’, ‘CalibrationAndCorrection’, ‘Correction’]

OutputSuffix

Input

string

Suffix to identify processed efficiencies. This is useful, for example, if a set of different cells or samples are used as inputs.

SavePath

Input

string

Path to save directory of processed workspaces.

KeepWsOnADS

Input

boolean

True

Whether to keep reduced files on the ADS. Can’t be unchecked unless a save path is provided in SavePath.

AssertSpinState

Input

boolean

True

Whether to use AssertSpinStateOrder to determine that the expected spin state order is the same for all transmission runs. Set to False if there is no confidence that the spin can be determined accurately from the DetermineSpinStateOrder algorithm

DeletePartialWsOnFail

Input

boolean

True

If the algorithm fails due to poor fitting or some other reason, partial workspaces are automatically deletedunless this property is set to False. Useful for diagnostics.

PxDInitialValue

Input

number

12.6

Initial value of mean path length (pxd) for fitting in DepolarizedAnalyserTransmission algorithm

LifetimeInitialValue

Input

number

54

Initial value of lifetime (in hours) for fitting in HeliumAnalyserEfficiency algorithm

HePolInitialValue

Input

number

0.6

Initial value of helium gas polarization for fitting in HeliumAnalyserEfficiency algorithm

Description

This is a wrapper algorithm that calculates the spin leakage calibration and correction for a PA-SANS setup [1], compatible with the ISIS instruments ZOOM and LARMOR. To process the data, it combines several Mantid PolarizationCorrections algorithms.

The reduction is split in two separate steps, first; a calibration of transmission runs that generates the efficiency workspaces for the polarizing components of the setup, namely: Polarizer, Flippers and Helium Analyzer. The second step corrects the spin leakage contribution on the scattering runs using the previously calculated efficiencies with the Wildes method [2].

The type of reduction; calibration or correction, can be set through the ReductionType property, which selects from a list of values: Calibration, Correction and CalibrationAndCorrection. If either Calibration or Correction are selected, only the respective reduction process will be processed. If CalibrationAndCorrection is selected, both the calibration and the correction will be processed in sequence.

A path to a valid user file is mandatory and must be set through the UserFilePath property. The user file is expected to be a toml file in the SANS Toml V2 Format, which includes fields for polarization settings. The user file will be used to extract information about the instrument: name, monitors, detector offsets and binning as well as the experiment flipper configuration and paths to the efficiency files.

A save path can be set with the SavePath property, which will save the efficiencies, fitting tables and processed transmission workspaces to nexus files. If no output path is chosen, the produced workspaces will be kept on memory at Mantid’s Analysis Data Service (ADS).

A suffix can be appended to the names of the efficiency workspaces and fitting tables by setting the OutputSuffix property.

The property KeepWSOnADS, when set to False, will delete the workspaces published to the ADS when the reduction is completed. It is only enabled when a valid path is chosen in SavePath. The wrapper can be called sequentially and the processed transmission and scattering workspaces, as well as the depolarized and direct runs won’t be reloaded and reprocessed if they are found on the ADS.

Calibration

For calibration, a list of transmission runs must be specified in the TransmissionRuns property, as well as a direct run in DirectBeamRun and a depolarized run in DepolarizedCellRun. The following steps are part of a calibration sequence [1]:

  • Load and normalize the direct (DirectBeamRun), depolarized (DepolarizedCellRun), empty cell (loaded from path in user file) and transmission runs (TransmissionRuns).

  • Fit the cell opacity from the transmission between the depolarized and empty cell runs.

  • Calculate the Helium Analyser Efficiency for each transmission run and fit to an exponential decay to extract the initial polarization and decay rate of the analyzer cell.

  • Calculate the Flipper and Polarizer efficiencies for each transmission run. The flipper configuration is expected to be the same for all input transmission runs, and it is retrieved from the user file or calculated using DetermineSpinStateOrder v1 if the configuration is missing in the file. If the property AssertSpinState is set to False, the spin state set on FlipperConfiguration field of the user file will be used in all runs without any further check.

  • Average the calculated efficiencies for all transmission runs.

  • Save the results in the path chosen in SavePath. Additionally, the cell opacity and analyzer decay parameters are also stored in a table workspace at this location.

Correction

For correction, a list of scattering runs must be specified in the ScatteringRuns property. Efficiency files are needed to calculate the corrections; If the reduction type is CalibrationAndCorrection, the efficiency workspaces on the ADS will be used. Otherwise if the reduction type is Correction, efficiency workspaces will be loaded from file paths extracted from the user file. The following steps are part of a correction sequence:

  • Load scattering runs (ScatteringRuns) as well as efficiencies and polarization decay parameters if necessary.

  • For each scattering run, calculate the Helium Analyzer Efficiency at the time of the experiment using the analyzer cell polarization decay parameters [1].

  • Join the polarizer, flippers and analyzer efficiencies with the JoinISISPolarizationEfficiencies v1 algorithm.

  • Correct the scattering data using the PolarizationEfficiencyCor v1 algorithm.

  • Save the results in the path chosen in SavePath.

References

Categories: AlgorithmIndex | SANS\PolarizationCorrections

Source

Python: SANSISISPolarizationCorrections.py