expanded help texts

This commit is contained in:
Philip Eisenlohr 2021-02-23 18:54:55 -05:00
parent ec2fbdc882
commit 0b08b3d233
1 changed files with 15 additions and 7 deletions

View File

@ -149,7 +149,7 @@ class ConfigMaterial(Config):
@property @property
def is_valid(self): def is_valid(self):
"""Check for valid file layout.""" """Check for valid content."""
ok = True ok = True
if 'phase' in self: if 'phase' in self:
@ -158,8 +158,7 @@ class ConfigMaterial(Config):
try: try:
Orientation(lattice=v['lattice']) Orientation(lattice=v['lattice'])
except KeyError: except KeyError:
s = v['lattice'] print(f"Invalid lattice '{v['lattice']}' in phase '{k}'")
print(f"Invalid lattice: '{s}' in phase '{k}'")
ok = False ok = False
if 'material' in self: if 'material' in self:
@ -167,16 +166,15 @@ class ConfigMaterial(Config):
if 'constituents' in m: if 'constituents' in m:
v = 0.0 v = 0.0
for c in m['constituents']: for c in m['constituents']:
v+= float(c['v']) v += float(c['v'])
if 'O' in c: if 'O' in c:
try: try:
Rotation.from_quaternion(c['O']) Rotation.from_quaternion(c['O'])
except ValueError: except ValueError:
o = c['O'] print(f"Invalid orientation '{c['O']}' in material '{i}'")
print(f"Invalid orientation: '{o}' in material '{i}'")
ok = False ok = False
if not np.isclose(v,1.0): if not np.isclose(v,1.0):
print(f"Invalid total fraction (v) '{v}' in material '{i}'") print(f"Total fraction v = {v} ≠ 1 in material '{i}'")
ok = False ok = False
return ok return ok
@ -195,6 +193,11 @@ class ConfigMaterial(Config):
constituent: list of ints, optional constituent: list of ints, optional
Limit renaming to selected constituents. Limit renaming to selected constituents.
Returns
-------
cfg : damask.ConfigMaterial
Updated material configuration.
""" """
dup = self.copy() dup = self.copy()
for i,m in enumerate(dup['material']): for i,m in enumerate(dup['material']):
@ -219,6 +222,11 @@ class ConfigMaterial(Config):
ID: list of ints, optional ID: list of ints, optional
Limit renaming to selected homogenization IDs. Limit renaming to selected homogenization IDs.
Returns
-------
cfg : damask.ConfigMaterial
Updated material configuration.
""" """
dup = self.copy() dup = self.copy()
for i,m in enumerate(dup['material']): for i,m in enumerate(dup['material']):