updated to new ASCII table style

This commit is contained in:
Martin Diehl 2015-08-12 20:59:10 +00:00
parent 9ee49b2c3b
commit 1149053c61
2 changed files with 13 additions and 13 deletions

View File

@ -48,13 +48,14 @@ for i in xrange(len(options.formulas)):
# --- loop over input files ------------------------------------------------------------------------- # --- loop over input files -------------------------------------------------------------------------
if filenames == []: filenames = ['STDIN'] if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
if not (name == 'STDIN' or os.path.exists(name)): continue try:
table = damask.ASCIItable(name = name, outname = name+'_tmp', table = damask.ASCIItable(name = name, buffered = False)
buffered = False) except:
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) continue
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else ''))
# ------------------------------------------ read header ------------------------------------------- # ------------------------------------------ read header -------------------------------------------
@ -119,10 +120,9 @@ for name in filenames:
for label in [x for x in options.labels if x not in set(brokenFormula)]: for label in [x for x in options.labels if x not in set(brokenFormula)]:
table.data_append(unravel(eval(evaluator[label]))) table.data_append(unravel(eval(evaluator[label])))
# table.data_append(unravel(eval(eval(evaluator[label]))))
outputAlive = table.data_write() # output processed line outputAlive = table.data_write() # output processed line
# ------------------------------------------ output finalization ----------------------------------- # ------------------------------------------ output finalization -----------------------------------
table.close() # close ASCII tables table.close() # close ASCII tables
if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new

View File

@ -35,13 +35,14 @@ parser.set_defaults(defgrad = 'f',
# --- loop over input files ------------------------------------------------------------------------- # --- loop over input files -------------------------------------------------------------------------
if filenames == []: filenames = ['STDIN'] if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
if not (name == 'STDIN' or os.path.exists(name)): continue try:
table = damask.ASCIItable(name = name, outname = name+'_tmp', table = damask.ASCIItable(name = name, buffered = False)
buffered = False) except:
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) continue
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else ''))
# ------------------------------------------ read header ------------------------------------------ # ------------------------------------------ read header ------------------------------------------
@ -81,4 +82,3 @@ for name in filenames:
# ------------------------------------------ output finalization ----------------------------------- # ------------------------------------------ output finalization -----------------------------------
table.close() # close input ASCII table (works for stdin) table.close() # close input ASCII table (works for stdin)
if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new