Merge branch 'development' of magit1.mpie.de:damask/DAMASK into development
This commit is contained in:
commit
6d91ce866e
|
@ -25,11 +25,11 @@ endif
|
||||||
# this seems to make sense for the stack size
|
# this seems to make sense for the stack size
|
||||||
if ( `which free` != "free: Command not found." ) then
|
if ( `which free` != "free: Command not found." ) then
|
||||||
set freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'`
|
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 heap=` expr $freeMem / 2`
|
||||||
|
set stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2`
|
||||||
# http://superuser.com/questions/220059/what-parameters-has-ulimit
|
# http://superuser.com/questions/220059/what-parameters-has-ulimit
|
||||||
limit stacksize $stack # maximum stack size (kB)
|
|
||||||
limit datasize $heap # maximum heap size (kB)
|
limit datasize $heap # maximum heap size (kB)
|
||||||
|
limit stacksize $stack # maximum stack size (kB)
|
||||||
endif
|
endif
|
||||||
if ( `limit | grep memoryuse` != "" ) then
|
if ( `limit | grep memoryuse` != "" ) then
|
||||||
limit memoryuse unlimited # maximum physical memory size
|
limit memoryuse unlimited # maximum physical memory size
|
||||||
|
|
|
@ -40,8 +40,8 @@ FREE=$(which free 2>/dev/null)
|
||||||
if [ "x$FREE" != "x" ]; then
|
if [ "x$FREE" != "x" ]; then
|
||||||
freeMem=$(free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}')
|
freeMem=$(free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}')
|
||||||
# http://superuser.com/questions/220059/what-parameters-has-ulimit
|
# 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 -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
|
fi
|
||||||
ulimit -v unlimited 2>/dev/null # maximum virtual memory size
|
ulimit -v unlimited 2>/dev/null # maximum virtual memory size
|
||||||
ulimit -m unlimited 2>/dev/null # maximum physical memory size
|
ulimit -m unlimited 2>/dev/null # maximum physical memory size
|
||||||
|
|
|
@ -28,8 +28,8 @@ if [ "`which free 2>/dev/null`" != "free not found" ]; then
|
||||||
freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'`
|
freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'`
|
||||||
|
|
||||||
# http://superuser.com/questions/220059/what-parameters-has-ulimit
|
# 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 -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
|
fi
|
||||||
ulimit -v unlimited 2>/dev/null # maximum virtual memory size
|
ulimit -v unlimited 2>/dev/null # maximum virtual memory size
|
||||||
ulimit -m unlimited 2>/dev/null # maximum physical memory size
|
ulimit -m unlimited 2>/dev/null # maximum physical memory size
|
||||||
|
|
|
@ -14,14 +14,28 @@ scriptID = ' '.join([scriptName,damask.version])
|
||||||
# MAIN
|
# MAIN
|
||||||
#--------------------------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
parser = OptionParser(option_class=damask.extendableOption, usage='%prog [geomfile[s]]', description = """
|
parser = OptionParser(option_class=damask.extendableOption, usage='%prog [dream3dfile[s]]', description = """
|
||||||
Convert DREAM3D file to ASCIItable
|
Convert DREAM3D file to ASCIItable. Works for 3D datasets, but, hey, its not called DREAM2D ;)
|
||||||
|
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
|
parser.add_option('-d','--data',
|
||||||
|
dest = 'data',
|
||||||
|
action = 'extend', metavar = '<string LIST>',
|
||||||
|
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()
|
(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 -------------------------------------------------------------------------
|
# --- loop over input files -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -36,33 +50,29 @@ for name in filenames:
|
||||||
damask.util.report(scriptName,name)
|
damask.util.report(scriptName,name)
|
||||||
|
|
||||||
inFile = h5py.File(name, 'r')
|
inFile = h5py.File(name, 'r')
|
||||||
|
try:
|
||||||
grid = inFile[rootDir+'/_SIMPL_GEOMETRY/DIMENSIONS'][...]
|
grid = inFile[rootDir+'/_SIMPL_GEOMETRY/DIMENSIONS'][...]
|
||||||
|
except:
|
||||||
|
damask.util.croak('Group {} not found'.format(options.container))
|
||||||
|
table.close(dismiss = True)
|
||||||
|
continue
|
||||||
|
|
||||||
# --- read comments --------------------------------------------------------------------------------
|
# --- read comments --------------------------------------------------------------------------------
|
||||||
|
|
||||||
coords = (np.mgrid[0:grid[2], 0:grid[1], 0: grid[0]]).reshape(3, -1).T
|
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'][...] \
|
table.data = (np.fliplr(coords)*inFile[rootDir+'/_SIMPL_GEOMETRY/SPACING'][...] \
|
||||||
+ inFile[rootDir+'/_SIMPL_GEOMETRY/ORIGIN'][...] \
|
+ inFile[rootDir+'/_SIMPL_GEOMETRY/ORIGIN'][...] \
|
||||||
+ inFile[rootDir+'/_SIMPL_GEOMETRY/SPACING'][...]*0.5)
|
+ inFile[rootDir+'/_SIMPL_GEOMETRY/SPACING'][...]*0.5)
|
||||||
|
labels = ['1_pos','2_pos','3_pos']
|
||||||
table.data = np.hstack( (coords,
|
for data in options.data:
|
||||||
inFile[rootDir+'/CellData/EulerAngles'][...].reshape(grid.prod(),3),
|
try:
|
||||||
inFile[rootDir+'/CellData/Phases'][...].reshape(grid.prod(),1),
|
l = np.prod(inFile[rootDir+'/CellData/'+data].shape[3:])
|
||||||
inFile[rootDir+'/CellData/Confidence Index'][...].reshape(grid.prod(),1),
|
labels+=['{}_{}'.format(i+1,data.replace(' ','')) for i in range(l)] if l >1 else [data.replace(' ','')]
|
||||||
inFile[rootDir+'/CellData/Fit'][...].reshape(grid.prod(),1),
|
except KeyError:
|
||||||
inFile[rootDir+'/CellData/Image Quality'][...].reshape(grid.prod(),1)))
|
damask.util.croak('Data {} not found'.format(data))
|
||||||
|
pass
|
||||||
|
table.data = np.hstack((table.data,
|
||||||
labels = ['1_pos','2_pos','3_pos',
|
inFile[rootDir+'/CellData/'+data][...].reshape(grid.prod(),l)))
|
||||||
'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
|
|
||||||
|
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
# ------------------------------------------ assemble header ---------------------------------------
|
||||||
table.labels_clear()
|
table.labels_clear()
|
||||||
|
@ -70,5 +80,5 @@ for name in filenames:
|
||||||
table.head_write()
|
table.head_write()
|
||||||
|
|
||||||
# ------------------------------------------ finalize output ---------------------------------------
|
# ------------------------------------------ finalize output ---------------------------------------
|
||||||
table.data_writeArray() #(fmt='%e2.2')
|
table.data_writeArray()
|
||||||
table.close()
|
table.close()
|
||||||
|
|
Loading…
Reference in New Issue