From 21c44479559419089369e113d70f640bb0041336 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 30 Jun 2013 12:35:04 +0000 Subject: [PATCH] polishing and code unifications --- processing/pre/geom_canvas.py | 4 ++-- processing/pre/geom_pack.py | 4 ++-- processing/pre/geom_translate.py | 15 +++++++-------- processing/pre/geom_unpack.py | 4 ++-- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/processing/pre/geom_canvas.py b/processing/pre/geom_canvas.py index fb41ad6fa..d75862a4a 100755 --- a/processing/pre/geom_canvas.py +++ b/processing/pre/geom_canvas.py @@ -87,8 +87,8 @@ for file in files: 'grid': numpy.zeros(3,'i'), 'size': numpy.zeros(3,'d'), 'origin': numpy.zeros(3,'d'), - 'microstructures': 0, 'homogenization': 0, + 'microstructures': 0, } newInfo = { 'grid': numpy.zeros(3,'i'), @@ -195,8 +195,8 @@ for file in files: "grid\ta %i\tb %i\tc %i"%(newInfo['grid'][0],newInfo['grid'][1],newInfo['grid'][2],), "size\tx %f\ty %f\tz %f"%(newInfo['size'][0],newInfo['size'][1],newInfo['size'][2],), "origin\tx %f\ty %f\tz %f"%(newInfo['origin'][0],newInfo['origin'][1],newInfo['origin'][2],), - "microstructures\t%i"%(newInfo['microstructures']), "homogenization\t%i"%info['homogenization'], + "microstructures\t%i"%(newInfo['microstructures']), ]) theTable.head_write() theTable.output_flush() diff --git a/processing/pre/geom_pack.py b/processing/pre/geom_pack.py index 5d7cb9574..852f61bf3 100755 --- a/processing/pre/geom_pack.py +++ b/processing/pre/geom_pack.py @@ -77,8 +77,8 @@ for file in files: 'grid': numpy.zeros(3,'i'), 'size': numpy.zeros(3,'d'), 'origin': numpy.zeros(3,'d'), + 'homogenization': 0, 'microstructures': 0, - 'homogenization': 0 } extra_header = [] @@ -118,8 +118,8 @@ for file in files: "grid\ta %i\tb %i\tc %i"%(info['grid'][0],info['grid'][1],info['grid'][2],), "size\tx %f\ty %f\tz %f"%(info['size'][0],info['size'][1],info['size'][2],), "origin\tx %f\ty %f\tz %f"%(info['origin'][0],info['origin'][1],info['origin'][2],), - "microstructures\t%i"%(info['microstructures']), "homogenization\t%i"%info['homogenization'], + "microstructures\t%i"%(info['microstructures']), ]) theTable.head_write() theTable.output_flush() diff --git a/processing/pre/geom_translate.py b/processing/pre/geom_translate.py index b25921e72..5787c1a69 100755 --- a/processing/pre/geom_translate.py +++ b/processing/pre/geom_translate.py @@ -32,10 +32,11 @@ identifiers = { 'origin': ['x','y','z'], } mappings = { - 'grid': lambda x: int(x), - 'size': lambda x: float(x), - 'origin': lambda x: float(x), - 'homogenization': lambda x: int(x), + 'grid': lambda x: int(x), + 'size': lambda x: float(x), + 'origin': lambda x: float(x), + 'homogenization': lambda x: int(x), + 'microstructures': lambda x: int(x), } parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """ @@ -49,8 +50,6 @@ parser.add_option('-m', '--microstructure', dest='microstructure', type='int', \ help='offset from old to new microstructure indices', metavar='') parser.add_option('-s', '--substitute', action='extend', dest='substitute', type='string', \ help='substitutions of microstructure indices from,to,from,to,...', metavar='') -parser.add_option('-2', '--twodimensional', dest='twoD', action='store_true', \ - help='output geom file with two-dimensional data arrangement') parser.set_defaults(origin = [0.0,0.0,0.0]) parser.set_defaults(microstructure = 0) @@ -92,8 +91,8 @@ for file in files: 'grid': numpy.zeros(3,'i'), 'size': numpy.zeros(3,'d'), 'origin': numpy.zeros(3,'d'), + 'homogenization': 0, 'microstructures': 0, - 'homogenization': 0 } newInfo = { 'origin': numpy.zeros(3,'d'), @@ -171,8 +170,8 @@ for file in files: "grid\ta %i\tb %i\tc %i"%(info['grid'][0],info['grid'][1],info['grid'][2],), "size\tx %f\ty %f\tz %f"%(info['size'][0],info['size'][1],info['size'][2],), "origin\tx %f\ty %f\tz %f"%(newInfo['origin'][0],newInfo['origin'][1],newInfo['origin'][2],), - "microstructures\t%i"%(newInfo['microstructures']), "homogenization\t%i"%info['homogenization'], + "microstructures\t%i"%(newInfo['microstructures']), ]) theTable.head_write() theTable.output_flush() diff --git a/processing/pre/geom_unpack.py b/processing/pre/geom_unpack.py index 1c1a5f12e..d2198f705 100755 --- a/processing/pre/geom_unpack.py +++ b/processing/pre/geom_unpack.py @@ -82,8 +82,8 @@ for file in files: 'grid': numpy.zeros(3,'i'), 'size': numpy.zeros(3,'d'), 'origin': numpy.zeros(3,'d'), + 'homogenization': 0, 'microstructures': 0, - 'homogenization': 0 } extra_header = [] @@ -139,8 +139,8 @@ for file in files: "grid\ta %i\tb %i\tc %i"%(info['grid'][0],info['grid'][1],info['grid'][2],), "size\tx %f\ty %f\tz %f"%(info['size'][0],info['size'][1],info['size'][2],), "origin\tx %f\ty %f\tz %f"%(info['origin'][0],info['origin'][1],info['origin'][2],), - "microstructures\t%i"%(info['microstructures']), "homogenization\t%i"%info['homogenization'], + "microstructures\t%i"%(info['microstructures']), ]) theTable.head_write() theTable.output_flush()