\(\renewcommand\AA{\unicode{x212B}}\)
DetermineSpinStateOrder v1¶
Summary¶
Takes a workspace group of Polarised SANS run periods and returns a string (e.g ‘11, 10, 01, 00’) of their corresponding spin states in Wildes notation.
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
WorkspaceGroup |
Mandatory |
A Polarised SANS run from either LARMOR or ZOOM (group workspace with 4 periods). |
SpinFlipperLogName |
Input |
string |
Name of the log contained in the InputWorkspace which holds the flipper current (can be inferred if data is from LARMOR or ZOOM). |
|
SpinFlipperAverageCurrent |
Input |
number |
Optional |
Expected average current for the spin slipper over all periods. Used to determine if a particular period has the flipper active or not (can be inferred if data is from LARMOR or ZOOM). |
SpinStates |
Output |
string |
A comma-seperated string of the spin states of each of the run periods e.g ‘11, 10, 01, 00’ |
Description¶
Takes a Polarised SANS transmission run and attempts to determine the spin state for each run period.
The average current through the RF flipper for every run is extracted from the appropriate spin flipper log in the instrument. The beam polarisation is determined by comparing each period transmission to the average transmission (greater than the average suggests the same state as the flipper).
If the data is from LARMOR or ZOOM, properties SpinFlipperLogName and SpinFlipperAverageCurrent can be inferred by the algorithm.
Instrument | SpinFlipperLogName | SpinFlipperAverageCurrent |
|||
---|---|---|---|
LARMOR | |
|
||
ZOOM | |
|
Otherwise, they can be supplied explicitly by the user.
Usage¶
Example - DetermineSpinStateOrder
from mantid.simpleapi import *
from mantid.api import WorkspaceGroup
wsGroup = WorkspaceGroup()
mtd.add("group", wsGroup)
y_values = [10, 80, 20, 90]
flipper_current_values = [3, 3.5, 5.5, 5.8]
for i in range(4):
ws_name = f"ws_{i}"
CreateSampleWorkspace("Histogram", "Flat background", XUnit="Wavelength", XMin=0, XMax=10, BinWidth=1, NumEvents=10, InstrumentName="LARMOR", OutputWorkspace=ws_name)
CropWorkspace(ws_name, StartWorkspaceIndex=1, EndWorkspaceIndex=1, OutputWorkspace=ws_name)
mtd[ws_name] *= y_values[i]
AddTimeSeriesLog(ws_name, "FlipperCurrent", "2010-01-01T00:00:00", flipper_current_values[i])
wsGroup.addWorkspace(mtd[ws_name])
ConvertToHistogram(wsGroup, OutputWorkspace=wsGroup)
result = DetermineSpinStateOrder(wsGroup)
print(f"Spin state order from wsGroup is {result}")
Output:
Spin state order from wsGroup is 01,00,10,11
Categories: AlgorithmIndex | SANS
Source¶
C++ header: DetermineSpinStateOrder.h
C++ source: DetermineSpinStateOrder.cpp