Table of Contents
Calculates attenuation due to absorption and scattering in a sample & its environment using a weighted Monte Carlo.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | The name of the input workspace. The input workspace must have X units of wavelength. |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | The name to use for the output workspace. |
NumberOfWavelengthPoints | Input | number | Optional | The number of wavelength points for which a simulation is atttempted (default: all points) |
EventsPerPoint | Input | number | 300 | The number of “neutron” events to generate per simulated point |
SeedValue | Input | number | 123456789 | Seed the random number generator with this value |
This algorithm performs a Monte Carlo simulation to calculate the attenuation factor of a given sample for an arbitrary arrangement of sample + container shapes. The algorithm proceeds as follows for each spectra in turn:
The input workspace must have units of wavelength. The instrument associated with the workspace must be fully defined because detector, source & sample position are needed.
At a minimum, the input workspace must have a sample shape defined.
Example: A simple spherical sample
#setup the sample shape
sphere = '''<sphere id="sample-sphere">
<centre x="0" y="0" z="0"/>
<radius val="0.1" />
</sphere>'''
ws = CreateSampleWorkspace("Histogram",NumBanks=1)
ws = ConvertUnits(ws,"Wavelength")
CreateSampleShape(ws,sphere)
SetSampleMaterial(ws,ChemicalFormula="V")
#Note: this is a quick and dirty evaluation, in reality you would need more than 300 events per point
wsOut = MonteCarloAbsorption(ws,EventsPerPoint=300)
print "The created workspace has one entry for each spectra: %i" % ws.getNumberHistograms()
print "Just divide your data by the correction to correct for absorption."
Output:
The created workspace has one entry for each spectra: 100
Just divide your data by the correction to correct for absorption.
Example: A simple spherical sample in a cylindrical container
# The algorithm does allow you to set a complex sample environment
# of different materials and shapes, but some of the required methods
# are not exported to python yet. This will come.
Categories: Algorithms | CorrectionFunctions | AbsorptionCorrections