made some more functions case insensitive
This commit is contained in:
parent
eac0217b78
commit
7d8934c9f6
|
@ -71,7 +71,10 @@ class Texture(Section):
|
||||||
else:
|
else:
|
||||||
fraction = properties['fraction']
|
fraction = properties['fraction']
|
||||||
|
|
||||||
|
try:
|
||||||
multiKey = theType.lower()
|
multiKey = theType.lower()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
if multiKey == 'gauss':
|
if multiKey == 'gauss':
|
||||||
self.add_multiKey(multiKey,'phi1 %g\tPhi %g\tphi2 %g\tscatter %g\tfraction %g'%(
|
self.add_multiKey(multiKey,'phi1 %g\tPhi %g\tphi2 %g\tscatter %g\tfraction %g'%(
|
||||||
|
@ -226,9 +229,20 @@ class Material():
|
||||||
''' Experimental! Needs expansion to multi-constituent microstructures...'''
|
''' Experimental! Needs expansion to multi-constituent microstructures...'''
|
||||||
|
|
||||||
microstructure = Microstructure()
|
microstructure = Microstructure()
|
||||||
|
components=dict((k.lower(), v) for k,v in components.iteritems()) # make keys lower case (http://stackoverflow.com/questions/764235/dictionary-to-lowercase-in-python)
|
||||||
|
|
||||||
for property in ['phase','texture','fraction','crystallite']:
|
for key in ['phase','texture','fraction','crystallite']:
|
||||||
if type(components[property]) is not list: components[property] = [components[property]]
|
if type(components[key]) is not list:
|
||||||
|
try:
|
||||||
|
components[key] = [components[key].lower()]
|
||||||
|
except AttributeError:
|
||||||
|
components[key] = [components[key]]
|
||||||
|
else:
|
||||||
|
for i, x in enumerate(components[key]):
|
||||||
|
try:
|
||||||
|
components[key][i] = x.lower()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
for (phase,texture,fraction,crystallite) in zip(components['phase'],components['texture'],components['fraction'],components['crystallite']):
|
for (phase,texture,fraction,crystallite) in zip(components['phase'],components['texture'],components['fraction'],components['crystallite']):
|
||||||
microstructure.add_multiKey('constituent','phase %i\ttexture %i\tfraction %g\ncrystallite %i'%(
|
microstructure.add_multiKey('constituent','phase %i\ttexture %i\tfraction %g\ncrystallite %i'%(
|
||||||
|
|
Loading…
Reference in New Issue