Skip to content

Commit

Permalink
refs #10693. Remove restrictions
Browse files Browse the repository at this point in the history
I discussed this with Russell Ewings, and we came to the conclusion that any output from this would only cause confusion.
  • Loading branch information
OwenArnold committed Dec 22, 2014
1 parent d80ed4c commit 72d6e14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 44 deletions.
Expand Up @@ -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())
Expand All @@ -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):
Expand Down Expand Up @@ -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
Expand Down
Expand Up @@ -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.
Expand Down

0 comments on commit 72d6e14

Please sign in to comment.