diff --git a/Code/Mantid/docs/source/algorithms/CompressEvents-v1.rst b/Code/Mantid/docs/source/algorithms/CompressEvents-v1.rst index 181f03cac27b78fca7a40b8dc843d4fa0e8b47db..adfa3d22c916b4b03575739d97b7fdb97b98abbe 100644 --- a/Code/Mantid/docs/source/algorithms/CompressEvents-v1.rst +++ b/Code/Mantid/docs/source/algorithms/CompressEvents-v1.rst @@ -31,4 +31,33 @@ with/without compression are identical. If your workspace has undergone changes to its X values (unit conversion for example), you have to use your best judgement for the Tolerance value. + +Usage +----- + +**Example** + +.. testcode:: CompressEvents + + ws = CreateSampleWorkspace("Event",BankPixelWidth=1) + + print "The unfiltered workspace %s has %i events and a peak value of %.2f" % (ws, ws.getNumberEvents(),ws.readY(0)[50]) + + ws = CompressEvents(ws) + + print "The compressed workspace %s still has %i events and a peak value of %.2f" % (ws, ws.getNumberEvents(),ws.readY(0)[50]) + print "However it now takes up less memory." + + +Output: + +.. testoutput:: CompressEvents + :options: +NORMALIZE_WHITESPACE + + The unfiltered workspace ws has 8000 events and a peak value of 1030.00 + The compressed workspace ws still has 8000 events and a peak value of 1030.00 + However it now takes up less memory. + + + .. categories:: diff --git a/Code/Mantid/docs/source/algorithms/FilterByLogValue-v1.rst b/Code/Mantid/docs/source/algorithms/FilterByLogValue-v1.rst index d05410340f1754c1488e447a1829ce087844b777..b69620d3b009387a55c123c60d55d2f28f46ee5d 100644 --- a/Code/Mantid/docs/source/algorithms/FilterByLogValue-v1.rst +++ b/Code/Mantid/docs/source/algorithms/FilterByLogValue-v1.rst @@ -89,6 +89,7 @@ Usage .. testcode:: Filter ws = CreateSampleWorkspace("Event",BankPixelWidth=1) + AddTimeSeriesLog(ws, Name="proton_charge", Time="2010-01-01T00:00:00", Value=100) AddTimeSeriesLog(ws, Name="proton_charge", Time="2010-01-01T00:10:00", Value=100) AddTimeSeriesLog(ws, Name="proton_charge", Time="2010-01-01T00:20:00", Value=100) @@ -96,12 +97,8 @@ Usage AddTimeSeriesLog(ws, Name="proton_charge", Time="2010-01-01T00:40:00", Value=15) AddTimeSeriesLog(ws, Name="proton_charge", Time="2010-01-01T00:50:00", Value=100) - print "The unfiltered workspace %s has %i events and a peak value of %.2f" % (ws, ws.getNumberEvents(),ws.readY(0)[50]) - wsOut = FilterByLogValue(ws,"proton_charge",MinimumValue=75, MaximumValue=150) - print "The filtered workspace %s has %i events and a peak value of %.2f" % (wsOut, wsOut.getNumberEvents(),wsOut.readY(0)[50]) - Output: diff --git a/Code/Mantid/docs/source/algorithms/ReplaceSpecialValues-v1.rst b/Code/Mantid/docs/source/algorithms/ReplaceSpecialValues-v1.rst index f36a51fd4170acb7b4259f267c6c4696f3d617af..2bd41acc7c4503e4c224ca743b299a2e31bfd954 100644 --- a/Code/Mantid/docs/source/algorithms/ReplaceSpecialValues-v1.rst +++ b/Code/Mantid/docs/source/algorithms/ReplaceSpecialValues-v1.rst @@ -20,4 +20,46 @@ case it would not be checking anything. Algorithm is now event aware. +Usage +----- + +**Example** + +.. testcode:: replaceSV + + import numpy as np + ws = CreateSampleWorkspace(BankPixelWidth=1) + + yArray = np.array(ws.readY(0)) + yArray[0] = 8e80 + yArray[1] = float("inf") + yArray[2] = float("-inf") + yArray[3] = float("NaN") + ws.setY(0,yArray) + + ws = ReplaceSpecialValues(ws,NaNValue=0,InfinityValue=1000, + BigNumberThreshold=1000, BigNumberValue=1000) + + print "i\tBefore\tAfter" + print "-\t------\t-----" + for i in range(4): + print "%i\t%s\t%s" % (i, yArray[i],ws.readY(0)[i]) + + +Output: + +.. testoutput:: replaceSV + :options: +NORMALIZE_WHITESPACE + + +i Before After +- ------ ----- +0 8e+80 1000.0 +1 inf 1000.0 +2 -inf 1000.0 +3 nan 0.0 + + + + .. categories::