From c106149817dff8adbec75d9747e7abe2ccf01f19 Mon Sep 17 00:00:00 2001
From: Roman Tolchenov <roman.tolchenov@stfc.ac.uk>
Date: Thu, 5 Jun 2014 10:22:50 +0100
Subject: [PATCH] Re #9579. Added Usage section to ChangeBinOffset doc

---
 .../source/algorithms/ChangeBinOffset-v1.rst  | 28 +++++++++++++++++++
 .../source/algorithms/SplineBackground-v1.rst |  7 +++++
 2 files changed, 35 insertions(+)

diff --git a/Code/Mantid/docs/source/algorithms/ChangeBinOffset-v1.rst b/Code/Mantid/docs/source/algorithms/ChangeBinOffset-v1.rst
index 5a15eddb156..719de26d666 100644
--- a/Code/Mantid/docs/source/algorithms/ChangeBinOffset-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/ChangeBinOffset-v1.rst
@@ -20,4 +20,32 @@ selectively using the IndexMin and IndexMax properties.
 The output workspace will be an exact copy of the input workspace except
 for the changed time bins.
 
+Usage
+-----
+
+.. testcode:: ExOffset
+
+  import numpy as np
+
+  # Create a workspace
+  ws = CreateSampleWorkspace()
+
+  # Offset the time bins by 1.0
+  wsOffset = ChangeBinOffset(ws,Offset=1.0)
+
+  # Check the offset
+  x1 = ws.readX(0)
+  x2 = wsOffset.readX(0)
+  # Test that all elements of arrays x2 and x1 differ by 1.0
+  print np.all( x2 - x1 == 1.0 )
+  y1 = ws.readY(0)
+  y2 = wsOffset.readY(0)
+  # Test that arrays y2 and y1 are equal
+  print np.all( y2 == y1 )
+
+.. testoutput:: ExOffset
+
+  True
+  True
+
 .. categories::
diff --git a/Code/Mantid/docs/source/algorithms/SplineBackground-v1.rst b/Code/Mantid/docs/source/algorithms/SplineBackground-v1.rst
index 58a1a2cf422..728dbe08189 100644
--- a/Code/Mantid/docs/source/algorithms/SplineBackground-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/SplineBackground-v1.rst
@@ -22,19 +22,26 @@ Usage
   import numpy as np
 
   # Create a workspace with some data
+
+  # Fill array x with 100 float values equally spaced in the interval [-10, 10]
   x = np.linspace(-10,10,100)
+  # Fill array y with values of a function for each number in array x. y has the same length as x
   y = 1.0 / (x**2 + 10)
+  # Create array e of the same length as x and fill it with ones (1.0)
   e = np.ones_like(x)
+  # Uses the above arrays to create a workspace
   ws = CreateWorkspace( x, y, e )
 
   # Run algorithm with low number of spline coefficients
   out = SplineBackground(ws, WorkspaceIndex=0, NCoeff=4)
   yout = out.readY(0)
+  # Sum the squares of the differences of elements of arrays y and yout
   print 'Fit quality is',np.sum( (y - yout)**2 )
 
   # Increase the number of spline coefficients
   out = SplineBackground(ws, WorkspaceIndex=0, NCoeff=20)
   yout = out.readY(0)
+  # Sum the squares of the differences of elements of arrays y and yout
   print 'Fit quality is',np.sum( (y - yout)**2 )
 
 .. testoutput:: ExampleSpline
-- 
GitLab