From b84d4f1b6a18b5d088879454e8252bc594292a5c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 5 Mar 2019 10:58:57 +0100 Subject: [PATCH] improved error handling/clearer messages --- PRIVATE | 2 +- processing/pre/geom_fromDREAM3D.py | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/PRIVATE b/PRIVATE index def4081e8..35bfe75df 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit def4081e837539dba7c4760abbb340553be66d3c +Subproject commit 35bfe75dfc93e8b708b2e0349ce2fb89ceae1ad4 diff --git a/processing/pre/geom_fromDREAM3D.py b/processing/pre/geom_fromDREAM3D.py index f75694ef6..9bb8b2fcc 100755 --- a/processing/pre/geom_fromDREAM3D.py +++ b/processing/pre/geom_fromDREAM3D.py @@ -22,13 +22,13 @@ from grain data (individual grains are segmented). Requires orientation data as parser.add_option('-b','--basegroup', 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', dest = 'pointwise', metavar = 'string', - help = 'name of the group in "DataContainers/" that contains pointwise data [%default]') + help = 'name of the group in "DataContainers/" containing pointwise data [%default]') parser.add_option('-a','--average', dest = 'average', metavar = 'string', - help = 'name of the group in "DataContainers" that contains grain average data. '\ + help = 'name of the group in "DataContainers" containing grain average data. '\ + 'Leave empty for pointwise data') parser.add_option('--phase', dest = 'phase', @@ -88,20 +88,19 @@ for name in filenames: if options.average is None: label = 'point' N_microstructure = np.product(info['grid']) - + dataset = os.path.join(group_pointwise,options.quaternion) 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: - 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) try: phase = np.reshape(inFile[dataset][...],(N_microstructure)) except: - errors.append('Pointwise phase data ({}) not found'.format(dataset)) + errors.append('Pointwise phase data ({}) not readable'.format(dataset)) else: @@ -112,7 +111,7 @@ for name in filenames: microstructure = np.reshape(inFile[dataset][...],(np.product(info['grid']))) N_microstructure = np.max(microstructure) 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) @@ -120,13 +119,13 @@ for name in filenames: try: texture = [damask.Rotation.fromQuaternion(q,True,P=+1) for q in inFile[dataset][...][1:]] # skip first entry (unindexed) 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) try: phase = [i[0] for i in inFile[dataset][...]][1:] # skip first entry (unindexed) except: - errors.append('Average phase data ({}) not found'.format(dataset)) + errors.append('Average phase data ({}) not readable'.format(dataset)) if errors != []: damask.util.croak(errors)