polishing

This commit is contained in:
Martin Diehl 2016-04-25 12:57:38 +02:00
parent 7ce208019c
commit 2eb7ad7432
4 changed files with 25 additions and 24 deletions

View File

@ -63,25 +63,25 @@ def curlFFT(geomdim,field):
# MAIN
# --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
parser = OptionParser(option_class=damask.extendableOption, usage='%prog option(s) [ASCIItable(s)]', description = """
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.
Deals with both vector- and tensor fields.
""", version = scriptID)
parser.add_option('-c','--coordinates',
parser.add_option('-p','--pos','--periodiccellcenter'
dest = 'coords',
type = 'string', metavar = 'string',
help = 'column label of coordinates [%default]')
help = 'label of coordinates [%default]')
parser.add_option('-v','--vector',
dest = 'vector',
action = 'extend', metavar = '<string LIST>',
help = 'column label(s) of vector field values')
help = 'label(s) of vector field values')
parser.add_option('-t','--tensor',
dest = 'tensor',
action = 'extend', metavar = '<string LIST>',
help = 'column label(s) of tensor field values')
help = 'label(s) of tensor field values')
parser.set_defaults(coords = 'pos',
)
@ -91,7 +91,7 @@ parser.set_defaults(coords = 'pos',
if options.vector is None and options.tensor is None:
parser.error('no data column specified.')
# --- loop over input files -------------------------------------------------------------------------
# --- loop over input files ------------------------------------------------------------------------
if filenames == []: filenames = [None]
@ -148,7 +148,7 @@ for name in filenames:
maxcorner = np.array(map(max,coords))
grid = np.array(map(len,coords),'i')
size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1)
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1]))
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 equal to smallest among other ones
# ------------------------------------------ process value field -----------------------------------

View File

@ -19,7 +19,7 @@ def divFFT(geomdim,field):
div_fourier = np.empty(field_fourier.shape[0:len(np.shape(field))-1],'c16') # size depents on whether tensor or vector
# differentiation in Fourier space
k_s=np.zeros([3],'i')
k_s = np.zeros([3],'i')
TWOPIIMG = 2.0j*math.pi
for i in xrange(grid[2]):
k_s[0] = i
@ -49,25 +49,25 @@ def divFFT(geomdim,field):
# MAIN
# --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
parser = OptionParser(option_class=damask.extendableOption, usage='%prog option(s) [ASCIItable(s)]', description = """
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 = scriptID)
parser.add_option('-c','--coordinates',
parser.add_option('-p','--pos','--periodiccellcenter'
dest = 'coords',
type = 'string', metavar = 'string',
help = 'column label of coordinates [%default]')
help = 'label of coordinates [%default]')
parser.add_option('-v','--vector',
dest = 'vector',
action = 'extend', metavar = '<string LIST>',
help = 'column label(s) of vector field values')
help = 'label(s) of vector field values')
parser.add_option('-t','--tensor',
dest = 'tensor',
action = 'extend', metavar = '<string LIST>',
help = 'column label(s) of tensor field values')
help = 'label(s) of tensor field values')
parser.set_defaults(coords = 'pos',
)

View File

@ -14,6 +14,7 @@ def gradFFT(geomdim,field):
grid = np.array(np.shape(field)[2::-1])
N = grid.prod() # field size
n = np.array(np.shape(field)[3:]).prod() # data size
if n == 3: dataType = 'vector'
elif n == 1: dataType = 'scalar'
@ -52,27 +53,27 @@ def gradFFT(geomdim,field):
# MAIN
# --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
parser = OptionParser(option_class=damask.extendableOption, usage='%prog option(s) [ASCIItable(s)]', description = """
Add column(s) containing gradient of requested column(s).
Operates on periodic ordered three-dimensional data sets.
Deals with both vector- and scalar fields.
""", version = scriptID)
parser.add_option('-c','--coordinates',
parser.add_option('-p','--pos','--periodiccellcenter'
dest = 'coords',
type = 'string', metavar='string',
help = 'column heading for coordinates [%default]')
type = 'string', metavar = 'string',
help = 'label of coordinates [%default]')
parser.add_option('-v','--vector',
dest = 'vector',
action = 'extend', metavar = '<string LIST>',
help = 'heading of columns containing vector field values')
help = 'label(s) of vector field values')
parser.add_option('-s','--scalar',
dest = 'scalar',
action = 'extend', metavar = '<string LIST>',
help = 'heading of columns containing scalar field values')
help = 'label(s) of scalar field values')
parser.set_defaults(coords = 'ipinitialcoord',
parser.set_defaults(coords = 'pos',
)
(options,filenames) = parser.parse_args()
@ -137,7 +138,7 @@ for name in filenames:
maxcorner = np.array(map(max,coords))
grid = np.array(map(len,coords),'i')
size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1)
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1]))
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 equal to smallest among other ones
# ------------------------------------------ process value field -----------------------------------

View File

@ -19,9 +19,9 @@ Adds header to OIM grain file to make it accesible as ASCII table
parser.add_option('-l', '--labels',
dest = 'labels',
help = 'lables for requested columns')
help = 'lables of requested columns')
parser.set_defaults(labels = ['1_eulerangles','2_eulerangles','3_eulerangles',
parser.set_defaults(labels = ['1_euler','2_euler','3_euler',
'1_pos','2_pos', 'IQ', 'CI', 'Fit', 'GrainID',],
)