Skip to content
Snippets Groups Projects
Commit 59a57eb0 authored by Dan Nixon's avatar Dan Nixon
Browse files

More refactoring and tests

Refs #11083
parent f91707ad
No related branches found
No related tags found
No related merge requests found
...@@ -61,9 +61,8 @@ class IndirectResolution(DataProcessorAlgorithm): ...@@ -61,9 +61,8 @@ class IndirectResolution(DataProcessorAlgorithm):
def PyExec(self): def PyExec(self):
from IndirectCommon import StartTime, EndTime, getWSprefix from IndirectCommon import getWSprefix
StartTime('IndirectResolution')
self._setup() self._setup()
InelasticIndirectReduction(Instrument=self._instrument, InelasticIndirectReduction(Instrument=self._instrument,
...@@ -92,8 +91,6 @@ class IndirectResolution(DataProcessorAlgorithm): ...@@ -92,8 +91,6 @@ class IndirectResolution(DataProcessorAlgorithm):
self._post_process() self._post_process()
self.setProperty('OutputWorkspace', self._out_ws) self.setProperty('OutputWorkspace', self._out_ws)
EndTime('IndirectResolution')
def _setup(self): def _setup(self):
""" """
......
...@@ -10,7 +10,7 @@ Description ...@@ -10,7 +10,7 @@ Description
----------- -----------
This algorithm Integrates over the range specified, converts the This algorithm Integrates over the range specified, converts the
spectrum axis into units of Q and Q^2 and Transposes the result spectrum axis into units of Q and Q^{2} and transposes the result
workspaces. workspaces.
There are two output workspaces. There are two output workspaces.
...@@ -18,20 +18,42 @@ There are two output workspaces. ...@@ -18,20 +18,42 @@ There are two output workspaces.
Subalgorithms used Subalgorithms used
################## ##################
This algorithm uses the :ref:`algm-Integration`, :ref:`algm-ConvertSpectrumAxis` and :ref:`algm-Transpose` algorithms. This algorithm uses the :ref:`algm-Integration`, :ref:`algm-ConvertSpectrumAxis`
and :ref:`algm-Transpose` algorithms.
Usage Usage
----- -----
.. testcode:: .. testcode:: exElasticWindowSimple
# Prepare a workspace that has all necessary settings to work with ElasticWindow # Prepare a workspace that has all necessary settings to work with ElasticWindow
ws = CreateSampleWorkspace(Function='User Defined',UserDefinedFunction='name=Lorentzian,Amplitude=100,PeakCentre=27500,FWHM=20',XMin=27000,XMax=28000,BinWidth=10,NumBanks=1) ws = CreateSampleWorkspace(Function='User Defined',
ws = ConvertUnits(ws,'DeltaE',EMode='Indirect',EFixed=1.555) UserDefinedFunction='name=Lorentzian,Amplitude=100,PeakCentre=27500,FWHM=20',
ws = Rebin(ws,[-0.2,0.004,0.2]) XMin=27000,
SetInstrumentParameter(ws,'Efixed',DetectorList=range(100,200),ParameterType='Number',Value='1.555') XMax=28000,
BinWidth=10,
NumBanks=1)
ws = ConvertUnits(ws, 'DeltaE',
EMode='Indirect',
EFixed=1.555)
ws = Rebin(ws, [-0.2,0.004,0.2])
SetInstrumentParameter(ws, 'Efixed',
DetectorList=range(100,200),
ParameterType='Number',
Value='1.555')
# Run the algorithm # Run the algorithm
inQ, inQ2 = ElasticWindow(ws, -0.1,0.1) q, q2 = ElasticWindow(ws, -0.1, 0.1)
print q.getAxis(0).getUnit().caption()
print q2.getAxis(0).getUnit().caption()
.. testoutput:: exElasticWindowSimple
q
Q2
.. categories:: .. categories::
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
Description Description
----------- -----------
Creates a resolution workspace for an inelastic indirect sample run. Creates a resolution workspace for an inelastic indirect sample run by
summing all spectra in the energy transfer and subtracting a flat background to
give a single resolution curve.
Rebinning and intensity scaling can optionally be applied to the result.
Usage Usage
----- -----
...@@ -26,12 +30,14 @@ Usage ...@@ -26,12 +30,14 @@ Usage
BackgroundRange=[-0.16, -0.14], BackgroundRange=[-0.16, -0.14],
RebinParam='-0.175,0.002,0.175') RebinParam='-0.175,0.002,0.175')
print mtd.doesExist('resolution') print 'Number of histograms: %d' % resolution.getNumberHistograms()
print 'Number of bins: %d' % resolution.blocksize()
Output: Output:
.. testoutput:: ExIndirectResolutionSimple .. testoutput:: ExIndirectResolutionSimple
True Number of histograms: 1
Number of bins: 175
.. categories:: .. categories::
...@@ -9,10 +9,12 @@ ...@@ -9,10 +9,12 @@
Description Description
----------- -----------
Performs jump fitting on a workspace created by either ConvFit (Indirct Data Analysis) Fits the Q variation of the fitted widths from either ConvFit or Quasi to one
or Quasi (Indirect Bayes). of 4 models:
For more details, see the `Indirect Bayes docs - simple Fick Diffusion
<http://www.mantidproject.org/IndirectBayes:JumpFit>`_. - Chudley-Elliott model
- Hall-Ross model
- Teixeira's model for water
.. categories:: .. categories::
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment