Skip to content

Commit 3ee3ead

Browse files
committed
Merge branch 'fix-as_quat-old-scipy' into 'development'
fix for older SciPy See merge request damask/DAMASK!1105
2 parents 1d14ed0 + 72e3c2b commit 3ee3ead

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

python/damask/_rotation.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import numpy as np
88
import numpy.typing as npt
9+
import scipy
910
from scipy.spatial.transform import Rotation as ScipyRotation
1011

1112
from ._typehints import FloatSequence, IntSequence, NumpyRngSeed
@@ -105,7 +106,11 @@ def __init__(self,
105106
self.quaternion: np.ndarray
106107

107108
if (isinstance(rotation,ScipyRotation)):
108-
self.quaternion = rotation.as_quat(canonical=True,scalar_first=True)
109+
if np.lib.NumpyVersion(scipy.__version__) >= '1.14.0':
110+
self.quaternion = rotation.as_quat(canonical=True,scalar_first=True)
111+
else:
112+
quat = rotation.as_quat(canonical=True)
113+
self.quaternion = np.block([quat[...,3:4],quat[...,0:3]])
109114
elif len(s:=np.asarray(rotation).shape) > 0 and s[-1] == 4:
110115
self.quaternion = np.array(rotation,dtype=float)
111116
else:

0 commit comments

Comments
 (0)