some more scripts passed
This commit is contained in:
parent
974b8cde41
commit
c1dd5febd5
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: UTF-8 no BOM -*-
|
||||
|
||||
import os,string,sys,re
|
||||
import os,sys
|
||||
from optparse import OptionParser
|
||||
import numpy as np
|
||||
import damask
|
||||
|
@ -73,7 +73,7 @@ for file in files:
|
|||
for iPhi1 in range(nPhi1):
|
||||
for iPHI in range(nPHI):
|
||||
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()
|
||||
|
||||
for iPhi1 in range(nPhi1-1):
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
# maintain meaningful microstructure(reduce artifacts).
|
||||
|
||||
|
||||
import sys, os, string
|
||||
import os
|
||||
import numpy as np
|
||||
import argparse
|
||||
from scipy.spatial import Delaunay
|
||||
import damask
|
||||
|
||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||
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
|
||||
|
||||
def d_print(info, data, separator=False):
|
||||
'''quickly print debug information'''
|
||||
"""quickly print debug information"""
|
||||
if(separator): print "*"*80
|
||||
print info
|
||||
print data
|
||||
|
||||
|
||||
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(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
|
||||
print "*"*80
|
||||
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.
|
||||
'''
|
||||
"""
|
||||
print "*"*80
|
||||
if (args.debug):
|
||||
d_print("args are:", parser.parse_args(),separator=True)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 no BOM -*-
|
||||
|
||||
import os,sys,string,math
|
||||
import os,sys,math
|
||||
import numpy as np
|
||||
import damask
|
||||
from scipy import ndimage
|
||||
|
@ -49,7 +49,7 @@ parser.set_defaults(degrees = False,
|
|||
|
||||
(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...')
|
||||
|
||||
toRadian = math.pi/180. if options.degrees else 1.0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 no BOM -*-
|
||||
|
||||
import os,sys,string,math
|
||||
import os,sys,math
|
||||
import numpy as np
|
||||
import damask
|
||||
from optparse import OptionParser
|
||||
|
@ -95,8 +95,10 @@ for name in filenames:
|
|||
# --- report ---------------------------------------------------------------------------------------
|
||||
|
||||
remarks = []
|
||||
if (any(newInfo['origin'] != info['origin'])): remarks.append('--> origin x y z: %s'%(' : '.join(map(str,newInfo['origin']))))
|
||||
if ( newInfo['microstructures'] != info['microstructures']): remarks.append('--> microstructures: %i'%newInfo['microstructures'])
|
||||
if (any(newInfo['origin'] != info['origin'])):
|
||||
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)
|
||||
|
||||
# --- write header ---------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 no BOM -*-
|
||||
|
||||
import os,sys,string,math
|
||||
import os,sys,math
|
||||
import numpy as np
|
||||
from optparse import OptionParser
|
||||
import damask
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 no BOM -*-
|
||||
|
||||
import os,sys,string,math
|
||||
import os,sys,math
|
||||
import numpy as np
|
||||
from scipy import ndimage
|
||||
from optparse import OptionParser
|
||||
|
@ -87,9 +87,8 @@ for name in filenames:
|
|||
|
||||
# --- report ---------------------------------------------------------------------------------------
|
||||
|
||||
remarks = []
|
||||
if ( newInfo['microstructures'] != info['microstructures']): remarks.append('--> microstructures: %i'%newInfo['microstructures'])
|
||||
if remarks != []: damask.util.croak(remarks)
|
||||
if (newInfo['microstructures'] != info['microstructures']):
|
||||
damask.util.croak('--> microstructures: %i'%newInfo['microstructures'])
|
||||
|
||||
# --- write header ---------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 no BOM -*-
|
||||
|
||||
import os,sys,string,vtk
|
||||
import os,sys,vtk
|
||||
import numpy as np
|
||||
import damask
|
||||
from optparse import OptionParser
|
||||
|
@ -66,8 +66,8 @@ for name in filenames:
|
|||
if info['size'][i] <= 0.0: # any invalid size?
|
||||
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]))
|
||||
if table.label_dimension(options.position) != 3: errors.append('columns "{}" have dimension {}'.format(options.position,
|
||||
table.label_dimension(options.position)))
|
||||
if table.label_dimension(options.position) != 3:
|
||||
errors.append('columns "{}" have dimension {}'.format(options.position,table.label_dimension(options.position)))
|
||||
if remarks != []: damask.util.croak(remarks)
|
||||
if errors != []:
|
||||
damask.util.croak(errors)
|
||||
|
@ -110,8 +110,7 @@ for name in filenames:
|
|||
(directory,filename) = os.path.split(name)
|
||||
writer.SetDataModeToBinary()
|
||||
writer.SetCompressorTypeToZLib()
|
||||
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]
|
||||
+'.'+writer.GetDefaultFileExtension()))
|
||||
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]+'.'+writer.GetDefaultFileExtension()))
|
||||
else:
|
||||
writer = vtk.vtkDataSetWriter()
|
||||
writer.WriteToOutputStringOn()
|
||||
|
@ -120,7 +119,7 @@ for name in filenames:
|
|||
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(grid)
|
||||
else: writer.SetInputData(grid)
|
||||
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()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 no BOM -*-
|
||||
|
||||
import os,sys,string
|
||||
import os,sys
|
||||
import numpy as np
|
||||
from optparse import OptionParser
|
||||
import damask
|
||||
|
@ -88,8 +88,10 @@ for name in filenames:
|
|||
yy = np.tile(np.repeat(y,info['grid'][0] ),info['grid'][2])
|
||||
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),
|
||||
np.in1d(microstructure,options.blacklist,invert=True ) if options.blacklist != [] else np.full_like(microstructure,True,dtype=bool))
|
||||
mask = np.logical_and(np.in1d(microstructure,options.whitelist,invert=False) if options.whitelist != []
|
||||
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 ---------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue