documentation was misleading

This commit is contained in:
Martin Diehl 2020-10-28 21:52:51 +01:00
parent 4ff99a7af4
commit 1b2cd6caf6
1 changed files with 4 additions and 6 deletions

View File

@ -229,11 +229,9 @@ class ConfigMaterial(Config):
Parameters Parameters
---------- ----------
constituents : dict constituents : dict
Entries for 'constituents'. The key is the name and the value specifies Entries for 'constituents' as key-value pair.
the label of the data column in the table
**kwargs **kwargs
Keyword arguments where the key is the name and the value specifies Key-value pairs.
the label of the data column in the table
Examples Examples
-------- --------
@ -264,7 +262,7 @@ class ConfigMaterial(Config):
for k,v in kwargs.items(): for k,v in kwargs.items():
if hasattr(v,'__len__') and not isinstance(v,str): if hasattr(v,'__len__') and not isinstance(v,str):
if len(v) != len(c): if len(v) != len(c):
raise ValueError('len mismatch 1') raise ValueError('Cannot add entries of different length')
for i,vv in enumerate(v): for i,vv in enumerate(v):
c[i][k] = [w.item() for w in vv] if isinstance(vv,np.ndarray) else vv.item() c[i][k] = [w.item() for w in vv] if isinstance(vv,np.ndarray) else vv.item()
else: else:
@ -288,7 +286,7 @@ class ConfigMaterial(Config):
for k,v in kwargs.items(): for k,v in kwargs.items():
if hasattr(v,'__len__') and not isinstance(v,str): if hasattr(v,'__len__') and not isinstance(v,str):
if len(v) != N_material: if len(v) != N_material:
raise ValueError('len mismatch 2') raise ValueError('Cannot add entries of different length')
for i,vv in enumerate(np.array(v)): for i,vv in enumerate(np.array(v)):
m[i][0][k] = [w.item() for w in vv] if isinstance(vv,np.ndarray) else vv.item() m[i][0][k] = [w.item() for w in vv] if isinstance(vv,np.ndarray) else vv.item()
else: else: