From 4e4fa35ca09d827069175e48d631a2ef4353d61e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 5 Nov 2016 12:55:07 +0100 Subject: [PATCH 1/4] reordered for better readibility, do not limit heap for zsh limiting the heap causes problem on my arch linux, where it is set to unlimited by default. Since I'm probably the only zshell user, I'll test it for a while and If I don't observe any problems do the same changes for bash/dash and C shell --- DAMASK_env.csh | 4 ++-- DAMASK_env.sh | 2 +- DAMASK_env.zsh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DAMASK_env.csh b/DAMASK_env.csh index 96ddbf8c2..81d4de421 100644 --- a/DAMASK_env.csh +++ b/DAMASK_env.csh @@ -25,11 +25,11 @@ endif # this seems to make sense for the stack size if ( `which free` != "free: Command not found." ) then set freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'` - set stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2` set heap=` expr $freeMem / 2` + set stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2` # http://superuser.com/questions/220059/what-parameters-has-ulimit - limit stacksize $stack # maximum stack size (kB) limit datasize $heap # maximum heap size (kB) + limit stacksize $stack # maximum stack size (kB) endif if ( `limit | grep memoryuse` != "" ) then limit memoryuse unlimited # maximum physical memory size diff --git a/DAMASK_env.sh b/DAMASK_env.sh index 6abaff19b..e45e16d42 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -40,8 +40,8 @@ FREE=$(which free 2>/dev/null) if [ "x$FREE" != "x" ]; then freeMem=$(free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}') # http://superuser.com/questions/220059/what-parameters-has-ulimit - ulimit -s $(expr $freeMem / $DAMASK_NUM_THREADS / 2) 2>/dev/null # maximum stack size (kB) ulimit -d $(expr $freeMem / 2) 2>/dev/null # maximum heap size (kB) + ulimit -s $(expr $freeMem / $DAMASK_NUM_THREADS / 2) 2>/dev/null # maximum stack size (kB) fi ulimit -v unlimited 2>/dev/null # maximum virtual memory size ulimit -m unlimited 2>/dev/null # maximum physical memory size diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index ccb534b99..557397630 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -28,8 +28,8 @@ if [ "`which free 2>/dev/null`" != "free not found" ]; then freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'` # http://superuser.com/questions/220059/what-parameters-has-ulimit + #ulimit -d `expr $freeMem / 2` 2>/dev/null # maximum heap size (kB) ulimit -s `expr $freeMem / $DAMASK_NUM_THREADS / 2` 2>/dev/null # maximum stack size (kB) - ulimit -d `expr $freeMem / 2` 2>/dev/null # maximum heap size (kB) fi ulimit -v unlimited 2>/dev/null # maximum virtual memory size ulimit -m unlimited 2>/dev/null # maximum physical memory size From e57fd8e01ad921c75ce11064e1e7369de717a5c5 Mon Sep 17 00:00:00 2001 From: Test User Date: Sun, 6 Nov 2016 16:39:51 +0100 Subject: [PATCH 2/4] updated version information after successful test of v2.0.1-296-g4e4fa35 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 146bd7483..9243d70f9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-294-g2fa4e48 +v2.0.1-296-g4e4fa35 From 8179a703fb27d2380104c1449181d1bf18c0ac9f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 6 Nov 2016 22:57:34 +0100 Subject: [PATCH 3/4] now more flexible, works for synthetic data and user selected data --- processing/misc/DREAM3D_toTable.py | 66 +++++++++++++++++------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/processing/misc/DREAM3D_toTable.py b/processing/misc/DREAM3D_toTable.py index 4cd93cf5b..c09a77717 100755 --- a/processing/misc/DREAM3D_toTable.py +++ b/processing/misc/DREAM3D_toTable.py @@ -14,14 +14,28 @@ scriptID = ' '.join([scriptName,damask.version]) # MAIN #-------------------------------------------------------------------------------------------------- -parser = OptionParser(option_class=damask.extendableOption, usage='%prog [geomfile[s]]', description = """ -Convert DREAM3D file to ASCIItable +parser = OptionParser(option_class=damask.extendableOption, usage='%prog [dream3dfile[s]]', description = """ +Convert DREAM3D file to ASCIItable. Works for 3D datasets, but, hey, its not called DREAM2D ;) """, version = scriptID) +parser.add_option('-d','--data', + dest = 'data', + action = 'extend', metavar = '', + help = 'data to extract from DREAM3D file') +parser.add_option('-c','--container', + dest = 'container', metavar = 'string', + help = 'root container(group) in which data is stored [%default]') + +parser.set_defaults(container="ImageDataContainer", + ) + (options, filenames) = parser.parse_args() -rootDir ='DataContainers/ImageDataContainer' +if options.data is None: + parser.error('No data selected') + +rootDir ='DataContainers/'+options.container # --- loop over input files ------------------------------------------------------------------------- @@ -36,33 +50,29 @@ for name in filenames: damask.util.report(scriptName,name) inFile = h5py.File(name, 'r') - - grid = inFile[rootDir+'/_SIMPL_GEOMETRY/DIMENSIONS'][...] - + try: + grid = inFile[rootDir+'/_SIMPL_GEOMETRY/DIMENSIONS'][...] + except: + damask.util.croak('Group {} not found'.format(options.container)) + table.close(dismiss = True) + continue # --- read comments -------------------------------------------------------------------------------- - coords = (np.mgrid[0:grid[2], 0:grid[1], 0: grid[0]]).reshape(3, -1).T - coords = (np.fliplr(coords)*inFile[rootDir+'/_SIMPL_GEOMETRY/SPACING'][...] \ - + inFile[rootDir+'/_SIMPL_GEOMETRY/ORIGIN'][...] \ - + inFile[rootDir+'/_SIMPL_GEOMETRY/SPACING'][...]*0.5) - - table.data = np.hstack( (coords, - inFile[rootDir+'/CellData/EulerAngles'][...].reshape(grid.prod(),3), - inFile[rootDir+'/CellData/Phases'][...].reshape(grid.prod(),1), - inFile[rootDir+'/CellData/Confidence Index'][...].reshape(grid.prod(),1), - inFile[rootDir+'/CellData/Fit'][...].reshape(grid.prod(),1), - inFile[rootDir+'/CellData/Image Quality'][...].reshape(grid.prod(),1))) - - - labels = ['1_pos','2_pos','3_pos', - '1_Euler','2_Euler','3_Euler', - 'PhaseID','CI','Fit','IQ'] - try: - table.data = np.hstack((table.data, inFile[rootDir+'/CellData/FeatureIds'][...].reshape(grid.prod(),1))) - labels.append(['FeatureID']) - except Exception: - pass + coords = (np.mgrid[0:grid[2], 0:grid[1], 0: grid[0]]).reshape(3, -1).T + table.data = (np.fliplr(coords)*inFile[rootDir+'/_SIMPL_GEOMETRY/SPACING'][...] \ + + inFile[rootDir+'/_SIMPL_GEOMETRY/ORIGIN'][...] \ + + inFile[rootDir+'/_SIMPL_GEOMETRY/SPACING'][...]*0.5) + labels = ['1_pos','2_pos','3_pos'] + for data in options.data: + try: + l = np.prod(inFile[rootDir+'/CellData/'+data].shape[3:]) + labels+=['{}_{}'.format(i+1,data.replace(' ','')) for i in range(l)] if l >1 else [data.replace(' ','')] + except KeyError: + damask.util.croak('Data {} not found'.format(data)) + pass + table.data = np.hstack((table.data, + inFile[rootDir+'/CellData/'+data][...].reshape(grid.prod(),l))) # ------------------------------------------ assemble header --------------------------------------- table.labels_clear() @@ -70,5 +80,5 @@ for name in filenames: table.head_write() # ------------------------------------------ finalize output --------------------------------------- - table.data_writeArray() #(fmt='%e2.2') + table.data_writeArray() table.close() From 0653383c95651023d15c15f72695a8c15abaf1c7 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 7 Nov 2016 04:39:27 +0100 Subject: [PATCH 4/4] updated version information after successful test of v2.0.1-298-g8179a70 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9243d70f9..02b19f674 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-296-g4e4fa35 +v2.0.1-298-g8179a70