improved error handling/clearer messages
This commit is contained in:
parent
5b28e80d21
commit
b84d4f1b6a
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit def4081e837539dba7c4760abbb340553be66d3c
|
Subproject commit 35bfe75dfc93e8b708b2e0349ce2fb89ceae1ad4
|
|
@ -22,13 +22,13 @@ from grain data (individual grains are segmented). Requires orientation data as
|
||||||
|
|
||||||
parser.add_option('-b','--basegroup',
|
parser.add_option('-b','--basegroup',
|
||||||
dest = 'basegroup', metavar = 'string',
|
dest = 'basegroup', metavar = 'string',
|
||||||
help = 'name of the group in "DataContainers" that contains all the data')
|
help = 'name of the group in "DataContainers" containing the pointwise (and, if applicable grain average) data')
|
||||||
parser.add_option('-p','--pointwise',
|
parser.add_option('-p','--pointwise',
|
||||||
dest = 'pointwise', metavar = 'string',
|
dest = 'pointwise', metavar = 'string',
|
||||||
help = 'name of the group in "DataContainers/<basegroup>" that contains pointwise data [%default]')
|
help = 'name of the group in "DataContainers/<basegroup>" containing pointwise data [%default]')
|
||||||
parser.add_option('-a','--average',
|
parser.add_option('-a','--average',
|
||||||
dest = 'average', metavar = 'string',
|
dest = 'average', metavar = 'string',
|
||||||
help = 'name of the group in "DataContainers</basegroup>" that contains grain average data. '\
|
help = 'name of the group in "DataContainers</basegroup>" containing grain average data. '\
|
||||||
+ 'Leave empty for pointwise data')
|
+ 'Leave empty for pointwise data')
|
||||||
parser.add_option('--phase',
|
parser.add_option('--phase',
|
||||||
dest = 'phase',
|
dest = 'phase',
|
||||||
|
@ -88,20 +88,19 @@ for name in filenames:
|
||||||
if options.average is None:
|
if options.average is None:
|
||||||
label = 'point'
|
label = 'point'
|
||||||
N_microstructure = np.product(info['grid'])
|
N_microstructure = np.product(info['grid'])
|
||||||
|
|
||||||
dataset = os.path.join(group_pointwise,options.quaternion)
|
dataset = os.path.join(group_pointwise,options.quaternion)
|
||||||
try:
|
try:
|
||||||
quats = np.reshape(inFile[dataset][...],(N_microstructure,3))
|
quats = np.reshape(inFile[dataset][...],(N_microstructure,4))
|
||||||
|
texture = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in quats]
|
||||||
except:
|
except:
|
||||||
errors.append('Pointwise orientation data ({}) not found'.format(dataset))
|
errors.append('Pointwise orientation (quaternion) data ({}) not readable'.format(dataset))
|
||||||
|
|
||||||
texture = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in quats]
|
|
||||||
|
|
||||||
dataset = os.path.join(group_pointwise,options.phase)
|
dataset = os.path.join(group_pointwise,options.phase)
|
||||||
try:
|
try:
|
||||||
phase = np.reshape(inFile[dataset][...],(N_microstructure))
|
phase = np.reshape(inFile[dataset][...],(N_microstructure))
|
||||||
except:
|
except:
|
||||||
errors.append('Pointwise phase data ({}) not found'.format(dataset))
|
errors.append('Pointwise phase data ({}) not readable'.format(dataset))
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -112,7 +111,7 @@ for name in filenames:
|
||||||
microstructure = np.reshape(inFile[dataset][...],(np.product(info['grid'])))
|
microstructure = np.reshape(inFile[dataset][...],(np.product(info['grid'])))
|
||||||
N_microstructure = np.max(microstructure)
|
N_microstructure = np.max(microstructure)
|
||||||
except:
|
except:
|
||||||
errors.append('Link between pointwise and grain average data ({}) not found'.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)
|
||||||
|
|
||||||
|
@ -120,13 +119,13 @@ for name in filenames:
|
||||||
try:
|
try:
|
||||||
texture = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in inFile[dataset][...][1:]] # skip first entry (unindexed)
|
texture = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in inFile[dataset][...][1:]] # skip first entry (unindexed)
|
||||||
except:
|
except:
|
||||||
errors.append('Average orientation data ({}) not found'.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:
|
||||||
errors.append('Average phase data ({}) not found'.format(dataset))
|
errors.append('Average phase data ({}) not readable'.format(dataset))
|
||||||
|
|
||||||
if errors != []:
|
if errors != []:
|
||||||
damask.util.croak(errors)
|
damask.util.croak(errors)
|
||||||
|
|
Loading…
Reference in New Issue