polishing and code unifications

This commit is contained in:
Philip Eisenlohr 2013-06-30 12:35:04 +00:00
parent 24fc14c2f3
commit 21c4447955
4 changed files with 13 additions and 14 deletions

View File

@ -87,8 +87,8 @@ for file in files:
'grid': numpy.zeros(3,'i'), 'grid': numpy.zeros(3,'i'),
'size': numpy.zeros(3,'d'), 'size': numpy.zeros(3,'d'),
'origin': numpy.zeros(3,'d'), 'origin': numpy.zeros(3,'d'),
'microstructures': 0,
'homogenization': 0, 'homogenization': 0,
'microstructures': 0,
} }
newInfo = { newInfo = {
'grid': numpy.zeros(3,'i'), '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],), "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],), "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],), "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'], "homogenization\t%i"%info['homogenization'],
"microstructures\t%i"%(newInfo['microstructures']),
]) ])
theTable.head_write() theTable.head_write()
theTable.output_flush() theTable.output_flush()

View File

@ -77,8 +77,8 @@ for file in files:
'grid': numpy.zeros(3,'i'), 'grid': numpy.zeros(3,'i'),
'size': numpy.zeros(3,'d'), 'size': numpy.zeros(3,'d'),
'origin': numpy.zeros(3,'d'), 'origin': numpy.zeros(3,'d'),
'homogenization': 0,
'microstructures': 0, 'microstructures': 0,
'homogenization': 0
} }
extra_header = [] 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],), "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],), "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],), "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'], "homogenization\t%i"%info['homogenization'],
"microstructures\t%i"%(info['microstructures']),
]) ])
theTable.head_write() theTable.head_write()
theTable.output_flush() theTable.output_flush()

View File

@ -32,10 +32,11 @@ identifiers = {
'origin': ['x','y','z'], 'origin': ['x','y','z'],
} }
mappings = { mappings = {
'grid': lambda x: int(x), 'grid': lambda x: int(x),
'size': lambda x: float(x), 'size': lambda x: float(x),
'origin': lambda x: float(x), 'origin': lambda x: float(x),
'homogenization': lambda x: int(x), 'homogenization': lambda x: int(x),
'microstructures': lambda x: int(x),
} }
parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """ 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='<int>') help='offset from old to new microstructure indices', metavar='<int>')
parser.add_option('-s', '--substitute', action='extend', dest='substitute', type='string', \ parser.add_option('-s', '--substitute', action='extend', dest='substitute', type='string', \
help='substitutions of microstructure indices from,to,from,to,...', metavar='<list>') help='substitutions of microstructure indices from,to,from,to,...', metavar='<list>')
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(origin = [0.0,0.0,0.0])
parser.set_defaults(microstructure = 0) parser.set_defaults(microstructure = 0)
@ -92,8 +91,8 @@ for file in files:
'grid': numpy.zeros(3,'i'), 'grid': numpy.zeros(3,'i'),
'size': numpy.zeros(3,'d'), 'size': numpy.zeros(3,'d'),
'origin': numpy.zeros(3,'d'), 'origin': numpy.zeros(3,'d'),
'homogenization': 0,
'microstructures': 0, 'microstructures': 0,
'homogenization': 0
} }
newInfo = { newInfo = {
'origin': numpy.zeros(3,'d'), '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],), "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],), "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],), "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'], "homogenization\t%i"%info['homogenization'],
"microstructures\t%i"%(newInfo['microstructures']),
]) ])
theTable.head_write() theTable.head_write()
theTable.output_flush() theTable.output_flush()

View File

@ -82,8 +82,8 @@ for file in files:
'grid': numpy.zeros(3,'i'), 'grid': numpy.zeros(3,'i'),
'size': numpy.zeros(3,'d'), 'size': numpy.zeros(3,'d'),
'origin': numpy.zeros(3,'d'), 'origin': numpy.zeros(3,'d'),
'homogenization': 0,
'microstructures': 0, 'microstructures': 0,
'homogenization': 0
} }
extra_header = [] 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],), "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],), "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],), "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'], "homogenization\t%i"%info['homogenization'],
"microstructures\t%i"%(info['microstructures']),
]) ])
theTable.head_write() theTable.head_write()
theTable.output_flush() theTable.output_flush()