some more scripts passed
This commit is contained in:
parent
974b8cde41
commit
c1dd5febd5
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,string,sys,re
|
import os,sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import damask
|
import damask
|
||||||
|
@ -73,7 +73,7 @@ for file in files:
|
||||||
for iPhi1 in range(nPhi1):
|
for iPhi1 in range(nPhi1):
|
||||||
for iPHI in range(nPHI):
|
for iPHI in range(nPHI):
|
||||||
for iPhi2 in range(nPhi2):
|
for iPhi2 in range(nPhi2):
|
||||||
ODF[iPhi1,iPHI,iPhi2] = float(line.split()[3])*0.125 # extract intensity (in column 4) and weight by 1/8 (since we convert from the 8 corners to the center later on)
|
ODF[iPhi1,iPHI,iPhi2] = float(line.split()[3])*0.125 # extract intensity (in column 4) and weight by 1/8
|
||||||
line = file['input'].readline()
|
line = file['input'].readline()
|
||||||
|
|
||||||
for iPhi1 in range(nPhi1-1):
|
for iPhi1 in range(nPhi1-1):
|
||||||
|
|
|
@ -10,10 +10,11 @@
|
||||||
# maintain meaningful microstructure(reduce artifacts).
|
# maintain meaningful microstructure(reduce artifacts).
|
||||||
|
|
||||||
|
|
||||||
import sys, os, string
|
import os
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import argparse
|
import argparse
|
||||||
from scipy.spatial import Delaunay
|
from scipy.spatial import Delaunay
|
||||||
|
import damask
|
||||||
|
|
||||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||||
scriptID = ' '.join([scriptName,damask.version])
|
scriptID = ' '.join([scriptName,damask.version])
|
||||||
|
@ -23,16 +24,14 @@ OFFSET = 0.1 #resize the seeded volume to give space for rim/pan
|
||||||
PHANTOM_ID = -1 #grain ID for phantom seeds
|
PHANTOM_ID = -1 #grain ID for phantom seeds
|
||||||
|
|
||||||
def d_print(info, data, separator=False):
|
def d_print(info, data, separator=False):
|
||||||
'''quickly print debug information'''
|
"""quickly print debug information"""
|
||||||
if(separator): print "*"*80
|
if(separator): print "*"*80
|
||||||
print info
|
print info
|
||||||
print data
|
print data
|
||||||
|
|
||||||
|
|
||||||
def meshgrid2(*arrs):
|
def meshgrid2(*arrs):
|
||||||
'''
|
"""code inspired by http://stackoverflow.com/questions/1827489/numpy-meshgrid-in-3d"""
|
||||||
code inspired by http://stackoverflow.com/questions/1827489/numpy-meshgrid-in-3d
|
|
||||||
'''
|
|
||||||
arrs = tuple(reversed(arrs))
|
arrs = tuple(reversed(arrs))
|
||||||
arrs = tuple(arrs)
|
arrs = tuple(arrs)
|
||||||
lens = np.array(map(len, arrs))
|
lens = np.array(map(len, arrs))
|
||||||
|
@ -121,9 +120,9 @@ args = parser.parse_args() # get all the arguments right after
|
||||||
#quick help to user
|
#quick help to user
|
||||||
print "*"*80
|
print "*"*80
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
print '''Sample usage:
|
print """Sample usage:
|
||||||
./geoFromBarycentic.py 20grains.seeds -g 128 128 128 -S -r; geom_check seeds.geom; seeds_check new_seed.seeds.
|
./geoFromBarycentic.py 20grains.seeds -g 128 128 128 -S -r; geom_check seeds.geom; seeds_check new_seed.seeds.
|
||||||
'''
|
"""
|
||||||
print "*"*80
|
print "*"*80
|
||||||
if (args.debug):
|
if (args.debug):
|
||||||
d_print("args are:", parser.parse_args(),separator=True)
|
d_print("args are:", parser.parse_args(),separator=True)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,string,math
|
import os,sys,math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import damask
|
import damask
|
||||||
from scipy import ndimage
|
from scipy import ndimage
|
||||||
|
@ -49,7 +49,7 @@ parser.set_defaults(degrees = False,
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
|
||||||
if sum(x != None for x in [options.rotation,options.eulers,options.matrix,options.quaternion]) !=1:
|
if sum(x is not None for x in [options.rotation,options.eulers,options.matrix,options.quaternion]) !=1:
|
||||||
parser.error('not exactly one rotation specified...')
|
parser.error('not exactly one rotation specified...')
|
||||||
|
|
||||||
toRadian = math.pi/180. if options.degrees else 1.0
|
toRadian = math.pi/180. if options.degrees else 1.0
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,string,math
|
import os,sys,math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import damask
|
import damask
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
@ -95,8 +95,10 @@ for name in filenames:
|
||||||
# --- report ---------------------------------------------------------------------------------------
|
# --- report ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
remarks = []
|
remarks = []
|
||||||
if (any(newInfo['origin'] != info['origin'])): remarks.append('--> origin x y z: %s'%(' : '.join(map(str,newInfo['origin']))))
|
if (any(newInfo['origin'] != info['origin'])):
|
||||||
if ( newInfo['microstructures'] != info['microstructures']): remarks.append('--> microstructures: %i'%newInfo['microstructures'])
|
remarks.append('--> origin x y z: %s'%(' : '.join(map(str,newInfo['origin']))))
|
||||||
|
if ( newInfo['microstructures'] != info['microstructures']):
|
||||||
|
remarks.append('--> microstructures: %i'%newInfo['microstructures'])
|
||||||
if remarks != []: damask.util.croak(remarks)
|
if remarks != []: damask.util.croak(remarks)
|
||||||
|
|
||||||
# --- write header ---------------------------------------------------------------------------------
|
# --- write header ---------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,string,math
|
import os,sys,math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import damask
|
import damask
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,string,math
|
import os,sys,math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy import ndimage
|
from scipy import ndimage
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
@ -87,9 +87,8 @@ for name in filenames:
|
||||||
|
|
||||||
# --- report ---------------------------------------------------------------------------------------
|
# --- report ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
remarks = []
|
if (newInfo['microstructures'] != info['microstructures']):
|
||||||
if ( newInfo['microstructures'] != info['microstructures']): remarks.append('--> microstructures: %i'%newInfo['microstructures'])
|
damask.util.croak('--> microstructures: %i'%newInfo['microstructures'])
|
||||||
if remarks != []: damask.util.croak(remarks)
|
|
||||||
|
|
||||||
# --- write header ---------------------------------------------------------------------------------
|
# --- write header ---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,string,vtk
|
import os,sys,vtk
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import damask
|
import damask
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
@ -66,8 +66,8 @@ for name in filenames:
|
||||||
if info['size'][i] <= 0.0: # any invalid size?
|
if info['size'][i] <= 0.0: # any invalid size?
|
||||||
info['size'][i] = float(info['grid'][i])/max(info['grid']) # normalize to grid
|
info['size'][i] = float(info['grid'][i])/max(info['grid']) # normalize to grid
|
||||||
remarks.append('rescaling size {} to {}...'.format({0:'x',1:'y',2:'z'}[i],info['size'][i]))
|
remarks.append('rescaling size {} to {}...'.format({0:'x',1:'y',2:'z'}[i],info['size'][i]))
|
||||||
if table.label_dimension(options.position) != 3: errors.append('columns "{}" have dimension {}'.format(options.position,
|
if table.label_dimension(options.position) != 3:
|
||||||
table.label_dimension(options.position)))
|
errors.append('columns "{}" have dimension {}'.format(options.position,table.label_dimension(options.position)))
|
||||||
if remarks != []: damask.util.croak(remarks)
|
if remarks != []: damask.util.croak(remarks)
|
||||||
if errors != []:
|
if errors != []:
|
||||||
damask.util.croak(errors)
|
damask.util.croak(errors)
|
||||||
|
@ -110,8 +110,7 @@ for name in filenames:
|
||||||
(directory,filename) = os.path.split(name)
|
(directory,filename) = os.path.split(name)
|
||||||
writer.SetDataModeToBinary()
|
writer.SetDataModeToBinary()
|
||||||
writer.SetCompressorTypeToZLib()
|
writer.SetCompressorTypeToZLib()
|
||||||
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]
|
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]+'.'+writer.GetDefaultFileExtension()))
|
||||||
+'.'+writer.GetDefaultFileExtension()))
|
|
||||||
else:
|
else:
|
||||||
writer = vtk.vtkDataSetWriter()
|
writer = vtk.vtkDataSetWriter()
|
||||||
writer.WriteToOutputStringOn()
|
writer.WriteToOutputStringOn()
|
||||||
|
@ -120,7 +119,7 @@ for name in filenames:
|
||||||
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(grid)
|
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(grid)
|
||||||
else: writer.SetInputData(grid)
|
else: writer.SetInputData(grid)
|
||||||
writer.Write()
|
writer.Write()
|
||||||
if name == None: sys.stdout.write(writer.GetOutputString()[0:writer.GetOutputStringLength()])
|
if name is None: sys.stdout.write(writer.GetOutputString()[0:writer.GetOutputStringLength()])
|
||||||
|
|
||||||
table.close()
|
table.close()
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
import os,sys,string
|
import os,sys
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import damask
|
import damask
|
||||||
|
@ -88,8 +88,10 @@ for name in filenames:
|
||||||
yy = np.tile(np.repeat(y,info['grid'][0] ),info['grid'][2])
|
yy = np.tile(np.repeat(y,info['grid'][0] ),info['grid'][2])
|
||||||
zz = np.repeat(z,info['grid'][0]*info['grid'][1])
|
zz = np.repeat(z,info['grid'][0]*info['grid'][1])
|
||||||
|
|
||||||
mask = np.logical_and(np.in1d(microstructure,options.whitelist,invert=False) if options.whitelist != [] else np.full_like(microstructure,True,dtype=bool),
|
mask = np.logical_and(np.in1d(microstructure,options.whitelist,invert=False) if options.whitelist != []
|
||||||
np.in1d(microstructure,options.blacklist,invert=True ) if options.blacklist != [] else np.full_like(microstructure,True,dtype=bool))
|
else np.full_like(microstructure,True,dtype=bool),
|
||||||
|
np.in1d(microstructure,options.blacklist,invert=True ) if options.blacklist != []
|
||||||
|
else np.full_like(microstructure,True,dtype=bool))
|
||||||
|
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
# ------------------------------------------ assemble header ---------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue