Merge branch 'development' of magit1.mpie.de:damask/DAMASK into development
This commit is contained in:
commit
4f683d1974
|
@ -1,8 +1,6 @@
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
# -*- coding: UTF-8 no BOM -*-
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
#import sys
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import h5py
|
import h5py
|
||||||
|
@ -19,19 +17,19 @@ class Result():
|
||||||
def __init__(self,resultsFile):
|
def __init__(self,resultsFile):
|
||||||
self.data=h5py.File(resultsFile,"r")
|
self.data=h5py.File(resultsFile,"r")
|
||||||
self.Npoints=self.data.attrs['Number of Materialpoints']
|
self.Npoints=self.data.attrs['Number of Materialpoints']
|
||||||
print("Opened "+resultsFile+" with %i points"%self.Npoints)
|
print("Opened {} with {} points".format(resultsFile,self.Npoints))
|
||||||
|
|
||||||
def getCrystallite(self,labels,inc,constituent=1,points=None):
|
def getCrystallite(self,labels,inc,constituent=1,points=None):
|
||||||
if points is None: points = np.array(np.array(xrange(self.Npoints)))
|
if points is None: points = np.array(np.array(range(self.Npoints)))
|
||||||
results = {}
|
results = {}
|
||||||
mapping=self.data['mapping/crystallite']
|
mapping=self.data['mapping/crystallite']
|
||||||
for instance in self.data['increments/%s/crystallite/'%inc]:
|
for instance in self.data['increments/%s/crystallite/'%inc]:
|
||||||
dsets = self.data['increments/%s/crystallite/%s'%(inc,instance)].keys()
|
dsets = list(self.data['increments/%s/crystallite/%s'%(inc,instance)].keys())
|
||||||
for label in labels:
|
for label in labels:
|
||||||
if label in dsets and label not in results:
|
if label in dsets and label not in results:
|
||||||
shape = np.shape(self.data['increments/%s/crystallite/%s/%s'%(inc,instance,label)])[1:]
|
shape = np.shape(self.data['increments/%s/crystallite/%s/%s'%(inc,instance,label)])[1:]
|
||||||
results[label] = np.nan*np.ones(np.array((self.Npoints,)+shape))
|
results[label] = np.nan*np.ones(np.array((self.Npoints,)+shape))
|
||||||
for myPoint in xrange(len(points)):
|
for myPoint in range(len(points)):
|
||||||
matPoint = points[myPoint]
|
matPoint = points[myPoint]
|
||||||
pos = mapping[matPoint,constituent-1]
|
pos = mapping[matPoint,constituent-1]
|
||||||
if pos[0] != 0:
|
if pos[0] != 0:
|
||||||
|
@ -41,5 +39,3 @@ class Result():
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue