unified.
the default python description "Return repr(self)." is pretty useless, so better agree on a DAMASK standard
This commit is contained in:
parent
59755c67ce
commit
77e57a268c
|
@ -111,7 +111,7 @@ class Crystal():
|
|||
|
||||
|
||||
def __repr__(self):
|
||||
"""Represent."""
|
||||
"""Give short human-readable summary."""
|
||||
family = f'Crystal family: {self.family}'
|
||||
return family if self.lattice is None else \
|
||||
'\n'.join([family,
|
||||
|
|
|
@ -58,7 +58,7 @@ class Grid:
|
|||
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Basic information on grid definition."""
|
||||
"""Give short human-readable summary."""
|
||||
mat_min = np.nanmin(self.material)
|
||||
mat_max = np.nanmax(self.material)
|
||||
mat_N = self.N_materials
|
||||
|
|
|
@ -120,7 +120,7 @@ class Orientation(Rotation,Crystal):
|
|||
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Represent."""
|
||||
"""Give short human readable summary."""
|
||||
return '\n'.join([Crystal.__repr__(self),
|
||||
Rotation.__repr__(self)])
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ class Result:
|
|||
|
||||
|
||||
def __repr__(self):
|
||||
"""Show summary of file content."""
|
||||
"""Give short human-readable summary."""
|
||||
with h5py.File(self.fname,'r') as f:
|
||||
header = [f'Created by {f.attrs["creator"]}',
|
||||
f' on {f.attrs["created"]}',
|
||||
|
|
|
@ -88,7 +88,7 @@ class Rotation:
|
|||
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Represent rotation as unit quaternion(s)."""
|
||||
"""Give short human readable summary."""
|
||||
return f'Quaternion{" " if self.quaternion.shape == (4,) else "s of shape "+str(self.quaternion.shape[:-1])+chr(10)}'\
|
||||
+ str(self.quaternion)
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class Table:
|
|||
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Brief overview."""
|
||||
"""Give short human-readable summary."""
|
||||
self._relabel('shapes')
|
||||
data_repr = self.data.__repr__()
|
||||
self._relabel('uniform')
|
||||
|
|
|
@ -459,6 +459,7 @@ class VTK:
|
|||
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Give short human-readable summary."""
|
||||
info = []
|
||||
if isinstance(self.vtk_data,vtk.vtkImageData):
|
||||
info.append('vtkImageData')
|
||||
|
|
Loading…
Reference in New Issue