From e4bb61c9d96b233383638763d1a112d87dcd484e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 23 Feb 2019 11:37:09 +0100 Subject: [PATCH] transition to new orientation class/DREAM.3D --- PRIVATE | 2 +- processing/misc/OIMgrainFile_toTable.py | 48 ---------- processing/pre/3DRVEfrom2Dang.py | 119 ------------------------ 3 files changed, 1 insertion(+), 168 deletions(-) delete mode 100755 processing/misc/OIMgrainFile_toTable.py delete mode 100755 processing/pre/3DRVEfrom2Dang.py diff --git a/PRIVATE b/PRIVATE index dc9722c3c..35bed9722 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit dc9722c3c9787bbb0f63308a7015b6709e6d4f94 +Subproject commit 35bed9722ddecc342719bafac32590e9ab94d053 diff --git a/processing/misc/OIMgrainFile_toTable.py b/processing/misc/OIMgrainFile_toTable.py deleted file mode 100755 index 063adb0db..000000000 --- a/processing/misc/OIMgrainFile_toTable.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python2.7 -# -*- coding: UTF-8 no BOM -*- - -import os,sys -from optparse import OptionParser -import damask - -scriptName = os.path.splitext(os.path.basename(__file__))[0] -scriptID = ' '.join([scriptName,damask.version]) - -#-------------------------------------------------------------------------------------------------- -# MAIN -#-------------------------------------------------------------------------------------------------- - -parser = OptionParser(option_class=damask.extendableOption, usage='%prog [file[s]]', description = """ -Adds header to OIM grain file type 1 to make it accesible as ASCII table - -""", version = scriptID) - - -(options, filenames) = parser.parse_args() - -# --- loop over input files ------------------------------------------------------------------------- - -if filenames == []: filenames = [None] - -for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False, - labeled = False) - except: continue - damask.util.report(scriptName,name) - table.head_read() - data = [] - while table.data_read(): - data.append(table.data[0:9]) - - table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append(['1_euler','2_euler','3_euler','1_pos','2_pos','IQ','CI','Fit','GrainID']) - table.head_write() - for i in data: - table.data = i - table.data_write() - -# --- output finalization -------------------------------------------------------------------------- - - table.close() # close ASCII table diff --git a/processing/pre/3DRVEfrom2Dang.py b/processing/pre/3DRVEfrom2Dang.py deleted file mode 100755 index 58607c4be..000000000 --- a/processing/pre/3DRVEfrom2Dang.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python2.7 -# -*- coding: UTF-8 no BOM -*- - -import os,sys,math -from optparse import OptionParser -import damask -import pipes - -scriptName = os.path.splitext(os.path.basename(__file__))[0] -scriptID = ' '.join([scriptName,damask.version]) - -# -------------------------------------------------------------------- -# MAIN -# -------------------------------------------------------------------- - -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', - description ='generate 3D RVE from .ang files of EBSD slices .', - version = scriptID) - -parser.add_option('--offset', - dest='offset', - type='float', - help='offset of EBSD slices [%default]', - metavar='float') -parser.add_option('--outname', - dest='outName', - type='string', - help='output file name [%default]', metavar='string') -parser.add_option('--vtr', - action="store_true", - dest='vtr') -parser.add_option('--geom', - action="store_true", - dest='geom') -parser.set_defaults(offset = 1.0, - outName = 'RVE3D') - -(options,filenames) = parser.parse_args() - -numFiles = len(filenames) -formatwidth = 1+int(math.log10(numFiles)) - -# copy original files to tmp files to not alter originals -for i in range(numFiles): - sliceID = 'slice' + str(i).zfill(formatwidth) + '.tmp' - strCommand = 'cp ' + pipes.quote(filenames[i]) + ' ' + sliceID - os.system(strCommand) - -# modify tmp files -print('Add z-coordinates') -for i in range(numFiles): - sliceID = 'slice' + str(i).zfill(formatwidth) + '.tmp' - strCommand = 'OIMgrainFile_toTable ' + sliceID - os.system(strCommand) - strCommand = 'addCalculation --label 3Dpos --formula "np.array(#pos#.tolist()+[' + str(i*options.offset) + '])" ' + sliceID - os.system(strCommand) - -# join temp files into one - -print('\n Colocate files') -fileOut = open(options.outName + '.ang','w') - -# take header information from 1st file -sliceID = 'slice' + str(0).zfill(formatwidth) + '.tmp' -fileRead = open(sliceID) -data = fileRead.readlines() -fileRead.close() -headerLines = int(data[0].split()[0]) -fileOut.write(str(headerLines+1) + '\t header\n') -for line in data[1:headerLines]: - fileOut.write(line) -fileOut.write(scriptID + '\t' + ' '.join(sys.argv[1:]) + '\n') -for line in data[headerLines:]: - fileOut.write(line) - -# append other files content without header -for i in range(numFiles-1): - sliceID = 'slice' + str(i+1).zfill(formatwidth) + '.tmp' - fileRead = open(sliceID) - data = fileRead.readlines() - fileRead.close() - headerLines = int(data[0].split()[0]) - for line in data[headerLines+1:]: - fileOut.write(line) -fileOut.close() - -# tidy up and add phase column -print('\n Remove temp data and add phase info') -strCommand = 'filterTable --black pos ' + options.outName + '.ang' -os.system(strCommand) -strCommand = 'reLabel --label 3Dpos --substitute pos ' + options.outName + '.ang' -os.system(strCommand) -strCommand = 'addCalculation -l phase -f 1 ' + options.outName + '.ang' -os.system(strCommand) - - -# create geom file when asked for -if options.geom: - print('\n Build geometry file') - strCommand = 'geom_fromTable --phase phase --eulers euler --coordinates pos ' + pipes.quote(options.outName) + '.ang' - os.system(strCommand) - -# create paraview file when asked for - -if options.vtr: - print('\n Build Paraview file') - strCommand = 'addIPFcolor --eulers euler --pole 0.0 0.0 1.0 ' + options.outName + '.ang' - os.system(strCommand) - strCommand = 'vtk_rectilinearGrid ' + pipes.quote(options.outName) + '.ang' - os.system(strCommand) - os.rename(pipes.quote(options.outName) + '_pos(cell)'+'.vtr', pipes.quote(options.outName) + '.vtr') - strCommand = 'vtk_addRectilinearGridData --vtk '+ pipes.quote(options.outName) + '.vtr --color IPF_001_cubic '\ - + pipes.quote(options.outName) + '.ang' - os.system(strCommand) - -# delete tmp files -for i in range(numFiles): - sliceID = 'slice' + str(i).zfill(formatwidth) + '.tmp' - os.remove(sliceID) \ No newline at end of file