<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Transpressional deformation
Step1:  Here we will examine strain evolution during transpression deformation. Transpression (Sanderson and Marchini, 1984) is considered as a wrench or transcurrent shear accompanied by horizontal shortening across, and vertical lengthening along, the shear plane.
<img width="65%" src="images/trasnpression.png">
Velocity gradient associated with transpressional deformation is defined as
Step2:  Here we define some constants including bulk strain rate.
Step3:  We define 2D arrays of angles and times to be examined...
Step4:  and l;oop over to calculate symmetry and intensity for each combination
Step5:  Now we can plot results.
<ASSISTANT_TASK:>
Python Code:
%pylab inline
from scipy import linalg as la
Explanation: Transpressional deformation
End of explanation
def KDparams(F):
    u, s, v = svd(F)
    Rxy = s[0]/s[1]
    Ryz = s[1]/s[2]
    K = (Rxy-1)/(Ryz-1)
    D = sqrt((Rxy-1)**2 + (Ryz-1)**2)
    return K, D
Explanation: Here we will examine strain evolution during transpression deformation. Transpression (Sanderson and Marchini, 1984) is considered as a wrench or transcurrent shear accompanied by horizontal shortening across, and vertical lengthening along, the shear plane.
<img width="65%" src="images/trasnpression.png">
Velocity gradient associated with transpressional deformation is defined as: $ \mathbf{L} = \begin{bmatrix} 0 & \dot{\gamma} & 0 \ 0 & -\dot{\varepsilon} & 0 \ 0 & 0 & \dot{\varepsilon} \end{bmatrix} $, where $\dot{\gamma}$ and $\dot{\varepsilon}$ are components of bulk strain rate in direction of convergence.
At first, we will define function to calculate symmetry and intensity of deformation from defoirmation gradient.
End of explanation
yearsec = 365.25*24*3600
sr = 3e-15
Explanation: Here we define some constants including bulk strain rate.
End of explanation
times = linspace(0.00000001,10,20)
alphas = linspace(0,90,20)
time, alpha = meshgrid(times, alphas)
K = zeros_like(alpha)
D = zeros_like(alpha)
Explanation: We define 2D arrays of angles and times to be examined...
End of explanation
for (r,c) in np.ndindex(alpha.shape):
    a = deg2rad(alpha[r,c])
    t = time[r,c]*1e6*yearsec
    edot = sr*sin(a)
    gdot = sr*cos(a)
    L = array([[0, gdot, 0], [0, -edot, 0],[0, 0, edot]])
    F = la.expm(L*t)
    K[r,c], D[r,c] = KDparams(F)
    
Explanation: and l;oop over to calculate symmetry and intensity for each combination
End of explanation
contourf(time, alpha, K, linspace(0, 1, 11))
colorbar()
contourf(time, alpha, D, linspace(0, 2.5, 11))
colorbar()
from IPython.core.display import HTML
def css_styling():
    styles = open("./css/sg2.css", "r").read()
    return HTML(styles)
css_styling()
Explanation: Now we can plot results.
End of explanation
<END_TASK>