reshape "matrix" input data from (currently wrong) 9x1 to 3x3 layout.

simplified input validity check.
This commit is contained in:
Philip Eisenlohr 2014-08-21 16:14:06 +00:00
parent 0bcd508298
commit 96b16dd97b
1 changed files with 10 additions and 10 deletions

View File

@ -52,25 +52,24 @@ datainfo = {
'label':[]}, 'label':[]},
} }
input = []
if options.eulers != None: if options.eulers != None:
datainfo['vector']['label'] += [options.eulers] datainfo['vector']['label'] += [options.eulers]
input = 'eulers' input += ['eulers']
if options.a != None and \ if options.a != None and \
options.b != None and \ options.b != None and \
options.c != None: options.c != None:
datainfo['vector']['label'] += [options.a,options.b,options.c] datainfo['vector']['label'] += [options.a,options.b,options.c]
input = 'frame' input += ['frame']
if options.matrix != None: if options.matrix != None:
datainfo['tensor']['label'] += [options.matrix] datainfo['tensor']['label'] += [options.matrix]
input = 'matrix' input += ['matrix']
if options.quaternion != None: if options.quaternion != None:
datainfo['quaternion']['label'] += [options.quaternion] datainfo['quaternion']['label'] += [options.quaternion]
input = 'quaternion' input += ['quaternion']
inputGiven = 0 if len(input) != 1: parser.error('needs exactly one input format...')
for datatype,info in datainfo.items(): input = input[0]
inputGiven += len(info['label'])
if inputGiven != 1: parser.error('select exactly one input format...')
toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians
pole = np.array(options.pole) pole = np.array(options.pole)
@ -99,7 +98,7 @@ for file in files:
for datatype,info in datainfo.items(): for datatype,info in datainfo.items():
for label in info['label']: for label in info['label']:
key = '1_%s'%label key = '1_'+label
if key not in table.labels: if key not in table.labels:
file['croak'].write('column %s not found...\n'%key) file['croak'].write('column %s not found...\n'%key)
missingColumns = True # break if label not found missingColumns = True # break if label not found
@ -124,7 +123,8 @@ for file in files:
elif input == 'matrix': elif input == 'matrix':
o = damask.Orientation(matrix=\ o = damask.Orientation(matrix=\
np.array([map(float,table.data[column[options.matrix]:\ np.array([map(float,table.data[column[options.matrix]:\
column[options.matrix]+datainfo['tensor']['len']])]), column[options.matrix]+datainfo['tensor']['len']])]).reshape(np.sqrt(datainfo['tensor']['len']),
np.sqrt(datainfo['tensor']['len'])).transpose(),
symmetry=options.symmetry).reduced() symmetry=options.symmetry).reduced()
elif input == 'frame': elif input == 'frame':
o = damask.Orientation(matrix=\ o = damask.Orientation(matrix=\