From e1e76cb257efaf5356c1d6c28d87cf05a828028d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Nov 2013 17:37:42 +0000 Subject: [PATCH] fixed bug in OIMang_hex2cub.py, added test for correct number of microstructures (should be equal to header info) --- processing/pre/OIMang_hex2cub.py | 2 +- processing/pre/geom_fromAng.py | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/processing/pre/OIMang_hex2cub.py b/processing/pre/OIMang_hex2cub.py index 2b1f6f146..e56737e85 100755 --- a/processing/pre/OIMang_hex2cub.py +++ b/processing/pre/OIMang_hex2cub.py @@ -48,12 +48,12 @@ addPoints = -1 #--- setup file handles --------------------------------------------------------------------------- files = [] if filenames == []: - if filenames == []: files.append({'name':'STDIN', 'input':sys.stdin, 'output':sys.stdout, 'croak':sys.stderr, }) + else: for name in filenames: if os.path.exists(name): diff --git a/processing/pre/geom_fromAng.py b/processing/pre/geom_fromAng.py index 8ec0e9db4..ea43b5d0a 100755 --- a/processing/pre/geom_fromAng.py +++ b/processing/pre/geom_fromAng.py @@ -106,8 +106,9 @@ for file in files: words = line.split() if words[0] == '#': # process initial comments block if len(words) > 2: - if words[1] == 'HexGrid': - file['croak'].write('The file has HexGrid format. Please first convert to SquareGrid...\n'); break + if words[2].lower() == 'hexgrid': + file['croak'].write('The file has HexGrid format. Please first convert to SquareGrid...\n') + sys.exit() if words[1] == 'XSTEP:': step[0] = float(words[2]) if words[1] == 'YSTEP:': step[1] = float(words[2]) if words[1] == 'NCOLS_ODD:': @@ -115,19 +116,16 @@ for file in files: if words[1] == 'NROWS:': info['grid'][1] = int(words[2]); formatwidth = 1+int(math.log10(info['grid'][0]*info['grid'][1])) else: # finished with comments block - if options.config: # write configuration (line by line) - point += 1 - me = str(point).zfill(formatwidth) - microstructure += ['[Grain%s]\n'%me + \ - 'crystallite\t%i\n'%options.crystallite + \ - '(constituent)\tphase %i\ttexture %s\tfraction 1.0\n'%(options.phase[{True:0,False:1}[float(words[options.column-1])