cleaner way to specify default dict entries

This commit is contained in:
Philip Eisenlohr 2022-11-18 10:06:15 -05:00
parent 045f1d39a1
commit 822a098659
1 changed files with 3 additions and 3 deletions

View File

@ -232,9 +232,9 @@ class ConfigMaterial(Config):
_,idx = np.unique(np.hstack(list(kwargs_.values())),return_index=True,axis=0) _,idx = np.unique(np.hstack(list(kwargs_.values())),return_index=True,axis=0)
idx = np.sort(idx) idx = np.sort(idx)
kwargs_ = {k:np.atleast_1d(v[idx].squeeze()) for k,v in kwargs_.items()} kwargs_ = {'phase':'phase_label',
for what in ['phase','homogenization']: 'homogenization': 'homogenization_label'} \
if what not in kwargs_: kwargs_[what]= what+'_label' | {k:np.atleast_1d(v[idx].squeeze()) for k,v in kwargs_.items()}
return ConfigMaterial().material_add(**kwargs_) return ConfigMaterial().material_add(**kwargs_)