From b128b15abf4f2e5c6a82c172bb851d83692837c5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 16 Nov 2016 12:28:38 +0100 Subject: [PATCH] fixed strange behavior for inSST without given symmetry np.all() on dict (with keys 'proper' and 'improper') always returns 'False', and not, as (most likely) intended 'True' in the case of no symmetry. Removed this comparison and simply setting inSST=False for no symmetry, color will be (0,0,0) in that case --- lib/damask/orientation.py | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 101841ce4..655f5cbba 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -774,26 +774,23 @@ class Symmetry: [-1., 0., 0.], [ 0., 1., 0.] ]), } - else: - basis = {'improper': np.zeros((3,3),dtype=float), - 'proper': np.zeros((3,3),dtype=float), - } + else: # direct exit for unspecified symmetry + if color: + return (True,np.zeros(3,'d')) + else: + return True - if np.all(basis == 0.0): - theComponents = -np.ones(3,'d') + v = np.array(vector,dtype = float) + if proper: # check both improper ... + theComponents = np.dot(basis['improper'],v) inSST = np.all(theComponents >= 0.0) - else: - v = np.array(vector,dtype = float) - if proper: # check both improper ... - theComponents = np.dot(basis['improper'],v) - inSST = np.all(theComponents >= 0.0) - if not inSST: # ... and proper SST - theComponents = np.dot(basis['proper'],v) - inSST = np.all(theComponents >= 0.0) - else: - v[2] = abs(v[2]) # z component projects identical - theComponents = np.dot(basis['improper'],v) # for positive and negative values + if not inSST: # ... and proper SST + theComponents = np.dot(basis['proper'],v) inSST = np.all(theComponents >= 0.0) + else: + v[2] = abs(v[2]) # z component projects identical + theComponents = np.dot(basis['improper'],v) # for positive and negative values + inSST = np.all(theComponents >= 0.0) if color: # have to return color array if inSST: