From 9fa153916347d1413facbaf2d2de7f510ca0404f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 16 May 2020 11:17:12 +0200 Subject: [PATCH] using new names --- processing/pre/geom_addPrimitive.py | 4 ++-- processing/pre/geom_fromDREAM3D.py | 4 ++-- processing/pre/geom_rotate.py | 8 ++++---- python/damask/_lattice.py | 2 +- python/damask/_orientation.py | 2 +- python/tests/test_Orientation.py | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/processing/pre/geom_addPrimitive.py b/processing/pre/geom_addPrimitive.py index f33ba27b1..c04fcf565 100755 --- a/processing/pre/geom_addPrimitive.py +++ b/processing/pre/geom_addPrimitive.py @@ -84,9 +84,9 @@ if [options.angleaxis,options.quaternion].count(None) == 0: parser.error('more than one rotation specified.') if options.angleaxis is not None: - rotation = damask.Rotation.fromAxisAngle(np.array(options.angleaxis),options.degrees,normalise=True) + rotation = damask.Rotation.from_axis_angle(np.array(options.angleaxis),options.degrees,normalise=True) elif options.quaternion is not None: - rotation = damask.Rotation.fromQuaternion(options.quaternion) + rotation = damask.Rotation.from_quaternion(options.quaternion) else: rotation = damask.Rotation() diff --git a/processing/pre/geom_fromDREAM3D.py b/processing/pre/geom_fromDREAM3D.py index 7d5b1442d..b000aa811 100755 --- a/processing/pre/geom_fromDREAM3D.py +++ b/processing/pre/geom_fromDREAM3D.py @@ -97,7 +97,7 @@ for name in filenames: dataset = os.path.join(group_pointwise,options.quaternion) try: quats = np.reshape(inFile[dataset][...],(np.product(grid),4)) - rot = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in quats] + rot = [damask.Rotation.from_quaternion(q,True,P=+1) for q in quats] except KeyError: errors.append('Pointwise orientation (quaternion) data ({}) not readable'.format(dataset)) @@ -123,7 +123,7 @@ for name in filenames: dataset = os.path.join(group_average,options.quaternion) try: - rot = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in inFile[dataset][...][1:]] # skip first entry (unindexed) + rot = [damask.Rotation.from_quaternion(q,True,P=+1) for q in inFile[dataset][...][1:]] # skip first entry (unindexed) except KeyError: errors.append('Average orientation data ({}) not readable'.format(dataset)) diff --git a/processing/pre/geom_rotate.py b/processing/pre/geom_rotate.py index 977e00b65..7a774200b 100755 --- a/processing/pre/geom_rotate.py +++ b/processing/pre/geom_rotate.py @@ -59,13 +59,13 @@ if [options.rotation,options.eulers,options.matrix,options.quaternion].count(Non parser.error('no rotation specified.') if options.quaternion is not None: - rot = damask.Rotation.fromQuaternion(np.array(options.quaternion)) # we might need P=+1 here, too... + rot = damask.Rotation.from_quaternion(np.array(options.quaternion)) # we might need P=+1 here, too... if options.rotation is not None: - rot = damask.Rotation.fromAxisAngle(np.array(options.rotation),degrees=options.degrees,normalise=True,P=+1) + rot = damask.Rotation.from_axis_angle(np.array(options.rotation),degrees=options.degrees,normalise=True,P=+1) if options.matrix is not None: - rot = damask.Rotation.fromMatrix(np.array(options.Matrix)) + rot = damask.Rotation.from_matrix(np.array(options.Matrix)) if options.eulers is not None: - rot = damask.Rotation.fromEulers(np.array(options.eulers),degrees=options.degrees) + rot = damask.Rotation.from_Eulers(np.array(options.eulers),degrees=options.degrees) eulers = rot.asEulers(degrees=True) diff --git a/python/damask/_lattice.py b/python/damask/_lattice.py index 42aa0e9bd..5c8166508 100644 --- a/python/damask/_lattice.py +++ b/python/damask/_lattice.py @@ -634,6 +634,6 @@ class Lattice: otherDir = miller[otherDir_id]/ np.linalg.norm(miller[otherDir_id]) otherMatrix = np.array([otherDir,np.cross(otherPlane,otherDir),otherPlane]) - r['rotations'].append(Rotation.fromMatrix(np.dot(otherMatrix.T,myMatrix))) + r['rotations'].append(Rotation.from_matrix(np.dot(otherMatrix.T,myMatrix))) return r diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index e6c732007..c145dc42b 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -36,7 +36,7 @@ class Orientation: if isinstance(rotation, Rotation): self.rotation = rotation else: - self.rotation = Rotation.fromQuaternion(rotation) # assume quaternion + self.rotation = Rotation.from_quaternion(rotation) # assume quaternion if self.rotation.quaternion.shape != (4,): raise NotImplementedError('Support for multiple rotations missing') diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 08f060887..bb8810c49 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -14,7 +14,7 @@ n = 1000 @pytest.fixture def default(): """A set of n random rotations.""" - return [Rotation.fromRandom() for r in range(n)] + return [Rotation.from_random() for r in range(n)] @pytest.fixture def reference_dir(reference_dir_base): @@ -36,7 +36,7 @@ class TestOrientation: @pytest.mark.parametrize('lattice',Lattice.lattices) def test_IPF(self,lattice): direction = np.random.random(3)*2.0-1 - for rot in [Rotation.fromRandom() for r in range(n//100)]: + for rot in [Rotation.from_random() for r in range(n//100)]: R = damask.Orientation(rot,lattice) color = R.IPFcolor(direction) for equivalent in R.equivalentOrientations(): @@ -45,7 +45,7 @@ class TestOrientation: @pytest.mark.parametrize('model',['Bain','KS','GT','GT_prime','NW','Pitsch']) @pytest.mark.parametrize('lattice',['fcc','bcc']) def test_relationship_forward_backward(self,model,lattice): - ori = Orientation(Rotation.fromRandom(),lattice) + ori = Orientation(Rotation.from_random(),lattice) for i,r in enumerate(ori.relatedOrientations(model)): ori2 = r.relatedOrientations(model)[i] misorientation = ori.rotation.misorientation(ori2.rotation)