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