From 0f26da0ec1bdae4a66d194181e7e76f16132eebb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 4 Jan 2022 17:25:01 +0100 Subject: [PATCH] nicer reporting --- python/damask/_crystal.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/python/damask/_crystal.py b/python/damask/_crystal.py index 689398cf6..eb8de5923 100644 --- a/python/damask/_crystal.py +++ b/python/damask/_crystal.py @@ -114,12 +114,13 @@ class Crystal(): def __repr__(self): """Represent.""" - return '\n'.join([f'Crystal family {self.family}'] - + ([] if self.lattice is None else [f'Bravais lattice {self.lattice}']+ - list(map(lambda x:f'{x[0]}: {x[1]:.5g}', - zip(['a','b','c','α','β','γ',], - self.parameters)))) - ) + family = f'Crystal family: {self.family}' + return family if self.lattice is None else \ + '\n'.join([family, + f'Bravais lattice: {self.lattice}', + 'a={:.5g}m, b={:.5g}m, c={:.5g}m'.format(*self.parameters[:3]), + 'α={:.5g}°, β={:.5g}°, γ={:.5g}°'.format(*np.degrees(self.parameters[3:]))]) + def __eq__(self,other): """