Skip to content

Commit

Permalink
Merge branch '455-rotation-reporting-not-nice-for-single-rotation' in…
Browse files Browse the repository at this point in the history
…to 'development'

Rotation reporting consistent for scalar and arrays

Closes #455

See merge request damask/DAMASK!1022
  • Loading branch information
MarDiehl committed Jan 20, 2025
2 parents 618f99b + 3155dd6 commit 1275253
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/damask/_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def __str__(self) -> str:
Give short, human-readable summary.
"""
return re.sub(r'\[(\+|-| )([^\s]+)\s*(\+|-| )([^\s]+)\s*(\+|-| )([^\s]+)\s*(\+|-| )(.+?)\]',
r'\1\2 \3\4 \5\6 \7\8',self.quaternion.__str__())
return re.sub(r'\[([ +-]*[0-9.eE+-]+)(\s*)([ +-]*[0-9.eE+-]+)(\s*)([ +-]*[0-9.eE+-]+)(\s*)([ +-]*[0-9.eE+-]+)(\s*)\]',
r'\1\2 \3\4\5\6\7\8',self.quaternion.__str__())


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


Expand Down

0 comments on commit 1275253

Please sign in to comment.