From ec0a7cfa5a5cea715b926e8157c94c7caa0084cc Mon Sep 17 00:00:00 2001
From: Owen Arnold <owen.arnold@stfc.ac.uk>
Date: Fri, 6 Jun 2014 09:18:48 +0100
Subject: [PATCH] refs #9576. ConvertToMatrixWorkspace tested

Minor modification to others to separate test output properly and remove
cleanup sections
---
 .../source/algorithms/AddSampleLog-v1.rst     |  4 --
 .../algorithms/BinaryOperateMasks-v1.rst      |  2 +
 .../algorithms/CalculatePeaksHKL-v1.rst       |  2 +
 .../ConvertToMatrixWorkspace-v1.rst           | 39 +++++++++++++++++++
 .../source/algorithms/PeaksInRegion-v1.rst    |  2 +
 .../source/algorithms/PeaksOnSurface-v1.rst   |  2 +
 .../SpecularReflectionCalculateTheta-v1.rst   |  4 --
 .../SpecularReflectionPositionCorrect-v1.rst  |  5 ---
 8 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/Code/Mantid/docs/source/algorithms/AddSampleLog-v1.rst b/Code/Mantid/docs/source/algorithms/AddSampleLog-v1.rst
index 28b4f4b4a07..df37a8c814f 100644
--- a/Code/Mantid/docs/source/algorithms/AddSampleLog-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/AddSampleLog-v1.rst
@@ -47,10 +47,6 @@ Usage
    print log_y.value
    print log_z.value
 
-.. testcleanup:: AddSampleLogExample
-   DeleteWorkspace('demo_ws')
-   DeleteWorkspace('corrected_ws')
-   
 Output:
 
 .. testoutput:: AddSampleLogExample 
diff --git a/Code/Mantid/docs/source/algorithms/BinaryOperateMasks-v1.rst b/Code/Mantid/docs/source/algorithms/BinaryOperateMasks-v1.rst
index 7e0034112e2..b87ce6f3db2 100644
--- a/Code/Mantid/docs/source/algorithms/BinaryOperateMasks-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/BinaryOperateMasks-v1.rst
@@ -52,6 +52,8 @@ Usage
    print _or.readY(0)
    print _xor.readY(0)
    
+Output:
+
 .. testoutput::  BinaryOperateMasksExample
 
    [ 2.]
diff --git a/Code/Mantid/docs/source/algorithms/CalculatePeaksHKL-v1.rst b/Code/Mantid/docs/source/algorithms/CalculatePeaksHKL-v1.rst
index 5f5a1a4ccaf..93d75b150b9 100644
--- a/Code/Mantid/docs/source/algorithms/CalculatePeaksHKL-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/CalculatePeaksHKL-v1.rst
@@ -38,6 +38,8 @@ Usage
 
   print "Number of Indexed Peaks: ", indexed
 
+Output:
+
 .. testoutput:: CalculatePeaksHKLExample
 
   Number of Indexed Peaks:  1
diff --git a/Code/Mantid/docs/source/algorithms/ConvertToMatrixWorkspace-v1.rst b/Code/Mantid/docs/source/algorithms/ConvertToMatrixWorkspace-v1.rst
index 230fe47e33a..dce0b974bcb 100644
--- a/Code/Mantid/docs/source/algorithms/ConvertToMatrixWorkspace-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/ConvertToMatrixWorkspace-v1.rst
@@ -12,4 +12,43 @@ Description
 This can also be performed using the :ref:`algm-Rebin` algorithm and
 having the "PreserveEvents" parameter set to false.
 
+Usage
+-----
+
+**Example - Simple conversion of an EventWorkspace**
+
+.. testcode:: ConvertToMatrixWorkspaceSimpleExample
+
+   event_ws = Load('CNCS_7860_event.nxs')
+   # Run the conversion algorithm
+   histo_ws = ConvertToMatrixWorkspace(event_ws)
+   # Check that the original workspace and the converted workspace have the same shape
+   print event_ws.getNumberHistograms(), event_ws.blocksize()
+   print histo_ws.getNumberHistograms(), histo_ws.blocksize()
+
+.. testoutput:: ConvertToMatrixWorkspaceSimpleExample
+
+   51200 1
+   51200 1
+
+**Example - Conversion when blocksize > 1**
+
+.. testcode:: ConvertToMatrixWorkspaceComplexExample
+
+   event_ws = Load('CNCS_7860_event.nxs')
+   # Rebin the loaded EventWorkspace to a new EventWorkspace that has > 1 bins
+   event_ws_rebinned = Rebin(InputWorkspace=event_ws, Params=1e3, PreserveEvents=True)
+   # Run the conversion algorithm
+   histo_ws_rebinned = ConvertToMatrixWorkspace(event_ws_rebinned)
+   # Check that the original workspace and the converted workspace have the same shape
+   print event_ws_rebinned.getNumberHistograms(), event_ws_rebinned.blocksize()
+   print histo_ws_rebinned.getNumberHistograms(), histo_ws_rebinned.blocksize()
+
+Output:
+
+.. testoutput:: ConvertToMatrixWorkspaceComplexExample    
+  
+   51200 17
+   51200 17
+
 .. categories::
diff --git a/Code/Mantid/docs/source/algorithms/PeaksInRegion-v1.rst b/Code/Mantid/docs/source/algorithms/PeaksInRegion-v1.rst
index 1b921fb2f76..7aaef432228 100644
--- a/Code/Mantid/docs/source/algorithms/PeaksInRegion-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/PeaksInRegion-v1.rst
@@ -36,6 +36,8 @@ Usage
    just_intesecting_box_table = PeaksInRegion(peaks, CoordinateFrame='HKL', PeakRadius=1.00, Extents=[1.0,2.0,-1.0,1.0,-1.0,1.0], CheckPeakExtents=True)
    print just_intesecting_box_table.row(0)
    
+Output:
+
 .. testoutput:: PeaksInRegionExample
 
    {'Distance': 0.0, 'PeakIndex': 0, 'Intersecting': True}
diff --git a/Code/Mantid/docs/source/algorithms/PeaksOnSurface-v1.rst b/Code/Mantid/docs/source/algorithms/PeaksOnSurface-v1.rst
index 0075e4ae957..7a7f7ababce 100644
--- a/Code/Mantid/docs/source/algorithms/PeaksOnSurface-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/PeaksOnSurface-v1.rst
@@ -40,6 +40,8 @@ Usage
    tbl = PeaksOnSurface(InputWorkspace=peaks, PeakRadius=1.000,  CoordinateFrame='HKL', Vertex1=[1.0, -1.0, out_of_plane_offset], Vertex2=[-1.0,-1.0,out_of_plane_offset], Vertex3=[-1.0, 1.0,out_of_plane_offset], Vertex4=[1.0, 1.0,out_of_plane_offset])
    print tbl.row(0)
    
+Output:
+
 .. testoutput:: PeaksOnSurfaceExample
 
    {'Distance': 0.0, 'PeakIndex': 0, 'Intersecting': True}
diff --git a/Code/Mantid/docs/source/algorithms/SpecularReflectionCalculateTheta-v1.rst b/Code/Mantid/docs/source/algorithms/SpecularReflectionCalculateTheta-v1.rst
index cee85340ab5..4f06bced816 100644
--- a/Code/Mantid/docs/source/algorithms/SpecularReflectionCalculateTheta-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/SpecularReflectionCalculateTheta-v1.rst
@@ -41,10 +41,6 @@ Usage
    # Calculate the two theta.
    two_theta = SpecularReflectionCalculateTheta(InputWorkspace=ws, DetectorComponentName='point-detector', AnalysisMode='PointDetectorAnalysis')
    print two_theta
-
-
-.. testcleanup:: SpecularReflectionCalculateThetaPointDetectorExample
-   DeleteWorkspace('ws')
    
 Output:
 
diff --git a/Code/Mantid/docs/source/algorithms/SpecularReflectionPositionCorrect-v1.rst b/Code/Mantid/docs/source/algorithms/SpecularReflectionPositionCorrect-v1.rst
index 9d13f81edb9..86ac3b2acb4 100644
--- a/Code/Mantid/docs/source/algorithms/SpecularReflectionPositionCorrect-v1.rst
+++ b/Code/Mantid/docs/source/algorithms/SpecularReflectionPositionCorrect-v1.rst
@@ -47,11 +47,6 @@ Usage
    inst = corrected_ws.getInstrument()
    det_pos = inst.getComponentByName('point-detector').getPos()
    print det_pos
-
-
-.. testcleanup:: SpecularReflectionPositionCorrectExample
-   DeleteWorkspace('ws')
-   DeleteWorkspace('corrected_ws')
    
 Output:
 
-- 
GitLab