Skip to content

Commit

Permalink
Added docs and summary
Browse files Browse the repository at this point in the history
Refs #11325
  • Loading branch information
DanNixon committed Mar 19, 2015
1 parent 02b28ba commit 06ed3a4
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
Expand Up @@ -30,6 +30,10 @@ def category(self):
return "Workflow\\MIDAS;PythonAlgorithms;CorrectionFunctions\\AbsorptionCorrections"


def summary(self):
return "Calculates absorption corrections for a cylindrical or annular sample using Paalman & Pings format."


def PyInit(self):
ws_validator = CompositeValidator([WorkspaceUnitValidator('Wavelength'), InstrumentValidator()])

Expand Down Expand Up @@ -212,6 +216,12 @@ def validateInputs(self):
self._setup()
issues = dict()

# Ensure that a can chemical formula is given when using a can workspace
if self._use_can:
can_chemical_formula = self.getPropertyValue('CanChemicalFormula')
if can_chemical_formula == '':
issues['CanChemicalFormula'] = 'Must provide a chemical foruma when providing a can workspace'

# Ensure there are enough steps
number_steps = int((self._sample_outer_radius - self._sample_inner_radius) / self._step_size)
if number_steps < 20:
Expand Down
@@ -0,0 +1,64 @@
.. algorithm::

.. summary::

.. alias::

.. properties::

Description
-----------

Calculates absorption corrections for a cylindrical or annular sample giving
output in the Paalman & Pings absorption factors: :math:`A_{s,s}` (correction
factor for scattering and absorption 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).

Restrictions on the input workspace
###################################

The input workspace must have a fully defined instrument that has X axis units
of wavelength.

Usage
-----

**Example:**

.. code-block:: python
# Create a sample workspace
sample = CreateSampleWorkspace(NumBanks=1, BankPixelWidth=1,
XUnit='Wavelength',
XMin=6.8, XMax=7.9,
BinWidth=0.1)
# Copy and scale it to make a can workspace
can = CloneWorkspace(InputWorkspace=sample)
can = Scale(InputWorkspace=can, Factor=1.2)
# Calculate absorption corrections
corr = CylinderPaalmanPingsCorrection(SampleWorkspace=sample,
SampleChemicalFormula='H2-O',
SampleInnerRadius=0.05,
SampleOuterRadius=0.1,
CanWorkspace=can,
CanChemicalFormula='V',
CanOuterRadius=0.15,
BeamHeight=0.1,
BeamWidth=0.1,
StepSize=0.002,
Emode='Indirect',
Efixed=1.845)
print 'Correction workspaces: %s' % (', '.join(corr.getNames()))
Output:

.. code-block:: none
Correction workspaces: corr_ass, corr_assc, corr_acsc, corr_acc
.. categories::

0 comments on commit 06ed3a4

Please sign in to comment.