Skip to content

Commit

Permalink
Add documentation for apply correction algorithm
Browse files Browse the repository at this point in the history
Refs #10753
  • Loading branch information
DanNixon committed Mar 23, 2015
1 parent 5742ed3 commit e81a29b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
@@ -0,0 +1 @@
f4b31e993d1747f22074cd17365cf0eb
Expand Up @@ -15,19 +15,62 @@ in sample), :math:`A_{s,sc}` (scattering in sample and absorption in sample and
container), :math:`A_{c,sc}` (scattering in container and absorption in sample
and container) and :math:`A_{c,c}` (scattering and absorption in container).

This algorithm can be used to apply absorption corrections calculated with
either the :ref:`algm-CylinderPaalmanPingsCorrection` and
:ref:`algm-FlatPlatePaalmanPingsCorrection` algorithms as well as the legacy
indirect calculate correcteions routine, providing that the sample and container
are first converted to wavelength and the corrections are interpolated to match
the sample as demonstrated in the example below.

Usage
-----

**Example:**
**Example: using with legacy indirect corrections data**

.. testcode:: exSampleAndCanIRISLegacyCorrections

# Load the sample and can
sample_ws = Load('irs26176_graphite002_red.nxs')
can_ws = Load('irs26173_graphite002_red.nxs')

# Convert sample and container workspaces to wavelength
sample_ws = ConvertUnits(InputWorkspace=sample_ws,
Target='Wavelength',
EMode='Indirect',
EFixed=1.845)
can_ws = ConvertUnits(InputWorkspace=can_ws,
Target='Wavelength',
EMode='Indirect',
EFixed=1.845)

# Load the corrections workspace
corrections_ws = Load('irs26176_graphite002_cyl_Abs.nxs')

# Interpolate each of the correction factor workspaces to match the
# binning of the smaple
# Required to use corrections from the old indirect calculate
# corrections routines
for factor_ws in corrections_ws:
SplineInterpolation(WorkspaceToMatch=sample_ws,
WorkspaceToInterpolate=factor_ws,
OutputWorkspace=factor_ws,
OutputWorkspaceDeriv='')

corr = ApplyPaalmanPingsCorrection(SampleWorkspace=sample_ws,
CorrectionsWorkspace=corrections_ws,
CanWorkspace=can_ws)

.. testcode:: exSampleAndCan
print 'Corrected workspace has %d spectra over %d bins' % (
corr.getNumberHistograms(), corr.blocksize())

TODO
print 'Type of correction applied: %s' % (
corr.getRun()['corrections_type'].value)

Output:

.. testoutput:: exSampleAndCan
.. testoutput:: exSampleAndCanIRISLegacyCorrections

TODO
Corrected workspace has 10 spectra over 1905 bins
Type of correction applied: sample_and_can_corrections

.. categories::

0 comments on commit e81a29b

Please sign in to comment.