From c1caef4bc91c299e012f2532026e0ac24113e36b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Feb 2020 08:06:58 +0100 Subject: [PATCH] fixing prospector complaints --- python/damask/dadf5.py | 11 ++++++----- python/damask/mechanics.py | 1 + python/damask/util.py | 3 +-- python/tests/test_mechanics.py | 1 - 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/python/damask/dadf5.py b/python/damask/dadf5.py index 76c87d7df..2d9533537 100644 --- a/python/damask/dadf5.py +++ b/python/damask/dadf5.py @@ -829,8 +829,8 @@ class DADF5(): for i,q in enumerate(q['data']): o = Rotation(np.array([q['w'],q['x'],q['y'],q['z']])) - rotatedPole = o*pole # rotate pole according to crystal orientation - (x,y) = rotatedPole[0:2]/(1.+abs(pole[2])) # stereographic projection + rotatedPole = o*unit_pole # rotate pole according to crystal orientation + (x,y) = rotatedPole[0:2]/(1.+abs(unit_pole[2])) # stereographic projection coords[i] = [np.sqrt(x*x+y*y),np.arctan2(y,x)] if polar else [x,y] return { @@ -839,8 +839,8 @@ class DADF5(): 'meta' : { 'Unit': '1', 'Description': '{} coordinates of stereographic projection of pole (direction/plane) in crystal frame'\ - .format('Polar' if polar else 'Cartesian'), - 'Creator' : 'dadf5.py:addPole v{}'.format(version) + .format('Polar' if polar else 'Cartesian'), + 'Creator' : 'dadf5.py:add_pole v{}'.format(version) } } @@ -980,7 +980,8 @@ class DADF5(): args['results'].put({**args['func'](**args['in']),'group':args['group']}) env = Environment() - N_threads = 1#int(env.options['DAMASK_NUM_THREADS']) + N_threads = int(env.options['DAMASK_NUM_THREADS']) + N_threads //=N_threads # disable for the moment results = Queue(N_threads) pool = util.ThreadPool(N_threads) diff --git a/python/damask/mechanics.py b/python/damask/mechanics.py index 79245e887..9502ebf92 100644 --- a/python/damask/mechanics.py +++ b/python/damask/mechanics.py @@ -299,6 +299,7 @@ def __Mises(x,s): Symmetric tensor of which the von Mises equivalent is computed. s : float Scaling factor (2/3 for strain, 3/2 for stress). + """ d = deviatoric_part(x) return np.sqrt(s*(np.sum(d**2.0))) if np.shape(x) == (3,3) else \ diff --git a/python/damask/util.py b/python/damask/util.py index 3ac59b78b..1cb7b8602 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -167,11 +167,10 @@ def progressBar(iteration, total, prefix='', bar_length=50): def scale_to_coprime(v): """Scale vector to co-prime (relatively prime) integers.""" - MAX_DENOMINATOR = 1000 def get_square_denominator(x): - """returns the denominator of the square of a number.""" + """Denominator of the square of a number.""" return Fraction(x ** 2).limit_denominator(MAX_DENOMINATOR).denominator def lcm(a, b): diff --git a/python/tests/test_mechanics.py b/python/tests/test_mechanics.py index 91e3d2d9e..6b2cc7087 100644 --- a/python/tests/test_mechanics.py +++ b/python/tests/test_mechanics.py @@ -217,7 +217,6 @@ class TestMechanics: A = mechanics.symmetric(np.random.random((self.n,3,3))) LRHS = np.linalg.det(mechanics.eigenvectors(A,RHS=False)) RHS = np.linalg.det(mechanics.eigenvectors(A,RHS=True)) - s = np.random.randint(self.n) assert np.allclose(np.abs(LRHS),RHS) def test_spherical_no_shear(self):