Skip to content

Commit

Permalink
refs #9581 SofQW2 modified appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Jun 11, 2014
1 parent b6e834c commit 0d412d0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 7 deletions.
12 changes: 8 additions & 4 deletions Code/Mantid/docs/source/algorithms/SofQW-v1.rst
Expand Up @@ -14,17 +14,21 @@ input a workspace where the data's been reduced to be in `units <Unit_Factory>`_
of **energy transfer** against spectrum number (which can be seen as equivalent to
angle, with the angle being taken from the detector(s) to which the
spectrum pertains). For each detector the value of **momentum transfer**
(:math:`Q`) is calculated, and the counts for detectors and appropriate **energy transfer** bin are
added to the appropriate output :math:`(Q ;\Delta E)` bin.
(:math:`Q`) is calculated, and the counts for detectors and each input
**energy transfer** bin are added to the appropriate output :math:`(Q ;\Delta E)` bin.

The (:math:`Q`)-binning algorithm deploys is wrt detectors is the centerpoint binning.
Use :ref:`algm-SofQW2` and :ref:`algm-SofQW3` for more complex binning strategies.

The momentum tramsfer (:math:`Q`-values) obtained for each detector are calculated
for the detector center, so the binning algorithm uses centerpoint binning.
Use :ref:`algm-SofQW2` and :ref:`algm-SofQW3` for more complex and precise (but slower)
binning strategies.

The energy binning will not be changed by this algorithm, so the input
workspace should already have the desired bins (though this axis can be
rebinned afterwards if desired). The EMode and EFixed parameters are
used for the calculation of :math:`Q`.


If the input workspace is a distribution (i.e. **counts/meV** ) then the
output workspace will similarly be divided by the bin width in both
directions (i.e. will contain **counts/meV/(1/Angstrom)** ).
Expand Down
48 changes: 45 additions & 3 deletions Code/Mantid/docs/source/algorithms/SofQW2-v1.rst
Expand Up @@ -9,8 +9,50 @@
Description
-----------

Converts a 2D workspace from units of spectrum number/energy transfer to
the intensity as a function of momentum transfer and energy. The
rebinning is done as a weighted sum of overlapping polygons.
Converts a 2D workspace in `units <Unit_Factory>`__
of spectrum number/**energy transfer** to
the intensity as a function of momentum transfer
:math:`Q` and energy transfer :math:`\Delta E`.

The rebinning is done as a weighted sum of overlapping polygons. See
:ref:`algm-SofQW` for centerpoint binning or :ref:`algm-SofQW3` for
more complex and precise (but slower) binning strategy.

Usage
-----

**Example - simple transformation of inelastic workspace:**

.. testcode:: SofQW2

# create sample inelastic workspace for MARI instrument
ws=CreateSimulationWorkspace(Instrument='MAR',BinParams='-10,1,10')
# convert workspace into MD workspace
ws=SofQW2(InputWorkspace=ws,QAxisBinning='-3,0.1,3',Emode='Direct',EFixed=12)

print "The converted X-Y values are:"
Xrow=ws.readX(59);
Yrow=ws.readY(59);
for i in xrange(0,20):
print '! {0:>6.2f} {1:>6.2f} '.format(Xrow[i],Yrow[i]),
if (i+1)%10 == 0:
print '!\n',
print '! {0:>6.2f} ------- !'.format(Xrow[20]),



.. testcleanup:: SofQW2

DeleteWorkspace(ws)

**Output:**

.. testoutput:: SofQW2

The converted X-Y values are:
! -10.00 12.79 ! -9.00 17.63 ! -8.00 17.86 ! -7.00 18.12 ! -6.00 18.46 ! -5.00 18.69 ! -4.00 19.24 ! -3.00 19.67 ! -2.00 18.49 ! -1.00 12.00 !
! 0.00 17.08 ! 1.00 22.32 ! 2.00 23.26 ! 3.00 24.46 ! 4.00 25.96 ! 5.00 21.96 ! 6.00 25.10 ! 7.00 33.65 ! 8.00 35.54 ! 9.00 43.86 !
! 10.00 ------- !


.. categories::

0 comments on commit 0d412d0

Please sign in to comment.