following prospector guidelines

This commit is contained in:
Martin Diehl 2019-11-24 19:25:01 +01:00
parent c9f9f7c681
commit 3e8518d861
4 changed files with 10 additions and 13 deletions

View File

@ -86,7 +86,7 @@ for name in filenames:
* inFile[os.path.join(group_geom,'SPACING')][...] * inFile[os.path.join(group_geom,'SPACING')][...]
grid = inFile[os.path.join(group_geom,'DIMENSIONS')][...] grid = inFile[os.path.join(group_geom,'DIMENSIONS')][...]
origin = inFile[os.path.join(group_geom,'ORIGIN')][...] origin = inFile[os.path.join(group_geom,'ORIGIN')][...]
except: except KeyError:
errors.append('Geometry data ({}) not found'.format(group_geom)) errors.append('Geometry data ({}) not found'.format(group_geom))
@ -98,13 +98,13 @@ for name in filenames:
try: try:
quats = np.reshape(inFile[dataset][...],(np.product(grid),4)) quats = np.reshape(inFile[dataset][...],(np.product(grid),4))
rot = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in quats] rot = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in quats]
except: except KeyError:
errors.append('Pointwise orientation (quaternion) data ({}) not readable'.format(dataset)) errors.append('Pointwise orientation (quaternion) data ({}) not readable'.format(dataset))
dataset = os.path.join(group_pointwise,options.phase) dataset = os.path.join(group_pointwise,options.phase)
try: try:
phase = np.reshape(inFile[dataset][...],(np.product(grid))) phase = np.reshape(inFile[dataset][...],(np.product(grid)))
except: except KeyError:
errors.append('Pointwise phase data ({}) not readable'.format(dataset)) errors.append('Pointwise phase data ({}) not readable'.format(dataset))
microstructure = np.arange(1,np.product(grid)+1,dtype=int).reshape(grid,order='F') microstructure = np.arange(1,np.product(grid)+1,dtype=int).reshape(grid,order='F')
@ -116,7 +116,7 @@ for name in filenames:
dataset = os.path.join(group_pointwise,options.microstructure) dataset = os.path.join(group_pointwise,options.microstructure)
try: try:
microstructure = np.transpose(inFile[dataset][...].reshape(grid[::-1]),(2,1,0)) # convert from C ordering microstructure = np.transpose(inFile[dataset][...].reshape(grid[::-1]),(2,1,0)) # convert from C ordering
except: except KeyError:
errors.append('Link between pointwise and grain average data ({}) not readable'.format(dataset)) errors.append('Link between pointwise and grain average data ({}) not readable'.format(dataset))
group_average = os.path.join(rootDir,options.basegroup,options.average) group_average = os.path.join(rootDir,options.basegroup,options.average)
@ -124,13 +124,13 @@ for name in filenames:
dataset = os.path.join(group_average,options.quaternion) dataset = os.path.join(group_average,options.quaternion)
try: try:
rot = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in inFile[dataset][...][1:]] # skip first entry (unindexed) rot = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in inFile[dataset][...][1:]] # skip first entry (unindexed)
except: except KeyError:
errors.append('Average orientation data ({}) not readable'.format(dataset)) errors.append('Average orientation data ({}) not readable'.format(dataset))
dataset = os.path.join(group_average,options.phase) dataset = os.path.join(group_average,options.phase)
try: try:
phase = [i[0] for i in inFile[dataset][...]][1:] # skip first entry (unindexed) phase = [i[0] for i in inFile[dataset][...]][1:] # skip first entry (unindexed)
except: except KeyError:
errors.append('Average phase data ({}) not readable'.format(dataset)) errors.append('Average phase data ({}) not readable'.format(dataset))
if errors != []: if errors != []:

View File

@ -5,8 +5,6 @@ import sys
from io import StringIO from io import StringIO
from optparse import OptionParser from optparse import OptionParser
import numpy as np
import damask import damask
@ -32,6 +30,6 @@ for name in filenames:
damask.util.report(scriptName,name) damask.util.report(scriptName,name)
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name) geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
damask.util.croak(self.renumber) damask.util.croak(geom.renumber)
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:])) geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
geom.to_file(sys.stdout if name is None else name,pack=False) geom.to_file(sys.stdout if name is None else name,pack=False)

View File

@ -2,11 +2,10 @@
import os import os
import sys import sys
import numpy as np
from io import StringIO from io import StringIO
from optparse import OptionParser from optparse import OptionParser
from scipy import ndimage
import numpy as np
import damask import damask

View File

@ -469,7 +469,7 @@ class Geom():
def scale(self,grid): def scale(self,grid):
""" """
Scale microstructure to new grid Scale microstructure to new grid.
Parameters Parameters
---------- ----------