adjusted to python3

translate is more complicated now:
https://stackoverflow.com/questions/41708770
This commit is contained in:
Martin Diehl 2018-11-16 12:23:45 +01:00
parent 3a22e31f1b
commit 9922f5f646
1 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,math
@ -82,11 +82,11 @@ for name in filenames:
'microstructures': 0,
}
newInfo['grid'] = np.array([{True:round(o*float(n.translate(None,'xX'))),
False: round(float(n.translate(None,'xX')))}[n[-1].lower() == 'x']
newInfo['grid'] = np.array([{True: round(o*float(n.lower().replace('x',''))),
False: round(float(n.lower().replace('x','')))}[n[-1].lower() == 'x']
for o,n in zip(info['grid'],options.grid)],'i')
newInfo['size'] = np.array([{True: o*float(n.translate(None,'xX')) ,
False: float(n.translate(None,'xX')) }[n[-1].lower() == 'x']
newInfo['size'] = np.array([{True: o*float(n.lower().replace('x','')),
False: float(n.lower().replace('x',''))}[n[-1].lower() == 'x']
for o,n in zip(info['size'],options.size)],'d')
newInfo['grid'] = np.where(newInfo['grid'] <= 0 , info['grid'],newInfo['grid'])
newInfo['size'] = np.where(newInfo['size'] <= 0.0, info['size'],newInfo['size'])