Skip to content

Commit 1275253

Browse files
committed
Merge branch '455-rotation-reporting-not-nice-for-single-rotation' into 'development'
Rotation reporting consistent for scalar and arrays Closes #455 See merge request damask/DAMASK!1022
2 parents 618f99b + 3155dd6 commit 1275253

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

python/damask/_rotation.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def __str__(self) -> str:
9595
Give short, human-readable summary.
9696
9797
"""
98-
return re.sub(r'\[(\+|-| )([^\s]+)\s*(\+|-| )([^\s]+)\s*(\+|-| )([^\s]+)\s*(\+|-| )(.+?)\]',
99-
r'\1\2 \3\4 \5\6 \7\8',self.quaternion.__str__())
98+
return re.sub(r'\[([ +-]*[0-9.eE+-]+)(\s*)([ +-]*[0-9.eE+-]+)(\s*)([ +-]*[0-9.eE+-]+)(\s*)([ +-]*[0-9.eE+-]+)(\s*)\]',
99+
r'\1\2 \3\4\5\6\7\8',self.quaternion.__str__())
100100

101101

102102
def __repr__(self) -> str:
@@ -106,7 +106,7 @@ def __repr__(self) -> str:
106106
Give unambiguous representation.
107107
108108
"""
109-
return re.sub(r'\[(\+|-| )([^,]+,)\s*(\+|-| )([^,]+,)\s*(\+|-| )([^,]+,)\s*(\+|-| )(.+?)\]',
109+
return re.sub(r'\[(\+|-| )*(?=\d)([^,]+,)\s*?(\+|-| )*(?=\d)([^,]+,)\s*?(\+|-| )*(?=\d)([^,]+,)\s*?(\+|-| )*(?=\d)(.+?)\]',
110110
r'(\1\2 \3\4 \5\6 \7\8)',self.quaternion.__repr__())
111111

112112

0 commit comments

Comments
 (0)