removed aliases 'resolution' and 'dimension' for 'grid' and 'size' because some scripts did not have it anyway and the rename happened quite a while ago

This commit is contained in:
Martin Diehl 2014-12-08 08:48:55 +00:00
parent 1c706214b6
commit f8ce57abc8
15 changed files with 14 additions and 121 deletions

View File

@ -14,10 +14,6 @@ oversampling = 2.
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -37,8 +33,7 @@ Depending on the sign of the dimension parameters, these objects can be boxes, c
""", version = scriptID) """, version = scriptID)
parser.add_option('-o', '--origin', parser.add_option('-c', '--center', dest='center', type='int', nargs = 3, metavar=' '.join(['int']*3),
'-c', '--center', dest='center', type='int', nargs = 3, metavar=' '.join(['int']*3),
help='a,b,c origin of primitive %default') help='a,b,c origin of primitive %default')
parser.add_option('-d', '--dimension', dest='dimension', type='int', nargs = 3, metavar=' '.join(['int']*3), parser.add_option('-d', '--dimension', dest='dimension', type='int', nargs = 3, metavar=' '.join(['int']*3),
help='a,b,c extension of hexahedral box; negative values are diameters') help='a,b,c extension of hexahedral box; negative values are diameters')
@ -115,8 +110,6 @@ for file in files:
for header in table.info: for header in table.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue # skip blank lines if len(headitems) == 0: continue # skip blank lines
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -12,12 +12,6 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# MAIN # MAIN
# -------------------------------------------------------------------- # --------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -44,7 +38,7 @@ parser.add_option('-f', '--fill', dest='fill', type='int', metavar = 'int',
help='(background) canvas grain index. "0" selects maximum microstructure index + 1 [%default]') help='(background) canvas grain index. "0" selects maximum microstructure index + 1 [%default]')
parser.set_defaults(grid = ['0','0','0']) parser.set_defaults(grid = ['0','0','0'])
parser.set_defaults(offset = [0,0,0]) parser.set_defaults(offset = (0,0,0))
parser.set_defaults(fill = 0) parser.set_defaults(fill = 0)
(options, filenames) = parser.parse_args() (options, filenames) = parser.parse_args()
@ -91,8 +85,6 @@ for file in files:
for header in theTable.info: for header in theTable.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue # skip blank lines if len(headitems) == 0: continue # skip blank lines
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -12,10 +12,6 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -77,8 +73,6 @@ for file in files:
for header in theTable.info: for header in theTable.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue if len(headitems) == 0: continue
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -34,10 +34,6 @@ def periodic_3Dpad(array, rimdim=(1,1,1)):
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -169,8 +165,6 @@ for file in files:
for header in table.info: for header in table.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue # skip blank lines if len(headitems) == 0: continue # skip blank lines
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -8,15 +8,11 @@ from scipy import ndimage
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -35,8 +31,8 @@ Smoothens out interface roughness by simulated curvature flow.
This is achieved by the diffusion of each initially sharply bounded grain volume within the periodic domain This is achieved by the diffusion of each initially sharply bounded grain volume within the periodic domain
up to a given distance 'd' voxels. up to a given distance 'd' voxels.
The final geometry is assembled by selecting at each voxel that grain index for which the concentration remains largest. The final geometry is assembled by selecting at each voxel that grain index for which the concentration remains largest.
""" + string.replace(scriptID,'\n','\\n')
) """, version = scriptID)
parser.add_option('-d', '--distance', dest='d', type='int', metavar='int', parser.add_option('-d', '--distance', dest='d', type='int', metavar='int',
help='diffusion distance in voxels [%default]') help='diffusion distance in voxels [%default]')
@ -97,8 +93,6 @@ for file in files:
for header in theTable.info: for header in theTable.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue if len(headitems) == 0: continue
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):
@ -243,6 +237,6 @@ for file in files:
#--- output finalization -------------------------------------------------------------------------- #--- output finalization --------------------------------------------------------------------------
if file['name'] != 'STDIN': if file['name'] != 'STDIN':
theTable.__IO__['in'].close() theTable.input_close()
theTable.__IO__['out'].close() theTable.output_close()
os.rename(file['name']+'_tmp',file['name']) os.rename(file['name']+'_tmp',file['name'])

View File

@ -12,10 +12,6 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -74,8 +70,6 @@ for file in files:
for header in table.info: for header in table.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue if len(headitems) == 0: continue
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -12,10 +12,6 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -91,8 +87,6 @@ for file in files:
for header in table.info: for header in table.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue if len(headitems) == 0: continue
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -7,16 +7,12 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -76,8 +72,6 @@ for file in files:
for header in theTable.info: for header in theTable.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue if len(headitems) == 0: continue
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -12,10 +12,6 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -34,14 +30,14 @@ translate microstructure indices (shift or substitute) and/or geometry origin.
""", version=scriptID) """, version=scriptID)
parser.add_option('-o', '--origin', dest='origin', type='float', nargs = 3, \ parser.add_option('-o', '--origin', dest='origin', type='float', nargs = 3,
help='offset from old to new origin of grid', metavar='float float float') help='offset from old to new origin of grid', metavar=' '.join(['float']*3))
parser.add_option('-m', '--microstructure', dest='microstructure', type='int', \ 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', \ parser.add_option('-s', '--substitute', action='extend', dest='substitute',
help='substitutions of microstructure indices from,to,from,to,...', metavar='<string LIST>') help='substitutions of microstructure indices from,to,from,to,...', metavar='<string LIST>')
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)
parser.set_defaults(substitute = []) parser.set_defaults(substitute = [])
parser.set_defaults(twoD = False) parser.set_defaults(twoD = False)
@ -93,8 +89,6 @@ for file in files:
for header in theTable.info: for header in theTable.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue if len(headitems) == 0: continue
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -12,10 +12,6 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -70,8 +66,6 @@ for file in files:
for header in table.info: for header in table.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue if len(headitems) == 0: continue
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -10,33 +10,9 @@ import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = os.path.splitext(scriptID.split()[1])[0] scriptName = os.path.splitext(scriptID.split()[1])[0]
#--------------------------------------------------------------------------------------------------
class extendedOption(Option):
#--------------------------------------------------------------------------------------------------
# used for definition of new option parser action 'extend', which enables to take multiple option arguments
# taken from online tutorial http://docs.python.org/library/optparse.html
ACTIONS = Option.ACTIONS + ("extend",)
STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)
def take_action(self, action, dest, opt, value, values, parser):
if action == "extend":
lvalue = value.split(",")
values.ensure_value(dest, []).extend(lvalue)
else:
Option.take_action(self, action, dest, opt, value, values, parser)
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -107,8 +83,6 @@ for file in files:
for header in theTable.info: for header in theTable.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue if len(headitems) == 0: continue
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -6,7 +6,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
def all_same(items,a): def all_same(items,a):
return all(x == a for x in items) return all(x == a for x in items)

View File

@ -12,10 +12,6 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -78,8 +74,6 @@ for file in files:
for header in theTable.info: for header in theTable.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue if len(headitems) == 0: continue
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -12,10 +12,6 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -90,8 +86,6 @@ for file in files:
for header in table.info: for header in table.info:
headitems = map(str.lower,header.split()) headitems = map(str.lower,header.split())
if len(headitems) == 0: continue # skip blank lines if len(headitems) == 0: continue # skip blank lines
for synonym,alternatives in synonyms.iteritems():
if headitems[0] in alternatives: headitems[0] = synonym
if headitems[0] in mappings.keys(): if headitems[0] in mappings.keys():
if headitems[0] in identifiers.keys(): if headitems[0] in identifiers.keys():
for i in xrange(len(identifiers[headitems[0]])): for i in xrange(len(identifiers[headitems[0]])):

View File

@ -10,14 +10,9 @@ import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = os.path.splitext(scriptID.split()[1])[0] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
synonyms = {
'grid': ['resolution'],
'size': ['dimension'],
}
identifiers = { identifiers = {
'grid': ['a','b','c'], 'grid': ['a','b','c'],
'size': ['x','y','z'], 'size': ['x','y','z'],
@ -31,7 +26,6 @@ mappings = {
'microstructures': lambda x: int(x), 'microstructures': lambda x: int(x),
} }
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
Create seed file by taking microstructure indices from given ASCIItable column. Create seed file by taking microstructure indices from given ASCIItable column.
White and black-listing of microstructure indices is possible. White and black-listing of microstructure indices is possible.