From cbafad50d0f095804d679dae9449591b6993056b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 6 Aug 2014 13:27:09 +0000 Subject: [PATCH] some more work on the postprocessing scripts, decreased test tolerance because spectral decomposition has rounding errors (depending on machine/python/numpy version) --- processing/post/3Dvisualize.py | 12 ++++++------ processing/post/addCalculation.py | 11 ++++++----- processing/post/addCauchy.py | 10 ++++------ processing/post/addCompatibilityMismatch.py | 12 ++++++------ processing/post/addCurl.py | 9 ++++----- processing/post/addDeformedConfiguration.py | 9 ++++----- processing/post/addDeterminant.py | 7 +++---- processing/post/addDeviator.py | 7 +++---- processing/post/addDivergence.py | 10 ++++------ processing/post/addEhkl.py | 10 ++++------ processing/post/addEuclideanDistance.py | 13 ++++++------- processing/post/addIPFcolor.py | 7 +++---- processing/post/addMapped.py | 7 +++---- processing/post/addMises.py | 7 +++---- processing/post/addNorm.py | 7 +++---- processing/post/addOrientations.py | 10 ++++------ processing/post/addPK2.py | 10 ++++------ processing/post/addSchmidfactors.py | 9 ++++----- processing/post/addSpectralDecomposition.py | 7 +++---- processing/post/addStrainTensors.py | 7 +++---- 20 files changed, 80 insertions(+), 101 deletions(-) diff --git a/processing/post/3Dvisualize.py b/processing/post/3Dvisualize.py index cb291448f..68704199d 100755 --- a/processing/post/3Dvisualize.py +++ b/processing/post/3Dvisualize.py @@ -7,7 +7,7 @@ from optparse import OptionParser from vtk.util import numpy_support import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # ----------------------------- @@ -111,7 +111,7 @@ def vtk_writeASCII_mesh(mesh,data,res,sep): cmds = [\ '# vtk DataFile Version 3.1', - string.replace('powered by %s'%scriptID,'\n','\\n'), + 'powered by %s'%scriptID, 'ASCII', 'DATASET UNSTRUCTURED_GRID', 'POINTS %i double'%N1, @@ -228,7 +228,7 @@ def vtk_writeASCII_points(coordinates,data,res,sep): cmds = [\ '# vtk DataFile Version 3.1', - string.replace('powered by %s'%scriptID,'\n','\\n'), + 'powered by %s'%scriptID, 'ASCII', 'DATASET UNSTRUCTURED_GRID', 'POINTS %i float'%N, @@ -257,10 +257,10 @@ def vtk_writeASCII_points(coordinates,data,res,sep): # ----------------------- MAIN ------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog [options] datafile[s]', description = """ -Produce VTK file from data field. Coordinates are taken from (consecutive) x, y, and z columns. +Produce VTK file from data field. +Coordinates are taken from (consecutive) x, y, and z columns. -""",version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) sepChoices = ['n','t','s'] parser.add_option('-s', '--scalar', dest='scalar', action='extend', type='string', metavar = '', diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index af342b83d..1436cf5ea 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -6,7 +6,7 @@ import numpy as np from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] def unravel(item): @@ -19,11 +19,12 @@ def unravel(item): parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add column(s) with derived values according to user defined arithmetic operation between column(s). -Columns can be specified either by label or index. Use ';' for ',' in functions. Numpy is available as np +Columns can be specified either by label or index. Use ';' for ',' in functions. +Numpy is available as np. Example: distance to IP coordinates -- "math.sqrt( #ip.x#**2 + #ip.y#**2 + round(#ip.z#;3)**2 )" -""", version = string.replace(scriptID,'\n','\\n') -) + +""", version = scriptID) parser.add_option('-l','--label', dest='labels', action='extend', type='string', metavar='', help='(list of) new column labels') @@ -60,7 +61,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) evaluator = {} brokenFormula = {} diff --git a/processing/post/addCauchy.py b/processing/post/addCauchy.py index 1c226e5a0..94c3df0fa 100755 --- a/processing/post/addCauchy.py +++ b/processing/post/addCauchy.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # -------------------------------------------------------------------- @@ -15,11 +15,9 @@ scriptName = scriptID.split()[1] # -------------------------------------------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Add column(s) containing Cauchy stress based on given column(s) of -deformation gradient and first Piola--Kirchhoff stress. +Add column(s) containing Cauchy stress based on given column(s) of deformation gradient and first Piola--Kirchhoff stress. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-f','--defgrad', dest='defgrad', action='store', type='string', metavar='string', help='heading of columns containing deformation gradient [%default]') @@ -56,7 +54,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = defaultdict(list) column = defaultdict(dict) diff --git a/processing/post/addCompatibilityMismatch.py b/processing/post/addCompatibilityMismatch.py index 83386a230..32af2a61a 100755 --- a/processing/post/addCompatibilityMismatch.py +++ b/processing/post/addCompatibilityMismatch.py @@ -6,7 +6,7 @@ import numpy as np from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # -------------------------------------------------------------------- @@ -14,11 +14,11 @@ scriptName = scriptID.split()[1] # -------------------------------------------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog options file[s]', description = """ -Add column containing debug information +Add column containing debug information. Operates on periodic ordered three-dimensional data sets. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) + parser.add_option('--no-shape','-s', dest='noShape', action='store_false', help='do not calcuate shape mismatch [%default]') @@ -54,13 +54,13 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) # --------------- figure out dimension and resolution ---------------------------------------------- try: locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data except ValueError: - file['croak'].write('no coordinate data found...\n'%key) + file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords) continue grid = [{},{},{}] diff --git a/processing/post/addCurl.py b/processing/post/addCurl.py index c7912918e..a27c1a3cf 100755 --- a/processing/post/addCurl.py +++ b/processing/post/addCurl.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # -------------------------------------------------------------------- @@ -19,8 +19,7 @@ Add column(s) containing curl of requested column(s). Operates on periodic ordered three-dimensional data sets. Deals with both vector- and tensor-valued fields. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-c','--coordinates', dest='coords', action='store', type='string', metavar='string', help='column heading for coordinates [%default]') @@ -59,13 +58,13 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],True) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) # --------------- figure out dimension and resolution ---------------------------------------------- try: locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data except ValueError: - file['croak'].write('no coordinate data found...\n'%key) + file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords) continue grid = [{},{},{}] diff --git a/processing/post/addDeformedConfiguration.py b/processing/post/addDeformedConfiguration.py index 0d0523255..cb576bd0e 100755 --- a/processing/post/addDeformedConfiguration.py +++ b/processing/post/addDeformedConfiguration.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # -------------------------------------------------------------------- @@ -18,8 +18,7 @@ parser = OptionParser(option_class=damask.extendableOption, usage='%prog options Add column(s) containing deformed configuration of requested column(s). Operates on periodic ordered three-dimensional data sets. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-c','--coordinates', dest='coords', action='store', type='string', metavar='string', help='column heading for coordinates [%default]') @@ -52,13 +51,13 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) # --------------- figure out dimension and resolution ---------------------------------------------- try: locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data except ValueError: - file['croak'].write('no coordinate data found...\n'%key) + file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords) continue grid = [{},{},{}] diff --git a/processing/post/addDeterminant.py b/processing/post/addDeterminant.py index a6044c174..f14df77c1 100755 --- a/processing/post/addDeterminant.py +++ b/processing/post/addDeterminant.py @@ -6,7 +6,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] def determinant(m): @@ -24,8 +24,7 @@ def determinant(m): parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add column(s) containing determinant of requested tensor column(s). -""", version=string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-t','--tensor', dest='tensor', action='extend', type='string', metavar='', help='heading of columns containing tensor field values') @@ -59,7 +58,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = [] column = defaultdict(dict) diff --git a/processing/post/addDeviator.py b/processing/post/addDeviator.py index b1b027817..212c451d5 100755 --- a/processing/post/addDeviator.py +++ b/processing/post/addDeviator.py @@ -6,7 +6,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] oneThird = 1.0/3.0 @@ -25,8 +25,7 @@ def deviator(m): parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add column(s) containing deviator of requested tensor column(s). -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-t','--tensor', dest='tensor', action='extend', type='string', metavar='', help='heading of columns containing tensor field values') @@ -63,7 +62,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = [] column = defaultdict(dict) diff --git a/processing/post/addDivergence.py b/processing/post/addDivergence.py index b2badb42b..aa479d069 100755 --- a/processing/post/addDivergence.py +++ b/processing/post/addDivergence.py @@ -7,10 +7,9 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] - # -------------------------------------------------------------------- # MAIN # -------------------------------------------------------------------- @@ -20,8 +19,7 @@ Add column(s) containing divergence of requested column(s). Operates on periodic ordered three-dimensional data sets. Deals with both vector- and tensor-valued fields. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) accuracyChoices = ['2','4','6','8'] parser.add_option('--fdm', dest='accuracy', action='extend', type='string', metavar='', @@ -73,13 +71,13 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],True) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) # --------------- figure out dimension and resolution ---------------------------------------------- try: locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data except ValueError: - file['croak'].write('no coordinate data found...\n'%key) + file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords) continue grid = [{},{},{}] diff --git a/processing/post/addEhkl.py b/processing/post/addEhkl.py index edbced28b..4b2818a50 100755 --- a/processing/post/addEhkl.py +++ b/processing/post/addEhkl.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] def normalize(vec): @@ -32,11 +32,9 @@ def E_hkl(stiffness,vec): # stiffness = (c11,c12,c44) # -------------------------------------------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Add column(s) containing directional stiffness -based on given cubic stiffness values C11, C12, and C44 in consecutive columns. +Add column(s) containing directional stiffness based on given cubic stiffness values C11, C12, and C44 in consecutive columns. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-c','--stiffness', dest='vector', action='extend', type='string', metavar='', help='heading of column containing C11 (followed by C12, C44) field values') @@ -75,7 +73,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = [] column = defaultdict(dict) diff --git a/processing/post/addEuclideanDistance.py b/processing/post/addEuclideanDistance.py index f0acde8ff..1b5e79488 100755 --- a/processing/post/addEuclideanDistance.py +++ b/processing/post/addEuclideanDistance.py @@ -7,7 +7,7 @@ from optparse import OptionParser from scipy import ndimage import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] def periodic_3Dpad(array, rimdim=(1,1,1)): @@ -83,11 +83,10 @@ neighborhoods = { } parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Add column(s) containing Euclidean distance to grain structural features: -boundaries, triple lines, and quadruple points. +Add column(s) containing Euclidean distance to grain structural features: boundaries, triple lines, and quadruple points. + +""", version = scriptID) -""", version = string.replace(scriptID,'\n','\\n') -) parser.add_option('-c','--coordinates', dest='coords', action='store', type='string', metavar='string', help='column heading for coordinates [%default]') parser.add_option('-i','--identifier', dest='id', action='store', type='string', metavar = 'string', @@ -126,13 +125,13 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) # --------------- figure out position of labels and coordinates ------------------------------------ try: locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data except ValueError: - file['croak'].write('no coordinate data found...\n'%key) + file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords) continue if options.id not in table.labels: diff --git a/processing/post/addIPFcolor.py b/processing/post/addIPFcolor.py index b5e0008d8..3792c520d 100755 --- a/processing/post/addIPFcolor.py +++ b/processing/post/addIPFcolor.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # -------------------------------------------------------------------- @@ -17,8 +17,7 @@ scriptName = scriptID.split()[1] parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add RGB color value corresponding to TSL-OIM scheme for inverse pole figures. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-p', '--pole', dest='pole', action='store', type='float', nargs=3, metavar='float float float', help = 'lab frame direction for inverse pole figure %default') @@ -86,7 +85,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = defaultdict(list) column = defaultdict(dict) diff --git a/processing/post/addMapped.py b/processing/post/addMapped.py index 7612d13f0..4c1350ad0 100755 --- a/processing/post/addMapped.py +++ b/processing/post/addMapped.py @@ -5,7 +5,7 @@ import os,re,sys,math,string from optparse import OptionParser import damask -scriptID = '$Id: addCauchy.py 3301 2014-07-22 14:21:49Z MPIE\m.diehl $' +scriptID = string.replace('$Id: addCauchy.py 3331 2014-08-04 17:53:41Z MPIE\m.diehl $','\n','\\n') scriptName = scriptID.split()[1] # -------------------------------------------------------------------- @@ -15,8 +15,7 @@ scriptName = scriptID.split()[1] parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add data in column(s) of second ASCIItable selected from row that is given by the value in a mapping column. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-a','--asciitable', dest='asciitable', action='store', type='string', metavar='string', help='mapped ASCIItable') @@ -100,7 +99,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) if options.map not in table.labels: file['croak'].write('column %s not found...\n'%options.map) diff --git a/processing/post/addMises.py b/processing/post/addMises.py index f6b5ca15b..5f3dc475a 100755 --- a/processing/post/addMises.py +++ b/processing/post/addMises.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] def Mises(what,tensor): @@ -27,8 +27,7 @@ def Mises(what,tensor): parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add vonMises equivalent values for symmetric part of requested strains and/or stresses. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-e','--strain', dest='strain', action='extend', type='string', metavar='', help='heading(s) of columns containing strain tensors') @@ -68,7 +67,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = defaultdict(list) column = defaultdict(dict) diff --git a/processing/post/addNorm.py b/processing/post/addNorm.py index b6ff87863..4d11146bc 100755 --- a/processing/post/addNorm.py +++ b/processing/post/addNorm.py @@ -6,7 +6,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # definition of element-wise p-norms for matrices @@ -26,8 +26,7 @@ def normMax(object): # p = infinity parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add column(s) containing norm of requested column(s) being either vectors or tensors. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) normChoices = ['abs','frobenius','max'] parser.add_option('-n','--norm', dest='norm', action='store', type='choice', choices=normChoices, metavar='string', @@ -80,7 +79,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = defaultdict(list) column = defaultdict(dict) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index c1e99f23c..90aa6d8fa 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -6,7 +6,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # -------------------------------------------------------------------- @@ -15,11 +15,9 @@ scriptName = scriptID.split()[1] parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add quaternion and/or Bunge Euler angle representation of crystal lattice orientation. -Orientation is given by quaternion, Euler angles, -rotation matrix, or crystal frame coordinates (i.e. component vectors of rotation matrix). +Orientation is given by quaternion, Euler angles, rotation matrix, or crystal frame coordinates (i.e. component vectors of rotation matrix). -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) outputChoices = ['quaternion','eulers'] parser.add_option('-o', '--output', dest='output', action='extend', type='string', metavar='', @@ -96,7 +94,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = defaultdict(list) column = defaultdict(dict) diff --git a/processing/post/addPK2.py b/processing/post/addPK2.py index 3821af6ab..b37fb2224 100755 --- a/processing/post/addPK2.py +++ b/processing/post/addPK2.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # -------------------------------------------------------------------- @@ -15,11 +15,9 @@ scriptName = scriptID.split()[1] # -------------------------------------------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Add column(s) containing Second Piola--Kirchhoff stress based on given column(s) of -deformation gradient and first Piola--Kirchhoff stress. +Add column(s) containing Second Piola--Kirchhoff stress based on given column(s) of deformation gradient and first Piola--Kirchhoff stress. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-f','--defgrad', dest='defgrad', action='store', type='string', metavar='string', help='heading of columns containing deformation gradient [%default]') @@ -56,7 +54,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = defaultdict(list) column = defaultdict(dict) diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index 1a8f25113..aae9ed4ec 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] slipnormal_temp = [ @@ -246,8 +246,7 @@ def crossproduct(x,y): parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add columns listing Schmid factors (and optional trace vector of selected system) for given Euler angles. -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-l','--lattice', dest='lattice', action='store', type='choice', choices=('fcc','bcc','hex'), metavar='string', @@ -326,7 +325,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = defaultdict(list) column = defaultdict(dict) @@ -345,7 +344,7 @@ for file in files: # ------------------------------------------ assemble header --------------------------------------- - table.labels_append(['(%i)S(%i %i %i)[%i %i %i]'%(i+1, + table.labels_append(['%i_S(%i_%i_%i)[%i_%i_%i]'%(i+1, slipnormal[options.lattice][i][0], slipnormal[options.lattice][i][1], slipnormal[options.lattice][i][2], diff --git a/processing/post/addSpectralDecomposition.py b/processing/post/addSpectralDecomposition.py index 2dbd10431..3feac9a23 100755 --- a/processing/post/addSpectralDecomposition.py +++ b/processing/post/addSpectralDecomposition.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] # -------------------------------------------------------------------- @@ -17,8 +17,7 @@ scriptName = scriptID.split()[1] parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add column(s) containing eigenvalues and eigenvectors of requested tensor column(s). -""", version = string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-t','--tensor', dest='tensor', action='extend', type='string', metavar='', help='heading of columns containing tensor field values') @@ -48,7 +47,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],True) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = [] column = defaultdict(dict) diff --git a/processing/post/addStrainTensors.py b/processing/post/addStrainTensors.py index 1554097fa..65a6ad16b 100755 --- a/processing/post/addStrainTensors.py +++ b/processing/post/addStrainTensors.py @@ -7,7 +7,7 @@ from collections import defaultdict from optparse import OptionParser import damask -scriptID = '$Id$' +scriptID = string.replace('$Id$','\n','\\n') scriptName = scriptID.split()[1] def operator(stretch,strain,eigenvalues): @@ -28,8 +28,7 @@ def operator(stretch,strain,eigenvalues): parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add column(s) containing given strains based on given stretches of requested deformation gradient column(s). -""" + string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) parser.add_option('-u','--right', dest='right', action='store_true', help='material strains based on right Cauchy--Green deformation, i.e., C and U [%default]') @@ -85,7 +84,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table.head_read() # read ASCII header info - table.info_append(string.replace(scriptID,'\n','\\n') + '\t' + ' '.join(sys.argv[1:])) + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) active = [] column = defaultdict(dict)