standardized script name reporting

This commit is contained in:
Philip Eisenlohr 2014-11-18 15:31:39 +00:00
parent b17dcd7652
commit 3cfabe3b83
24 changed files with 43 additions and 53 deletions

View File

@ -6,7 +6,8 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
@ -47,8 +48,8 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
x = 0 x = 0
for line in file['input']: for line in file['input']:
lineSplit=line.split() lineSplit=line.split()

View File

@ -15,7 +15,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
# ----------------------------- # -----------------------------
def ParseOutputFormat(filename,what,me): def ParseOutputFormat(filename,what,me):

View File

@ -6,8 +6,8 @@ import numpy as np
from optparse import OptionParser from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id: geom_pack.py 3679 2014-11-05 22:01:11Z p.eisenlohr $','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
oversampling = 2. oversampling = 2.
@ -92,8 +92,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
table = damask.ASCIItable(file['input'],file['output'],labels = False) table = damask.ASCIItable(file['input'],file['output'],labels = False)
table.head_read() table.head_read()

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# MAIN # MAIN
@ -68,8 +68,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
theTable = damask.ASCIItable(file['input'],file['output'],labels = False) theTable = damask.ASCIItable(file['input'],file['output'],labels = False)
theTable.head_read() theTable.head_read()

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
@ -60,8 +60,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
theTable = damask.ASCIItable(file['input'],file['output'],labels=False) theTable = damask.ASCIItable(file['input'],file['output'],labels=False)
theTable.head_read() theTable.head_read()

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN

View File

@ -8,7 +8,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
def periodic_3Dpad(array, rimdim=(1,1,1)): def periodic_3Dpad(array, rimdim=(1,1,1)):
@ -146,8 +146,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
table = damask.ASCIItable(file['input'],file['output'][0],labels = False) table = damask.ASCIItable(file['input'],file['output'][0],labels = False)
table.head_read() table.head_read()

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# MAIN # MAIN

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# MAIN # MAIN

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
@ -59,7 +59,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write(file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
info = { info = {
'grid': np.zeros(3,'i'), 'grid': np.zeros(3,'i'),

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
def meshgrid2(*arrs): def meshgrid2(*arrs):
@ -99,8 +99,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
table = damask.ASCIItable(file['input'],file['output'],buffered = False) table = damask.ASCIItable(file['input'],file['output'],buffered = False)
table.head_read() table.head_read()

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
@ -52,7 +52,7 @@ else:
# ------------------------------------------ loop over input files -------------------------------- # ------------------------------------------ loop over input files --------------------------------
for file in files: for file in files:
file['croak'].write('\033[1m'+scriptName+'\033[0m'+(': '+file['name'] if file['name'] != 'STDIN' else '')+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
if file['name'] != 'STDIN': if file['name'] != 'STDIN':
file['input'] = open(file['name']) file['input'] = open(file['name'])

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN

View File

@ -7,7 +7,7 @@ import damask
from optparse import OptionParser from optparse import OptionParser
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
@ -71,8 +71,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
theTable = damask.ASCIItable(file['input'],file['output'],labels=False) theTable = damask.ASCIItable(file['input'],file['output'],labels=False)
theTable.head_read() theTable.head_read()

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
@ -51,8 +51,7 @@ else:
# ------------------------------------------ loop over input files --------------------------------- # ------------------------------------------ loop over input files ---------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
table = damask.ASCIItable(file['input'],file['output'],labels = False,buffered = False) # make unbuffered ASCII_table table = damask.ASCIItable(file['input'],file['output'],labels = False,buffered = False) # make unbuffered ASCII_table
table.head_read() # read ASCII header info table.head_read() # read ASCII header info

View File

@ -8,7 +8,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
class extendedOption(Option): class extendedOption(Option):
@ -86,8 +86,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
theTable = damask.ASCIItable(file['input'],file['output'],labels=False) theTable = damask.ASCIItable(file['input'],file['output'],labels=False)
theTable.head_read() theTable.head_read()

View File

@ -12,7 +12,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
# ----------------------------- # -----------------------------
def ParseOutputFormat(filename,what,me): def ParseOutputFormat(filename,what,me):

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
sys.path.append(damask.solver.Marc().libraryPath('../../')) sys.path.append(damask.solver.Marc().libraryPath('../../'))

View File

@ -6,7 +6,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------
def outMentat(cmd,locals): def outMentat(cmd,locals):

View File

@ -6,7 +6,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
try: # check for Python Image Lib try: # check for Python Image Lib

View File

@ -7,7 +7,7 @@ import damask
from optparse import OptionParser from optparse import OptionParser
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
@ -63,8 +63,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
theTable = damask.ASCIItable(file['input'],file['output']) theTable = damask.ASCIItable(file['input'],file['output'])
theTable.head_read() theTable.head_read()

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# MAIN # MAIN
@ -67,8 +67,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
table = damask.ASCIItable(file['input'],file['output'],labels = False,buffered = False) table = damask.ASCIItable(file['input'],file['output'],labels = False,buffered = False)
table.head_read() table.head_read()

View File

@ -7,7 +7,7 @@ from optparse import OptionParser
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# MAIN # MAIN

View File

@ -8,7 +8,7 @@ from collections import defaultdict
import damask import damask
scriptID = string.replace('$Id$','\n','\\n') scriptID = string.replace('$Id$','\n','\\n')
scriptName = scriptID.split()[1][:-3] scriptName = os.path.splitext(scriptID.split()[1])[0]
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
@ -92,8 +92,7 @@ else:
#--- loop over input files ------------------------------------------------------------------------ #--- loop over input files ------------------------------------------------------------------------
for file in files: for file in files:
if file['name'] != 'STDIN': file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n')
else: file['croak'].write('\033[1m'+scriptName+'\033[0m\n')
table = damask.ASCIItable(file['input'],file['output'],buffered = False) table = damask.ASCIItable(file['input'],file['output'],buffered = False)
table.head_read() table.head_read()