Skip to content

Commit

Permalink
Add doctest for ElasticWindowMultiple Refs #11885
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed Jun 3, 2015
1 parent 6d19154 commit 0c107cc
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions Code/Mantid/docs/source/algorithms/ElasticWindowMultiple-v1.rst
Expand Up @@ -19,4 +19,58 @@ either sample temperature or run number of temperature is not available.
The ELT workspace shows the normalisation of the ELF workspace to run with the
lowest sample temperature.

Usage
-----

.. testcode:: exElasticWindowMultiple

# Create some sample data
widths = [15.0, 17.5, 20.0, 22.5, 25.0, 27.5, 30.0]
for idx, fwhm in enumerate(widths):
ws_name = 'ws_%.1f' % fwhm
function = 'name=Lorentzian,Amplitude=100,PeakCentre=27500,FWHM=%f' % fwhm
CreateSampleWorkspace(Function='User Defined',
UserDefinedFunction=function,
XMin=27000,
XMax=28000,
BinWidth=10,
NumBanks=1,
OutputWorkspace=ws_name)

ConvertUnits(InputWorkspace=ws_name,
OutputWorkspace=ws_name,
Target='DeltaE',
EMode='Indirect',
EFixed=1.555)

Rebin(InputWorkspace=ws_name,
OutputWorkspace=ws_name,
Params=[-0.2,0.004,0.2])

LoadInstrument(Workspace=ws_name,
InstrumentName='IRIS')

SetInstrumentParameter(Workspace=ws_name,
ParameterName='Efixed',
DetectorList=range(1,114),
ParameterType='Number',
Value='1.555')

mtd[ws_name].mutableRun()['run_number'] = idx + 1

input = GroupWorkspaces(InputWorkspaces=['ws_%.1f' % fwhm for fwhm in widths])

# Run the algorithm
q, q2, elf = ElasticWindowMultiple(input, -0.1, 0.1)

print 'ELF X axis: %s' % elf.getAxis(0).getUnit().caption()
print 'ELF spectra count: %d' % elf.getNumberHistograms()
print 'ELF bin count: %d' % elf.blocksize()

.. testoutput:: exElasticWindowMultiple

ELF X axis: Run No
ELF spectra count: 100
ELF bin count: 7

.. categories::

0 comments on commit 0c107cc

Please sign in to comment.