From 31753be16f955426e41042fba64da8750a7cf26d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 18 Apr 2012 11:42:57 +0000 Subject: [PATCH] updated setup/setup_processing.py with new files added data_readLine(LINE) and data_skipLines(LINES) for ascii table --- lib/damask/asciitable.py | 14 +++++++++++++- processing/post/addDeformedConfiguration.py | 11 +++++++++-- .../{spectral_layer.py => spectral_layeredGeom.py} | 2 +- processing/setup/setup_processing.py | 2 ++ 4 files changed, 25 insertions(+), 4 deletions(-) mode change 100644 => 100755 processing/post/addDeformedConfiguration.py rename processing/pre/{spectral_layer.py => spectral_layeredGeom.py} (95%) mode change 100644 => 100755 diff --git a/lib/damask/asciitable.py b/lib/damask/asciitable.py index 30f2651bf..d3fcea024 100644 --- a/lib/damask/asciitable.py +++ b/lib/damask/asciitable.py @@ -112,6 +112,11 @@ class ASCIItable(): def data_rewind(self): 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): line = self.__IO__['in'].readline() @@ -119,7 +124,14 @@ class ASCIItable(): self.data = {False: [], True: items}[len(items) == self.__IO__['validReadSize']] # take if correct number of entries 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): if len(self.data) == 0: return diff --git a/processing/post/addDeformedConfiguration.py b/processing/post/addDeformedConfiguration.py old mode 100644 new mode 100755 index 59ecc683c..c5fc75edd --- a/processing/post/addDeformedConfiguration.py +++ b/processing/post/addDeformedConfiguration.py @@ -41,7 +41,7 @@ parser = OptionParser(option_class=extendableOption, usage='%prog options [file[ Add column(s) containing deformed configuration of requested column(s). 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',\ @@ -72,7 +72,7 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],False) # make unbuffered ASCII_table 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:])) # --------------- figure out dimension and resolution @@ -83,9 +83,16 @@ for file in files: continue grid = [{},{},{}] + 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): grid[j][str(table.data[locationCol+j])] = True # remember coordinate along x,y,z + res = numpy.array([len(grid[0]),\ len(grid[1]),\ len(grid[2]),],'i') # resolution is number of distinct coordinates found diff --git a/processing/pre/spectral_layer.py b/processing/pre/spectral_layeredGeom.py old mode 100644 new mode 100755 similarity index 95% rename from processing/pre/spectral_layer.py rename to processing/pre/spectral_layeredGeom.py index 6cebb3ce8..1e62c2cda --- a/processing/pre/spectral_layer.py +++ b/processing/pre/spectral_layeredGeom.py @@ -28,7 +28,7 @@ class extendedOption(Option): parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """ 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, \ diff --git a/processing/setup/setup_processing.py b/processing/setup/setup_processing.py index dd2da992e..e4645336f 100755 --- a/processing/setup/setup_processing.py +++ b/processing/setup/setup_processing.py @@ -87,6 +87,7 @@ bin_link = { \ 'spectral_vicinityOffset.py', 'spectral_ang2geom.py', 'spectral_randomSeeding.py', + 'spectral_layeredGeom.py', 'voronoi_tessellation.exe', 'OIMang_hex2cub', ], @@ -101,6 +102,7 @@ bin_link = { \ 'addNorm.py', 'addStrainTensors.py', 'addCompatibilityMismatch.py', + 'addDeformedConfiguration.py', 'averageDown.py', 'deleteColumn.py', 'deleteInfo.py',