MechMicroMan / DefDAP

A python library for correlating EBSD and HRDIC data
Apache License 2.0
35 stars 16 forks source link

plotting the Schmid factor map for a dual phase EBSD data using `EbsdMap.plotAverageGrainSchmidFactorsMap()` #106

Closed dongchenhu closed 12 months ago

dongchenhu commented 1 year ago

The way to figure out the slip system with the highest Schmid factor, np.max worked for fcc fine as it is 4 by 3. However, for hcp and bcc the schmid factors were saved differently. For example, in HCP it is 3 by 1 and the 9 prismatic planes with only one burger (1 by 9), the schmid factors were saved as [[a,a,a],[a],[a],...,[a]]. In this case, np.max(,axis=1) won't work. see below:

---------------------------------------------------------------------------
AxisError                                 Traceback (most recent call last)
<ipython-input-17-eedd9d5af645> in <module>
----> 1 EbsdMap.plotAverageGrainSchmidFactorsMap(plotGBs=True, boundaryColour='black', dilateBoundaries=3, plotScaleBar=True)

C:\ProgramData\Anaconda3\lib\site-packages\defdap\ebsd.py in plotAverageGrainSchmidFactorsMap(self, planes, directions, **kwargs)
   1263 
   1264         grains_sf = np.array(grains_sf)
-> 1265         grains_sf_max = np.max(grains_sf, axis=1)
   1266 
   1267         plot = self.plotGrainDataMap(grainData=grains_sf_max, bg=0.5,

<__array_function__ internals> in amax(*args, **kwargs)

C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py in amax(a, axis, out, keepdims, initial, where)
   2731     5
   2732     """
-> 2733     return _wrapreduction(a, np.maximum, 'max', axis, None, out,
   2734                           keepdims=keepdims, initial=initial, where=where)
   2735 

C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
     85                 return reduction(axis=axis, out=out, **passkwargs)
     86 
---> 87     return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
     88 
     89 

AxisError: axis 1 is out of bounds for array of dimension 1