Workflows#
He3 Cell Workflow#
The he3
submodule provides a helper He3CellWorkflow
:
[1]:
from ess import polarization as pol
print(pol.he3.He3CellWorkflow.__doc__)
Workflow for computing transmission functions for He3 cells.
This can handle polarizers as well as analyzers.
Parameters
----------
in_situ :
Whether to use an in-situ definition of the cell opacity based on cell
parameters, or an ex-situ definition based on direct beam data. The latter
requires a direct-beam measurement with depolarized cells.
incoming_polarized :
Whether the incoming beam for computing the analyzer transmission is polarized.
This is the case in beamlines with a supermirror polarizer, but also if the
polarizer is not removed from the beam during the analyzer transmission
measurement.
Opacity#
There are two ways of computing the opacity, from cell parameters and from direct-beam measurements.
[2]:
workflow = pol.he3.He3CellWorkflow(in_situ=True) # True is the default
workflow.visualize(pol.He3OpacityFunction[pol.Polarizer])
[2]:
[3]:
workflow = pol.he3.He3CellWorkflow(in_situ=False)
workflow.visualize(pol.He3OpacityFunction[pol.Polarizer])
[3]:
Transmission function#
The opacity can be used to obtain the transmission function of the cells. We show the in-situ case, but it works equivalently for the more precise definition of opacity:
[4]:
workflow = pol.he3.He3CellWorkflow()
workflow.visualize(
pol.TransmissionFunction[pol.Polarizer], graph_attr={"rankdir": "LR"}
)
[4]:
There is a variant of the workflow using an incoming polarized beam for computing the transmission function of the analyzer:
[5]:
workflow = pol.he3.He3CellWorkflow(in_situ=False, incoming_polarized=True)
workflow.visualize(
(pol.TransmissionFunction[pol.Polarizer], pol.TransmissionFunction[pol.Analyzer]),
graph_attr={"rankdir": "LR"},
)
[5]:
Supermirror Workflow#
The supermirror
submodule provides a helper SupermirrorWorkflow
:
[6]:
from ess import polarization as pol
workflow = pol.supermirror.SupermirrorWorkflow()
print(workflow.__doc__)
A container for providers that can be assembled into a task graph.
[7]:
workflow.visualize(pol.TransmissionFunction[pol.Polarizer])
[7]:
Full pipeline#
On-the-fly reduction: opacity from cell parameters#
[8]:
he3_workflow = pol.He3CellWorkflow()
workflow = pol.PolarizationAnalysisWorkflow(
analyzer_workflow=he3_workflow, polarizer_workflow=he3_workflow
)
results = (
pol.PolarizationCorrectedData[pol.Up, pol.Up],
pol.PolarizationCorrectedData[pol.Up, pol.Down],
pol.PolarizationCorrectedData[pol.Down, pol.Up],
pol.PolarizationCorrectedData[pol.Down, pol.Down],
)
workflow.visualize(results, graph_attr={"rankdir": "LR"})
[8]:
Precise reduction: opacity from direct-beam measurements of unpolarized cells#
[9]:
he3_workflow = pol.he3.He3CellWorkflow(in_situ=False)
workflow = pol.PolarizationAnalysisWorkflow(
analyzer_workflow=he3_workflow, polarizer_workflow=he3_workflow
)
workflow.visualize(results, graph_attr={"rankdir": "LR"})
[9]:
Correction workflow#
The correction worklow on its own looks as follows:
[10]:
from ess.polarization.correction import CorrectionWorkflow
workflow = CorrectionWorkflow()
workflow.visualize(results, graph_attr={"rankdir": "LR"})
[10]:
There is also a half-polarized version of the workflow, in case only a polarizer is used:
[11]:
from ess.polarization.correction import CorrectionWorkflow
results = (
pol.HalfPolarizedCorrectedData[pol.Up],
pol.HalfPolarizedCorrectedData[pol.Down],
)
workflow = CorrectionWorkflow(half_polarized=True)
workflow.visualize(results, graph_attr={"rankdir": "LR"})
[11]:
Note that in parts of the workflow Up
is used as a dummy value for the spin of the analyzer that is not present.