From cd86a80c2bcd7e6668fe719f95ddf8e2970408d4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 19 Mar 2013 18:22:14 +0000 Subject: [PATCH] corrected handling of default value and cases where the deformation gradient is not f --- processing/post/addStrainTensors.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/processing/post/addStrainTensors.py b/processing/post/addStrainTensors.py index 1f4793e08..d6502db85 100755 --- a/processing/post/addStrainTensors.py +++ b/processing/post/addStrainTensors.py @@ -57,14 +57,14 @@ parser.add_option('-b','-1','--biot', action='store_true', dest='biot', \ parser.add_option('-g','-2','--green', action='store_true', dest='green', \ help='calculate green strain tensor') parser.add_option('-f','--deformation', dest='defgrad', action='extend', type='string', \ - help='heading(s) of columns containing deformation tensor values %default') + help='heading(s) of columns containing deformation tensor values [f]') parser.set_defaults(right = False) parser.set_defaults(left = False) parser.set_defaults(logarithmic = False) parser.set_defaults(biot = False) parser.set_defaults(green = False) -parser.set_defaults(defgrad = ['f']) +parser.set_defaults(defgrad = []) (options,filenames) = parser.parse_args() @@ -83,9 +83,10 @@ datainfo = { # lis 'label':[]}, } - -if options.defgrad != None: datainfo['defgrad']['label'] += options.defgrad - +if options.defgrad == []: + datainfo['defgrad']['label'] = ['f'] +else: + datainfo['defgrad']['label'] = options.defgrad # ------------------------------------------ setup file handles --------------------------------------- @@ -124,7 +125,8 @@ for file in files: column[datatype][label] = table.labels.index(key) for theStretch in stretches: for theStrain in strains: - table.labels_append(['%i_%s(%s)'%(i+1,theStrain,theStretch) + table.labels_append(['%i_%s(%s)%s'%(i+1,theStrain,theStretch, + {True: label,False: ''}[label!='f']) for i in xrange(datainfo['defgrad']['len'])]) # extend ASCII header with new labels # ------------------------------------------ assemble header ---------------------------------------