diff --git a/processing/pre/geom_check.py b/processing/pre/geom_check.py index e246cd9a6..747262189 100755 --- a/processing/pre/geom_check.py +++ b/processing/pre/geom_check.py @@ -5,6 +5,9 @@ import os,sys,string,re,numpy,vtk import damask from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP +scriptID = '$Id$' +scriptName = scriptID.split()[1] + #-------------------------------------------------------------------------------------------------- class extendedOption(Option): #-------------------------------------------------------------------------------------------------- @@ -47,7 +50,7 @@ mappings = { parser = OptionParser(option_class=extendedOption, usage='%prog [geomfile[s]]', description = """ Produce VTK rectilinear mesh of structure data from geom description -""" + string.replace('$Id$','\n','\\n') +""" + string.replace(scriptID,'\n','\\n') ) (options, filenames) = parser.parse_args() @@ -71,7 +74,8 @@ else: #--- loop over input files ------------------------------------------------------------------------ for file in files: - if file['name'] != 'STDIN': file['croak'].write(file['name']+'\n') + if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') + else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n') theTable = damask.ASCIItable(file['input'],file['output'],labels=False) theTable.head_read() @@ -146,7 +150,7 @@ for file in files: outWriter = vtk.vtkRectilinearGridWriter() outWriter.WriteToOutputStringOn() outWriter.SetFileTypeToASCII() - outWriter.SetHeader('# powered by $Id$') + outWriter.SetHeader('# powered by '+scriptID) outWriter.SetInput(grid) outWriter.Write() sys.stdout.write(outWriter.GetOutputString()[0:outWriter.GetOutputStringLength()]) diff --git a/processing/pre/geom_pack.py b/processing/pre/geom_pack.py index b145fa856..ce7a3b97e 100755 --- a/processing/pre/geom_pack.py +++ b/processing/pre/geom_pack.py @@ -5,6 +5,9 @@ import os,sys,string,re,math,numpy import damask from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP +scriptID = '$Id$' +scriptName = scriptID.split()[1] + #-------------------------------------------------------------------------------------------------- class extendedOption(Option): #-------------------------------------------------------------------------------------------------- @@ -46,7 +49,7 @@ mappings = { parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """ compress geometry files with ranges "a to b" and/or multiples "n of x". -""" + string.replace('$Id$','\n','\\n') +""" + string.replace(scriptID,'\n','\\n') ) (options, filenames) = parser.parse_args() @@ -70,7 +73,8 @@ else: #--- loop over input files ------------------------------------------------------------------------ for file in files: - if file['name'] != 'STDIN': file['croak'].write(file['name']+'\n') + if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') + else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n') theTable = damask.ASCIItable(file['input'],file['output'],labels=False) theTable.head_read() @@ -105,7 +109,7 @@ for file in files: 'size x y z: %s\n'%(' x '.join(map(str,info['size']))) + \ 'origin x y z: %s\n'%(' : '.join(map(str,info['origin']))) + \ 'homogenization: %i\n'%info['homogenization'] + \ - 'microstructures: %i\n\n'%info['microstructures']) + 'microstructures: %i\n'%info['microstructures']) if numpy.any(info['grid'] < 1): file['croak'].write('invalid grid a b c.\n') @@ -118,7 +122,7 @@ for file in files: theTable.labels_clear() theTable.info_clear() theTable.info_append(extra_header+[ - "$Id$", + scriptID, "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],), diff --git a/processing/pre/geom_rescale.py b/processing/pre/geom_rescale.py index e73ab26ea..88e6ff65c 100755 --- a/processing/pre/geom_rescale.py +++ b/processing/pre/geom_rescale.py @@ -5,6 +5,9 @@ import os,sys,string,re,math,numpy import damask from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP +scriptID = '$Id$' +scriptName = scriptID.split()[1] + #-------------------------------------------------------------------------------------------------- class extendedOption(Option): #-------------------------------------------------------------------------------------------------- @@ -47,7 +50,7 @@ mappings = { parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """ Scales a geometry description independently in x, y, and z direction in terms of grid and/or size. Either absolute values or relative factors (like "0.25x") can be used. -""" + string.replace('$Id$','\n','\\n') +""" + string.replace(scriptID,'\n','\\n') ) parser.add_option('-g', '--grid', dest='grid', type='string', nargs = 3, \ @@ -79,7 +82,8 @@ else: #--- loop over input files ------------------------------------------------------------------------ for file in files: - if file['name'] != 'STDIN': file['croak'].write(file['name']+'\n') + if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') + else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n') theTable = damask.ASCIItable(file['input'],file['output'],labels=False) theTable.head_read() @@ -187,7 +191,7 @@ for file in files: theTable.labels_clear() theTable.info_clear() theTable.info_append(extra_header+[ - "$Id$", + scriptID, "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"%(info['origin'][0],info['origin'][1],info['origin'][2],), diff --git a/processing/pre/geom_translate.py b/processing/pre/geom_translate.py index c61219b32..901e06a6b 100755 --- a/processing/pre/geom_translate.py +++ b/processing/pre/geom_translate.py @@ -5,6 +5,9 @@ import os,sys,string,re,math,numpy import damask from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP +scriptID = '$Id$' +scriptName = scriptID.split()[1] + #-------------------------------------------------------------------------------------------------- class extendedOption(Option): #-------------------------------------------------------------------------------------------------- @@ -45,7 +48,7 @@ mappings = { parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """ translate microstructure indices (shift or substitute) and/or geometry origin. -""" + string.replace('$Id$','\n','\\n') +""" + string.replace(scriptID,'\n','\\n') ) parser.add_option('-o', '--origin', dest='origin', type='float', nargs = 3, \ @@ -85,7 +88,8 @@ else: #--- loop over input files ------------------------------------------------------------------------ for file in files: - if file['name'] != 'STDIN': file['croak'].write(file['name']+'\n') + if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') + else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n') theTable = damask.ASCIItable(file['input'],file['output'],labels=False) theTable.head_read() @@ -123,7 +127,7 @@ for file in files: 'size x y z: %s\n'%(' x '.join(map(str,info['size']))) + \ 'origin x y z: %s\n'%(' : '.join(map(str,info['origin']))) + \ 'homogenization: %i\n'%info['homogenization'] + \ - 'microstructures: %i\n\n'%info['microstructures']) + 'microstructures: %i\n'%info['microstructures']) if numpy.any(info['grid'] < 1): file['croak'].write('invalid grid a b c.\n') @@ -170,7 +174,7 @@ for file in files: theTable.labels_clear() theTable.info_clear() theTable.info_append(extra_header+[ - "$Id$", + scriptID, "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],), diff --git a/processing/pre/geom_unpack.py b/processing/pre/geom_unpack.py index 738f240b1..f9eae6583 100755 --- a/processing/pre/geom_unpack.py +++ b/processing/pre/geom_unpack.py @@ -5,6 +5,9 @@ import os,sys,string,re,math,numpy import damask from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP +scriptID = '$Id$' +scriptName = scriptID.split()[1] + #-------------------------------------------------------------------------------------------------- class extendedOption(Option): #-------------------------------------------------------------------------------------------------- @@ -46,7 +49,7 @@ mappings = { parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """ Unpack geometry files containing ranges "a to b" and/or "n of x" multiples (exclusively in one line). -""" + string.replace('$Id$','\n','\\n') +""" + string.replace(scriptID,'\n','\\n') ) parser.add_option('-1', '--onedimensional', dest='oneD', action='store_true', \ @@ -75,7 +78,8 @@ else: #--- loop over input files ------------------------------------------------------------------------ for file in files: - if file['name'] != 'STDIN': file['croak'].write(file['name']+'\n') + if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') + else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n') theTable = damask.ASCIItable(file['input'],file['output'],labels=False) theTable.head_read() @@ -110,7 +114,7 @@ for file in files: 'size x y z: %s\n'%(' x '.join(map(str,info['size']))) + \ 'origin x y z: %s\n'%(' : '.join(map(str,info['origin']))) + \ 'homogenization: %i\n'%info['homogenization'] + \ - 'microstructures: %i\n\n'%info['microstructures']) + 'microstructures: %i\n'%info['microstructures']) if numpy.any(info['grid'] < 1): file['croak'].write('invalid grid a b c.\n') @@ -139,7 +143,7 @@ for file in files: theTable.labels_clear() theTable.info_clear() theTable.info_append(extra_header+[ - "$Id$", + scriptID, "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],),