updated setup/setup_processing.py with new files

added data_readLine(LINE) and data_skipLines(LINES) for ascii table
This commit is contained in:
Martin Diehl 2012-04-18 11:42:57 +00:00
parent 17f644b261
commit 31753be16f
4 changed files with 25 additions and 4 deletions

View File

@ -112,6 +112,11 @@ class ASCIItable():
def data_rewind(self): def data_rewind(self):
self.__IO__['in'].seek(self.__IO__['dataStart']) self.__IO__['in'].seek(self.__IO__['dataStart'])
# ------------------------------------------------------------------
def data_skipLines(self,lines):
for i in range(lines):
self.__IO__['in'].readline()
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def data_read(self): def data_read(self):
line = self.__IO__['in'].readline() line = self.__IO__['in'].readline()
@ -120,6 +125,13 @@ class ASCIItable():
True: items}[len(items) == self.__IO__['validReadSize']] # take if correct number of entries True: items}[len(items) == self.__IO__['validReadSize']] # take if correct number of entries
return self.data != [] return self.data != []
# ------------------------------------------------------------------
def data_readLine(self,line):
self.__IO__['in'].seek(self.__IO__['dataStart'])
for i in range(line-1):
self.__IO__['in'].readline()
self.data_read()
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def data_write(self): def data_write(self):
if len(self.data) == 0: return if len(self.data) == 0: return

11
processing/post/addDeformedConfiguration.py Normal file → Executable file
View File

@ -41,7 +41,7 @@ parser = OptionParser(option_class=extendableOption, usage='%prog options [file[
Add column(s) containing deformed configuration of requested column(s). Add column(s) containing deformed configuration of requested column(s).
Operates on periodic ordered three-dimensional data sets. Operates on periodic ordered three-dimensional data sets.
""" + string.replace('$Id: addDivergence.py 1282 2012-02-08 12:01:38Z MPIE\p.eisenlohr $','\n','\\n') """ + string.replace('$Id$','\n','\\n')
) )
parser.add_option('-c','--coordinates', dest='coords', type='string',\ parser.add_option('-c','--coordinates', dest='coords', type='string',\
@ -72,7 +72,7 @@ for file in files:
table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table
table.head_read() # read ASCII header info table.head_read() # read ASCII header info
table.info_append(string.replace('$Id: addDivergence.py 1282 2012-02-08 12:01:38Z MPIE\p.eisenlohr $','\n','\\n') + \ table.info_append(string.replace('$Id$','\n','\\n') + \
'\t' + ' '.join(sys.argv[1:])) '\t' + ' '.join(sys.argv[1:]))
# --------------- figure out dimension and resolution # --------------- figure out dimension and resolution
@ -83,9 +83,16 @@ for file in files:
continue continue
grid = [{},{},{}] grid = [{},{},{}]
while table.data_read(): # read next data line of ASCII table while table.data_read(): # read next data line of ASCII table
if str(table.data[locationCol+1]) in grid[1] and len(grid[1])>1: # geomdim[1] and res[1] already figured out, skip layers
table.data_skipLines(len(grid[1])*len(grid[0])-1)
else:
if str(table.data[locationCol]) in grid[0]: # geomdim[0] and res[0] already figured out, skip lines
table.data_skipLines(len(grid[0])-1)
for j in xrange(3): for j in xrange(3):
grid[j][str(table.data[locationCol+j])] = True # remember coordinate along x,y,z grid[j][str(table.data[locationCol+j])] = True # remember coordinate along x,y,z
res = numpy.array([len(grid[0]),\ res = numpy.array([len(grid[0]),\
len(grid[1]),\ len(grid[1]),\
len(grid[2]),],'i') # resolution is number of distinct coordinates found len(grid[2]),],'i') # resolution is number of distinct coordinates found

View File

@ -28,7 +28,7 @@ class extendedOption(Option):
parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """ parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """
Construct continuous Microstructure (e.g. from EBSD) with Layer Construct continuous Microstructure (e.g. from EBSD) with Layer
""" + string.replace('$Id: spectral_randomSeeding.py 1423 2012-03-31 12:42:49Z MPIE\m.diehl $','\n','\\n') """ + string.replace('$Id$','\n','\\n')
) )
parser.add_option('-r','--res', dest='res', type='int', nargs=2, \ parser.add_option('-r','--res', dest='res', type='int', nargs=2, \

View File

@ -87,6 +87,7 @@ bin_link = { \
'spectral_vicinityOffset.py', 'spectral_vicinityOffset.py',
'spectral_ang2geom.py', 'spectral_ang2geom.py',
'spectral_randomSeeding.py', 'spectral_randomSeeding.py',
'spectral_layeredGeom.py',
'voronoi_tessellation.exe', 'voronoi_tessellation.exe',
'OIMang_hex2cub', 'OIMang_hex2cub',
], ],
@ -101,6 +102,7 @@ bin_link = { \
'addNorm.py', 'addNorm.py',
'addStrainTensors.py', 'addStrainTensors.py',
'addCompatibilityMismatch.py', 'addCompatibilityMismatch.py',
'addDeformedConfiguration.py',
'averageDown.py', 'averageDown.py',
'deleteColumn.py', 'deleteColumn.py',
'deleteInfo.py', 'deleteInfo.py',