From 72d6e149bcea698be4174a615dffc037cc084fa1 Mon Sep 17 00:00:00 2001 From: Owen Arnold Date: Mon, 22 Dec 2014 14:12:46 +0000 Subject: [PATCH] refs #10693. Remove restrictions I discussed this with Russell Ewings, and we came to the conclusion that any output from this would only cause confusion. --- .../algorithms/WorkflowAlgorithms/CutMD.py | 36 ++----------------- .../test/python/mantid/api/CutMDTest.py | 11 ------ 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CutMD.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CutMD.py index 711364fd8edc..8702a49d8124 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CutMD.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CutMD.py @@ -171,36 +171,7 @@ def replace(self, entry): labels.append( [cmapping.replace(x) for x in projection[i] ] ) return labels - - - def __verify_input_workspace(self, to_cut): - coord_system = to_cut.getSpecialCoordinateSystem() - - ndims = to_cut.getNumDims() - if ndims < 3 or ndims > 4: - raise ValueError("Input Workspace should be 3 or 4 dimensional") - - # Try to sanity check the order of the dimensions. This is important. - axes_check = self.getProperty("CheckAxes").value - - # Coordinate system message - restricted_coordinates_message = "Input Workspace should be in reciprocal lattice dimensions (HKL)" - if axes_check: - - if not coord_system == SpecialCoordinateSystem.HKL: - raise ValueError(restricted_coordinates_message) - - predicates = ["^(H.*)|(\\[H,0,0\\].*)$","^(K.*)|(\\[0,K,0\\].*)$","^(L.*)|(\\[0,0,L\\].*)$"] - n_crystallographic_dims = __builtin__.min(3, ndims) - for i in range(n_crystallographic_dims): - dimension = to_cut.getDimension(i) - p = re.compile(predicates[i]) - if not p.match( dimension.getName() ): - raise ValueError("Dimensions must be in order H, K, L") - else: - if not coord_system == SpecialCoordinateSystem.HKL: - logger.warning(restricted_coordinates_message) - + def __verify_projection_input(self, projection_table): if isinstance(projection_table, ITableWorkspace): column_names = set(projection_table.getColumnNames()) @@ -210,8 +181,7 @@ def __verify_projection_input(self, projection_table): raise ValueError("Projection table schema is wrong! Column names received: " + str(column_names) ) if projection_table.rowCount() != 3: raise ValueError("Projection table expects 3 rows") - - + def __scale_projection(self, (u, v, w), origin_units, target_units, to_cut): if set(origin_units) == set(target_units): @@ -242,7 +212,7 @@ def PyExec(self): logger.warning('You are running algorithm %s that is the beta stage of development' % (self.name())) to_cut = self.getProperty("InputWorkspace").value - self.__verify_input_workspace(to_cut) + ndims = to_cut.getNumDims() nopix = self.getProperty("NoPix").value diff --git a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py index d2d9200c87a5..bca0fc71c674 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py +++ b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py @@ -22,17 +22,6 @@ def setUp(self): def tearDown(self): DeleteWorkspace(self.__in_md ) - def test_exec_throws_if_not_a_hkl_workspace(self): - test_md = CreateMDWorkspace(Dimensions=3, Extents=[-10,10,-10,10,-10,10], Names="A,B,C", Units="U,U,U") - # Explicitly set the coordinate system to lab Q. - SetSpecialCoordinates(InputWorkspace=test_md, SpecialCoordinates='Q (lab frame)') - self.assertRaises(RuntimeError, CutMD, InputWorkspace=test_md, OutputWorkspace="out_ws", P1Bin=[0.1], P2Bin=[0.1], P3Bin=[0.1], CheckAxes=True) - - def test_exec_throws_if_set_to_be_a_hkl_workspace_but_with_missaligned_dimension_names(self): - test_md = CreateMDWorkspace(Dimensions=3, Extents=[-10,10,-10,10,-10,10], Names="K,H,L", Units="U,U,U") # K,H,L are the dimension names - SetSpecialCoordinates(InputWorkspace=test_md, SpecialCoordinates='HKL') - self.assertRaises(RuntimeError, CutMD, InputWorkspace=test_md, OutputWorkspace="out_ws", P1Bin=[0.1], P2Bin=[0.1], P3Bin=[0.1], CheckAxes=True) - def test_exec_throws_if_giving_4th_binning_parameter_when_workspace_is_3D(self): test_md = CreateMDWorkspace(Dimensions=3, Extents=[-10,10,-10,10,-10,10], Names="H,K,L", Units="U,U,U") # Explicitly set the coordinate system to lab Q.