Skip to content

Commit

Permalink
Refs #4333. Missed the equals operation
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Dec 19, 2011
1 parent 1c56ad5 commit 38a4ca9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void export_BinaryOperations()
typedef IMDHistoWorkspace_sptr(*binary_fn_mh_db)(const IMDHistoWorkspace_sptr, double, const std::string&,const std::string &,bool,bool);
typedef WorkspaceGroup_sptr(*binary_fn_gp_db)(const WorkspaceGroup_sptr, double, const std::string&,const std::string &,bool,bool);

// Binary operations helpers
// Binary operations that return a workspace
using boost::python::def;
using Mantid::PythonInterface::performBinaryOp;
using Mantid::PythonInterface::performBinaryOpWithDouble;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/WorkspaceProperty.h"
#include "MantidAPI/WorkspaceOpOverloads.h"

#include "MantidPythonInterface/kernel/PropertyWithValue.h"
#include "MantidPythonInterface/kernel/SingleValueTypeHandler.h"
#include "MantidPythonInterface/api/WorkspaceToNumpy.h"
Expand Down Expand Up @@ -73,6 +75,8 @@ void export_MatrixWorkspace()
"Extracts (copies) the E data from the workspace into a 2D numpy array. "
"Note: This can fail for large workspaces as numpy will require a block "
"of memory free that will fit all of the data.")
//-------------------------------------- Operators --------------------------------------------------------------------------------
.def("equals", &Mantid::API::equals, "Performs a comparison operation on two workspaces, using the CheckWorkspacesMatch algorithm")
;

DECLARE_SINGLEVALUETYPEHANDLER(MatrixWorkspace, DataItem_sptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def test_operators_with_workspaces_in_ADS(self):
A = ads['A']
run_algorithm('CreateWorkspace', OutputWorkspace='B', DataX=[1.,2.,3.], DataY=[2.,3.], DataE=[2.,3.],UnitX='TOF')
B = ads['B']

# Equality
self.assertTrue(A.equals(B, 1e-8))
#
# Two workspaces
C = A + B
Expand Down

0 comments on commit 38a4ca9

Please sign in to comment.