From 2a13d78196d2d0db0f6fa46005d6636b426cac0b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 18 Aug 2015 17:24:15 +0000 Subject: [PATCH] did not run --- processing/post/addDeviator.py | 12 ++++++------ processing/post/addEhkl.py | 14 +++++++------- processing/post/addEuclideanDistance.py | 12 ++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/processing/post/addDeviator.py b/processing/post/addDeviator.py index e42add01b..e360bc485 100755 --- a/processing/post/addDeviator.py +++ b/processing/post/addDeviator.py @@ -45,13 +45,14 @@ if options.tensor == None: # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = name+'_tmp', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, buffered = False) + except: + continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ read header ------------------------------------------ @@ -102,4 +103,3 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- table.close() # close input ASCII table (works for stdin) - if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new diff --git a/processing/post/addEhkl.py b/processing/post/addEhkl.py index 294d97e38..e04419ec9 100755 --- a/processing/post/addEhkl.py +++ b/processing/post/addEhkl.py @@ -54,13 +54,14 @@ if options.stiffness == None: # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = name+'_tmp', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, buffered = False) + except: + continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ read header ------------------------------------------ @@ -75,7 +76,7 @@ for name in filenames: if column < 0: remarks.append('column {} not found.'.format(options.stiffness[i])) else: columns.append(column) - table.labels_append(['E{}{}{}({})'.format(*options.hkl,options.stiffness[i])) # extend ASCII header with new labels + table.labels_append(['E{}{}{}({arg2})'.format(*options.hkl,arg2=options.stiffness[i])]) # extend ASCII header with new labels if remarks != []: table.croak(remarks) @@ -94,4 +95,3 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- table.close() # close ASCII tables - if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new diff --git a/processing/post/addEuclideanDistance.py b/processing/post/addEuclideanDistance.py index 60a291754..9d9677cc2 100755 --- a/processing/post/addEuclideanDistance.py +++ b/processing/post/addEuclideanDistance.py @@ -122,13 +122,14 @@ for i,feature in enumerate(features): # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = name+'_tmp', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, buffered = False) + except: + continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ read header ------------------------------------------ @@ -219,4 +220,3 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- table.close() # close input ASCII table (works for stdin) - if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new