From 59a57eb0cf4cf324c1d62dc44a31661618522b74 Mon Sep 17 00:00:00 2001 From: Dan Nixon <dan@dan-nixon.com> Date: Wed, 18 Mar 2015 16:34:10 +0000 Subject: [PATCH] More refactoring and tests Refs #11083 --- .../WorkflowAlgorithms/IndirectResolution.py | 5 +-- .../source/algorithms/ElasticWindow-v1.rst | 38 +++++++++++++++---- .../algorithms/IndirectResolution-v1.rst | 12 ++++-- .../docs/source/algorithms/JumpFit-v1.rst | 10 +++-- 4 files changed, 46 insertions(+), 19 deletions(-) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectResolution.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectResolution.py index 868ad8f8cd9..1e3ccff2bcb 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectResolution.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectResolution.py @@ -61,9 +61,8 @@ class IndirectResolution(DataProcessorAlgorithm): def PyExec(self): - from IndirectCommon import StartTime, EndTime, getWSprefix + from IndirectCommon import getWSprefix - StartTime('IndirectResolution') self._setup() InelasticIndirectReduction(Instrument=self._instrument, @@ -92,8 +91,6 @@ class IndirectResolution(DataProcessorAlgorithm): self._post_process() self.setProperty('OutputWorkspace', self._out_ws) - EndTime('IndirectResolution') - def _setup(self): """ diff --git a/Code/Mantid/docs/source/algorithms/ElasticWindow-v1.rst b/Code/Mantid/docs/source/algorithms/ElasticWindow-v1.rst index bcda27e46b0..84d9fc230ce 100644 --- a/Code/Mantid/docs/source/algorithms/ElasticWindow-v1.rst +++ b/Code/Mantid/docs/source/algorithms/ElasticWindow-v1.rst @@ -10,7 +10,7 @@ Description ----------- 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. There are two output workspaces. @@ -18,20 +18,42 @@ There are two output workspaces. 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 ----- -.. testcode:: +.. testcode:: exElasticWindowSimple # 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 = 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') + ws = CreateSampleWorkspace(Function='User Defined', + UserDefinedFunction='name=Lorentzian,Amplitude=100,PeakCentre=27500,FWHM=20', + XMin=27000, + 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 - 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:: diff --git a/Code/Mantid/docs/source/algorithms/IndirectResolution-v1.rst b/Code/Mantid/docs/source/algorithms/IndirectResolution-v1.rst index 6bb35679ff6..f43a161e283 100644 --- a/Code/Mantid/docs/source/algorithms/IndirectResolution-v1.rst +++ b/Code/Mantid/docs/source/algorithms/IndirectResolution-v1.rst @@ -9,7 +9,11 @@ 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 ----- @@ -26,12 +30,14 @@ Usage BackgroundRange=[-0.16, -0.14], 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: .. testoutput:: ExIndirectResolutionSimple - True + Number of histograms: 1 + Number of bins: 175 .. categories:: diff --git a/Code/Mantid/docs/source/algorithms/JumpFit-v1.rst b/Code/Mantid/docs/source/algorithms/JumpFit-v1.rst index f89c3992394..bbf684f925f 100644 --- a/Code/Mantid/docs/source/algorithms/JumpFit-v1.rst +++ b/Code/Mantid/docs/source/algorithms/JumpFit-v1.rst @@ -9,10 +9,12 @@ Description ----------- -Performs jump fitting on a workspace created by either ConvFit (Indirct Data Analysis) -or Quasi (Indirect Bayes). +Fits the Q variation of the fitted widths from either ConvFit or Quasi to one +of 4 models: -For more details, see the `Indirect Bayes docs -<http://www.mantidproject.org/IndirectBayes:JumpFit>`_. +- simple Fick Diffusion +- Chudley-Elliott model +- Hall-Ross model +- Teixeira's model for water .. categories:: -- GitLab