Demo ePSproc functions:
setPolGeoms()
setADMs()
TKQarrayRotX()
Functions under development Dec. 2019.
In [1]:
import sys
# import os
# import time
import numpy as np
# For module testing, include path to module here
# modPath = r'D:\code\github\ePSproc'
modPath = r'/home/femtolab/github/ePSproc/'
sys.path.append(modPath)
import epsproc as ep
In [2]:
# Set default frame defns
RXdefault = ep.setPolGeoms()
print(RXdefault)
In [3]:
# Set some additional test geometries
pRot = [0, 0, np.pi/2, np.pi/2]
tRot = [np.pi/4, -np.pi/4, np.pi/4, 3*np.pi/4]
cRot = [0, 0, 0, 0]
labels = ['+45x', '-45x', '+45y', '+135y']
eulerAngs = np.array([pRot, tRot, cRot]).T
RX = ep.setPolGeoms(eulerAngs = eulerAngs, labels = labels)
RX
Out[3]:
In [4]:
# Set using setADMs()
# Y10 = ep.setADMs(np.array([1,0,1], ndmin=2), addS = True)
Y10 = ep.setADMs(np.array([[0,0,1],[1,0,1.3]]), addS = True)
Y10
Out[4]:
In [5]:
# Y10.copy().unstack('ADM').rename({'K':'l', 'Q':'m'}).drop('S').stack({'BLM':('l','m')})
In [6]:
# ep.sphFromBLMPlot(Y10, facetDim = 'Eke', pType='a', plotFlag = True);
ep.sphFromBLMPlot(Y10, pType='a', plotFlag = True);
In [7]:
# Rotations (z,x,y) case
Y10rot, _, _ = ep.TKQarrayRotX(Y10, RXdefault)
ep.sphFromBLMPlot(Y10rot, facetDim = 'Euler', pType='a', plotFlag = True);
In [8]:
# Use lmPlot() with Euler groups
ep.lmPlot(Y10rot, plotDims = ('K','Q','S','t'), xDim = 'Labels', pType = 'r');
In [9]:
# Rotations +/-45 deg cases
Y10rot, _, _ = ep.TKQarrayRotX(Y10, RX)
ep.sphFromBLMPlot(Y10rot, facetDim = 'Euler', pType='a', plotFlag = True);
In [10]:
# Tabulate with Pandas, by label
# Replace null terms with Nans and remove
# Y10rotpd = Y10rot.drop('Euler').swap_dims({'Euler':'Labels'}).unstack().stack(plotDim = ('Labels','K','Q','S')).to_pandas().replace(0,np.nan).dropna(axis = 1).T
# Alternatively, drop by gt comparison & indexing
Y10rotpd = Y10rot.drop('Euler').swap_dims({'Euler':'Labels'}).unstack().stack(plotDim = ('Labels','K','Q','S')).to_pandas().T
Y10rotpd = Y10rotpd[Y10rotpd.abs().gt(1e-2)].dropna()
Y10rotpd
Out[10]:
In [11]:
# Use lmPlot() with Euler groups
ep.lmPlot(Y10rot, plotDims = ('K','Q','S','t'), xDim = 'Labels', pType = 'r');
In [12]:
Ysum = ep.blmXarray(np.array([[1,0,1],[2,0,0.3]]), 1)
Ysum
Out[12]:
In [13]:
ep.sphFromBLMPlot(Ysum, facetDim = 'Eke', pType='a', plotFlag = True);
In [14]:
# Rotations (z,x,y) case
Ysumrot, _, _ = ep.TKQarrayRotX(Ysum, RXdefault)
ep.sphFromBLMPlot(Ysumrot, facetDim = 'Euler', pType='a', plotFlag = True);