fixing prospector complaints

This commit is contained in:
Martin Diehl 2020-02-21 08:06:58 +01:00
parent 98f5c601a3
commit c1caef4bc9
4 changed files with 8 additions and 8 deletions

View File

@ -829,8 +829,8 @@ class DADF5():
for i,q in enumerate(q['data']): for i,q in enumerate(q['data']):
o = Rotation(np.array([q['w'],q['x'],q['y'],q['z']])) o = Rotation(np.array([q['w'],q['x'],q['y'],q['z']]))
rotatedPole = o*pole # rotate pole according to crystal orientation rotatedPole = o*unit_pole # rotate pole according to crystal orientation
(x,y) = rotatedPole[0:2]/(1.+abs(pole[2])) # stereographic projection (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] coords[i] = [np.sqrt(x*x+y*y),np.arctan2(y,x)] if polar else [x,y]
return { return {
@ -840,7 +840,7 @@ class DADF5():
'Unit': '1', 'Unit': '1',
'Description': '{} coordinates of stereographic projection of pole (direction/plane) in crystal frame'\ 'Description': '{} coordinates of stereographic projection of pole (direction/plane) in crystal frame'\
.format('Polar' if polar else 'Cartesian'), .format('Polar' if polar else 'Cartesian'),
'Creator' : 'dadf5.py:addPole v{}'.format(version) 'Creator' : 'dadf5.py:add_pole v{}'.format(version)
} }
} }
@ -980,7 +980,8 @@ class DADF5():
args['results'].put({**args['func'](**args['in']),'group':args['group']}) args['results'].put({**args['func'](**args['in']),'group':args['group']})
env = Environment() 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) results = Queue(N_threads)
pool = util.ThreadPool(N_threads) pool = util.ThreadPool(N_threads)

View File

@ -299,6 +299,7 @@ def __Mises(x,s):
Symmetric tensor of which the von Mises equivalent is computed. Symmetric tensor of which the von Mises equivalent is computed.
s : float s : float
Scaling factor (2/3 for strain, 3/2 for stress). Scaling factor (2/3 for strain, 3/2 for stress).
""" """
d = deviatoric_part(x) d = deviatoric_part(x)
return np.sqrt(s*(np.sum(d**2.0))) if np.shape(x) == (3,3) else \ return np.sqrt(s*(np.sum(d**2.0))) if np.shape(x) == (3,3) else \

View File

@ -167,11 +167,10 @@ def progressBar(iteration, total, prefix='', bar_length=50):
def scale_to_coprime(v): def scale_to_coprime(v):
"""Scale vector to co-prime (relatively prime) integers.""" """Scale vector to co-prime (relatively prime) integers."""
MAX_DENOMINATOR = 1000 MAX_DENOMINATOR = 1000
def get_square_denominator(x): 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 return Fraction(x ** 2).limit_denominator(MAX_DENOMINATOR).denominator
def lcm(a, b): def lcm(a, b):

View File

@ -217,7 +217,6 @@ class TestMechanics:
A = mechanics.symmetric(np.random.random((self.n,3,3))) A = mechanics.symmetric(np.random.random((self.n,3,3)))
LRHS = np.linalg.det(mechanics.eigenvectors(A,RHS=False)) LRHS = np.linalg.det(mechanics.eigenvectors(A,RHS=False))
RHS = np.linalg.det(mechanics.eigenvectors(A,RHS=True)) RHS = np.linalg.det(mechanics.eigenvectors(A,RHS=True))
s = np.random.randint(self.n)
assert np.allclose(np.abs(LRHS),RHS) assert np.allclose(np.abs(LRHS),RHS)
def test_spherical_no_shear(self): def test_spherical_no_shear(self):