\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
Calculates absorption corrections in Paalman & Pings formalism for a given sample and optionally its environment using a Monte Carlo simulation.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
SampleWorkspace | Input | Workspace | Mandatory | Workspace with the measurement of the sample [in a container]. |
EventsPerPoint | Input | number | 1000 | Number of neutron events |
Interpolation | Input | string | Linear | Type of interpolation. Allowed values: [‘Linear’, ‘CSpline’] |
MaxScatterPtAttempts | Input | number | 5000 | Maximum number of tries made to generate a scattering point |
SparseInstrument | Input | boolean | False | Whether to spatially approximate the instrument for faster calculation. |
NumberOfDetectorRows | Input | number | 3 | Number of detector rows in the detector grid of the sparse instrument. |
NumberOfDetectorColumns | Input | number | 2 | Number of detector columns in the detector grid of the sparse instrument. |
BeamHeight | Input | number | 1 | Height of the beam (cm) |
BeamWidth | Input | number | 1 | Width of the beam (cm) |
Shape | Input | string | FlatPlate | Geometric shape of the sample environment. Allowed values: [‘FlatPlate’, ‘Cylinder’, ‘Annulus’] |
Height | Input | number | 0 | Height of the sample environment (cm) |
SampleWidth | Input | number | 0 | Width of the sample environment (cm) |
SampleThickness | Input | number | 0 | Thickness of the sample environment (cm) |
SampleCenter | Input | number | 0 | Center of the sample environment |
SampleAngle | Input | number | 0 | Angle of the sample environment with respect to the beam (degrees) |
SampleRadius | Input | number | 0 | Radius of the sample environment (cm) |
SampleInnerRadius | Input | number | 0 | Inner radius of the sample environment (cm) |
SampleOuterRadius | Input | number | 0 | Outer radius of the sample environment (cm) |
SampleChemicalFormula | Input | string | Chemical formula for the sample material | |
SampleCoherentXSection | Input | number | 0 | The coherent cross-section for the sample material in barns. To be used instead of Chemical Formula. |
SampleIncoherentXSection | Input | number | 0 | The incoherent cross-section for the sample material in barns. To be used instead of Chemical Formula. |
SampleAttenuationXSection | Input | number | 0 | The absorption cross-section for the sample material in barns. To be used instead of Chemical Formula. |
SampleDensityType | Input | string | Mass Density | Use of Mass density or Number density for the sample. Allowed values: [‘Mass Density’, ‘Number Density’] |
SampleNumberDensityUnit | Input | string | Atoms | Choose which units SampleDensity refers to. Allowed values: [Atoms, Formula Units]. Allowed values: [‘Atoms’, ‘Formula Units’] |
SampleDensity | Input | number | 0 | The value for the sample Mass density (g/cm^3) or Number density (1/Angstrom^3). |
ContainerWorkspace | Input | Workspace | Workspace with the container-only measurement. | |
ContainerFrontThickness | Input | number | 0 | Front thickness of the container environment (cm) |
ContainerBackThickness | Input | number | 0 | Back thickness of the container environment (cm) |
ContainerRadius | Input | number | 0 | Outer radius of the sample environment (cm) |
ContainerInnerRadius | Input | number | 0 | Inner radius of the container environment (cm) |
ContainerOuterRadius | Input | number | 0 | Outer radius of the container environment (cm) |
ContainerChemicalFormula | Input | string | Chemical formula for the container material | |
ContainerCoherentXSection | Input | number | 0 | The coherent cross-section for the can material in barns. To be used instead of Chemical Formula. |
ContainerIncoherentXSection | Input | number | 0 | The incoherent cross-section for the can material in barns. To be used instead of Chemical Formula. |
ContainerAttenuationXSection | Input | number | 0 | The absorption cross-section for the can material in barns. To be used instead of Chemical Formula. |
ContainerDensityType | Input | string | Mass Density | Use of Mass density or Number density for the container. Allowed values: [‘Mass Density’, ‘Number Density’] |
ContainerNumberDensityUnit | Input | string | Atoms | Choose which units ContainerDensity refers to. Allowed values: [Atoms, Formula Units]. Allowed values: [‘Atoms’, ‘Formula Units’] |
ContainerDensity | Input | number | 0 | The value for the container Mass density (g/cm^3) or Number density (1/Angstrom^3). |
CorrectionsWorkspace | Output | WorkspaceGroup | corrections | Name of the workspace group to save correction factors |
This algorithm calculates the attenuation factors in the Paalman Pings formalism using a Monte Carlo simulation.
Three simple shapes are supported: FlatPlate, Cylinder, and Annulus. Each shape is defined by the corresponding set of geometric parameters.
Inelastic, quasielastic and elastic measurements are supported, both for direct and indirect geometry instruments.
Height is a common property for the sample and container regardless the shape.
Below are the required properties for each specific shape:
The sample and container shapes and materials are set by SetSample.
The actual calculations are performed using MonteCarloAbsorption for each individual correction term.
The corrections should be applied by the ApplyPaalmanPingsCorrection, where you can find further documentation on the signification of the correction terms and the method.
Note
When container is specified, it is assumed to be tightly wrapping the sample of corresponding shape; that is, there is no gap between the sample and the container.
Note
All the shape arguments are supposed to be in centimeters.
Note
This algorithm does not support predefined shapes or materials yet.
Example - FlatPlate
sample_ws = CreateSampleWorkspace(Function="Quasielastic",
XUnit="Wavelength",
XMin=-0.5,
XMax=0.5,
BinWidth=0.01)
# Efixed is generally defined as part of the IDF for real data.
# Fake it here
inst_name = sample_ws.getInstrument().getName()
SetInstrumentParameter(sample_ws, ComponentName=inst_name,
ParameterName='Efixed', ParameterType='Number', Value='4.1')
container_ws = CreateSampleWorkspace(Function="Quasielastic",
XUnit="Wavelength",
XMin=-0.5,
XMax=0.5,
BinWidth=0.01)
SetInstrumentParameter(container_ws, ComponentName=inst_name,
ParameterName='Efixed', ParameterType='Number', Value='4.1')
corrections = PaalmanPingsMonteCarloAbsorption(
SampleWorkspace=sample_ws,
Shape='FlatPlate',
BeamHeight=2.0,
BeamWidth=2.0,
Height=2.0,
SampleWidth=2.0,
SampleThickness=0.1,
SampleChemicalFormula='H2-O',
SampleDensity=1.0,
ContainerWorkspace=container_ws,
ContainerFrontThickness=0.02,
ContainerBackThickness=0.02,
ContainerChemicalFormula='V',
ContainerDensity=6.0,
CorrectionsWorkspace='flat_plate_corr'
)
ass_ws = corrections[0]
assc_ws = corrections[1]
acsc_ws = corrections[2]
acc_ws = corrections[3]
print("Y-Unit Label of " + str(ass_ws.getName()) + ": " + str(ass_ws.YUnitLabel()))
print("Y-Unit Label of " + str(assc_ws.getName()) + ": " + str(assc_ws.YUnitLabel()))
print("Y-Unit Label of " + str(acsc_ws.getName()) + ": " + str(acsc_ws.YUnitLabel()))
print("Y-Unit Label of " + str(acc_ws.getName()) + ": " + str(acc_ws.YUnitLabel()))
Y-Unit Label of flat_plate_corr_ass: Attenuation factor
Y-Unit Label of flat_plate_corr_assc: Attenuation factor
Y-Unit Label of flat_plate_corr_acsc: Attenuation factor
Y-Unit Label of flat_plate_corr_acc: Attenuation factor
Example - Cylinder
sample_ws = CreateSampleWorkspace(Function="Quasielastic",
XUnit="Wavelength",
XMin=-0.5,
XMax=0.5,
BinWidth=0.01)
# Efixed is generally defined as part of the IDF for real data.
# Fake it here
inst_name = sample_ws.getInstrument().getName()
SetInstrumentParameter(sample_ws, ComponentName=inst_name,
ParameterName='Efixed', ParameterType='Number', Value='4.1')
container_ws = CreateSampleWorkspace(Function="Quasielastic",
XUnit="Wavelength",
XMin=-0.5,
XMax=0.5,
BinWidth=0.01)
SetInstrumentParameter(container_ws, ComponentName=inst_name,
ParameterName='Efixed', ParameterType='Number', Value='4.1')
corrections = PaalmanPingsMonteCarloAbsorption(
SampleWorkspace=sample_ws,
Shape='Cylinder',
BeamHeight=2.0,
BeamWidth=2.0,
Height=2.0,
SampleRadius=0.2,
SampleChemicalFormula='H2-O',
SampleDensity=1.0,
ContainerWorkspace=container_ws,
ContainerRadius=0.22,
ContainerChemicalFormula='V',
ContainerDensity=6.0,
CorrectionsWorkspace='cylinder_corr'
)
ass_ws = corrections[0]
assc_ws = corrections[1]
acsc_ws = corrections[2]
acc_ws = corrections[3]
print("Y-Unit Label of " + str(ass_ws.getName()) + ": " + str(ass_ws.YUnitLabel()))
print("Y-Unit Label of " + str(assc_ws.getName()) + ": " + str(assc_ws.YUnitLabel()))
print("Y-Unit Label of " + str(acsc_ws.getName()) + ": " + str(acsc_ws.YUnitLabel()))
print("Y-Unit Label of " + str(acc_ws.getName()) + ": " + str(acc_ws.YUnitLabel()))
Y-Unit Label of cylinder_corr_ass: Attenuation factor
Y-Unit Label of cylinder_corr_assc: Attenuation factor
Y-Unit Label of cylinder_corr_acsc: Attenuation factor
Y-Unit Label of cylinder_corr_acc: Attenuation factor
Example - Annulus
sample_ws = CreateSampleWorkspace(Function="Quasielastic",
XUnit="Wavelength",
XMin=-0.5,
XMax=0.5,
BinWidth=0.01)
# Efixed is generally defined as part of the IDF for real data.
# Fake it here
inst_name = sample_ws.getInstrument().getName()
SetInstrumentParameter(sample_ws, ComponentName=inst_name,
ParameterName='Efixed', ParameterType='Number', Value='4.1')
container_ws = CreateSampleWorkspace(Function="Quasielastic",
XUnit="Wavelength",
XMin=-0.5,
XMax=0.5,
BinWidth=0.01)
SetInstrumentParameter(container_ws, ComponentName=inst_name,
ParameterName='Efixed', ParameterType='Number', Value='4.1')
corrections = PaalmanPingsMonteCarloAbsorption(
SampleWorkspace=sample_ws,
Shape='Annulus',
BeamHeight=2.0,
BeamWidth=2.0,
Height=2.0,
SampleInnerRadius=0.2,
SampleOuterRadius=0.4,
SampleChemicalFormula='H2-O',
SampleDensity=1.0,
ContainerWorkspace=container_ws,
ContainerInnerRadius=0.19,
ContainerOuterRadius=0.41,
ContainerChemicalFormula='V',
ContainerDensity=6.0,
CorrectionsWorkspace='annulus_corr'
)
ass_ws = corrections[0]
assc_ws = corrections[1]
acsc_ws = corrections[2]
acc_ws = corrections[3]
print("Y-Unit Label of " + str(ass_ws.getName()) + ": " + str(ass_ws.YUnitLabel()))
print("Y-Unit Label of " + str(assc_ws.getName()) + ": " + str(assc_ws.YUnitLabel()))
print("Y-Unit Label of " + str(acsc_ws.getName()) + ": " + str(acsc_ws.YUnitLabel()))
print("Y-Unit Label of " + str(acc_ws.getName()) + ": " + str(acc_ws.YUnitLabel()))
Y-Unit Label of annulus_corr_ass: Attenuation factor
Y-Unit Label of annulus_corr_assc: Attenuation factor
Y-Unit Label of annulus_corr_acsc: Attenuation factor
Y-Unit Label of annulus_corr_acc: Attenuation factor
Categories: AlgorithmIndex | Workflow\Inelastic | CorrectionFunctions\AbsorptionCorrections | Workflow\MIDAS
Python: PaalmanPingsMonteCarloAbsorption.py (last modified: 2020-11-10)