diff --git a/Code/Mantid/docs/source/algorithms/AlphaCalc-v1.rst b/Code/Mantid/docs/source/algorithms/AlphaCalc-v1.rst index af96da45815bde2f59645304cb82d54e56bf3717..97f58b43f7059ca7c4dfb4a3fd5df404bbf15a10 100644 --- a/Code/Mantid/docs/source/algorithms/AlphaCalc-v1.rst +++ b/Code/Mantid/docs/source/algorithms/AlphaCalc-v1.rst @@ -19,26 +19,42 @@ in a workspace use :ref:`algm-MuonGroupDetectors`. Usage ----- -.. include:: ../usagedata-note.txt +**Example - Calculating Alpha:** -**Example - Calculating Alpha of a MUSR run:** +.. testcode:: ExSimple -.. testcode:: ExMUSRAlpha + y = [1,1,1,1,1] + [2,2,2,2,2] + x = [1,2,3,4,5,6] * 2 + input = CreateWorkspace(x,y, NSpec=2) - loaded = LoadMuonNexus('MUSR0015189.nxs', AutoGroup=True) + alpha = AlphaCalc(input) - first_period = loaded[0].getItem(0) + print 'Alpha value: {:.3f}'.format(alpha) - alpha = AlphaCalc(first_period, - FirstGoodValue=0.55, - LastGoodValue=12.0) +Output: + +.. testoutput:: ExSimple + + Alpha value: 0.500 + +**Example - Calculating Alpha, reversing forward and backward spectra:** + +.. testcode:: ExReversed + + y = [1,1,1,1,1] + [2,2,2,2,2] + x = [1,2,3,4,5,6] * 2 + input = CreateWorkspace(x,y, NSpec=2) + + alpha = AlphaCalc(input, + ForwardSpectra=[2], + BackwardSpectra=[1]) - print 'Alpha value of the first period: {:.3f}'.format(alpha) + print 'Alpha value: {:.3f}'.format(alpha) Output: -.. testoutput:: ExMUSRAlpha +.. testoutput:: ExReversed - Alpha value of the first period: 1.339 + Alpha value: 2.000 .. categories:: diff --git a/Code/Mantid/docs/source/algorithms/AsymmetryCalc-v1.rst b/Code/Mantid/docs/source/algorithms/AsymmetryCalc-v1.rst index 0479f379d628c5629b97f95ab89a3a9dd7506e8d..035685d2900d30e15964de3a49cb131706d04fa5 100644 --- a/Code/Mantid/docs/source/algorithms/AsymmetryCalc-v1.rst +++ b/Code/Mantid/docs/source/algorithms/AsymmetryCalc-v1.rst @@ -36,33 +36,25 @@ the asymmetry and the asymmetry errors. Usage ----- -.. include:: ../usagedata-note.txt +**Example - Calculating asymmetry:** -**Example - Calculating assymetry for a MUSR run:** +.. testcode:: ExSimple -.. testcode:: ExMUSR + y = [1,2,3] + [3,6,9] + x = [1,2,3,4] * 2 + e = [1,1,1] * 2 + input = CreateWorkspace(x, y, e, NSpec=2) - # Load some arbitrary MUSR run - ws = LoadMuonNexus('MUSR0015189.nxs') + asymmetry = AsymmetryCalc(input, Alpha=0.5) - asymmetry = AsymmetryCalc('ws_1', # Use first period only - ForwardSpectra=range(33,65), - BackwardSpectra=range(1,33), - Alpha=1.0) - - print 'No. of spectra in the resulting workspace:', asymmetry.getNumberHistograms() - - output_format = 'For TOF of {:.3f} asymmetry is {:.3f} with error {:.3f}' - for i in [500, 1000, 1500]: - print output_format.format(asymmetry.readX(0)[i], asymmetry.readY(0)[i], asymmetry.readE(0)[i]) + print 'Asymmetry:', ', '.join('{:.3f}'.format(y) for y in asymmetry.readY(0)) + print 'Errors:', ', '.join('{:.3f}'.format(e) for e in asymmetry.readE(0)) Output: -.. testoutput:: ExMUSR +.. testoutput:: ExSimple - No. of spectra in the resulting workspace: 1 - For TOF of 7.450 asymmetry is -0.045 with error 0.080 - For TOF of 15.450 asymmetry is -0.333 with error 0.609 - For TOF of 23.450 asymmetry is 1.000 with error 1.414 + Asymmetry: -0.200, -0.200, -0.200 + Errors: 0.540, 0.382, 0.312 .. categories:: diff --git a/Code/Mantid/docs/source/algorithms/RemoveExpDecay-v1.rst b/Code/Mantid/docs/source/algorithms/RemoveExpDecay-v1.rst index 05dbb641e3ac5ac9a5aad8c05fe8a011e3aa01d1..81fc66ae2d31d68f2c9adec2f7560b13d0ac8d82 100644 --- a/Code/Mantid/docs/source/algorithms/RemoveExpDecay-v1.rst +++ b/Code/Mantid/docs/source/algorithms/RemoveExpDecay-v1.rst @@ -22,36 +22,22 @@ fitted normalisation constant. Usage ----- -.. include:: ../usagedata-note.txt +**Example - Removing exponential decay:** -**Example - Removing exponential decay from a MUSR run:** +.. testcode:: ExSimple -.. testcode:: ExMUSR + y = [100, 150, 50, 10, 5] + x = [1,2,3,4,5,6] + input = CreateWorkspace(x,y) - # Load first period of a MUSR run - input = LoadMuonNexus('MUSR0015189.nxs', EntryNumber=1) + output = RemoveExpDecay(input) - # Remove uninteresting bins - input = CropWorkspace('input', XMin=0.55, XMax=12) - - # Remove exp. decay - output = RemoveExpDecay('input') - - # Bins to compare - bins_to_compare = [0, 150, 300, 450, 600] - - # Get values before&after and format them as strings for output - init_values = ["{:.3f}".format(input.readY(0)[bin]) for bin in bins_to_compare] - exp_dec_removed = ["{:.3f}".format(output.readY(0)[bin]) for bin in bins_to_compare] - - print "Initial values", ", ".join(init_values) - print "Exp. decay removed:", ", ".join(exp_dec_removed) + print "Exp. decay removed:", ', '.join(['{:.3f}'.format(y) for y in output.readY(0)]) Output: -.. testoutput:: ExMUSR +.. testoutput:: ExSimple - Initial values 49.000, 17.000, 2.000, 3.000, 0.000 - Exp. decay removed: 0.090, 0.127, -0.605, 0.768, -0.824 + Exp. decay removed: -0.243, 0.791, -0.059, -0.703, -0.766 .. categories::