Quick start

Warning

It is currently under devellopement. Please contact me before using it.

Load CraFT output

import xarrayaita.aita as xa
import xarrayuvecs.uvecs as xu
import xarray_craft.loadData_craft as ldc
import xarray_symTensor2d.xarray_symTensor2d as xsT
import xarray_craft.gamma as xg
import xarray_craft.craft as xc

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
adr='/home/chauvet/Documents/GitToolboxs/pyCraFT/Exemple/data/'
time='09.20000000e+04'
ds=ldc.craft1time_2d(adr,time)
ds
<xarray.Dataset>
Dimensions:      (g: 12, sT: 6, time: 1, uvecs: 2, x: 495, y: 539)
Coordinates:
  * x            (x) float64 0.0 0.15 0.3 0.45 0.6 ... 73.65 73.8 73.95 74.1
  * y            (y) float64 0.0 0.15 0.3 0.45 0.6 ... 80.25 80.4 80.55 80.7
Dimensions without coordinates: g, sT, time, uvecs
Data variables:
    orientation  (y, x, uvecs) float64 5.112 1.017 5.112 ... 1.14 3.454 1.14
    quality      (y, x) float64 100.0 100.0 100.0 100.0 ... 100.0 100.0 100.0
    micro        (y, x) bool True True True True True ... True True True True
    grainId      (y, x) float32 74.0 74.0 74.0 74.0 74.0 ... 11.0 11.0 11.0 11.0
    strain       (time, y, x, sT) float64 0.003301 -0.005215 ... 0.0006602
    stress       (time, y, x, sT) float64 1.274 0.5916 0.6825 ... -0.1443 0.2065
    gamma        (time, y, x, g) float64 0.004711 -0.007798 ... -5.391e-08
Attributes:
    unit:       millimeters
    step_size:  0.15
    path_dat:   /home/chauvet/Documents/GitToolboxs/pyCraFT/Exemple/data/CI02...
    simu_time:  09.20000000e+04
ds['eqStrain']=ds.strain.sT.eqVonMises()
ds['eqStress']=ds.stress.sT.eqVonMises()
plt.figure(figsize=(20,10))
plt.subplot(121)
ds.eqStrain.plot()
plt.axis('equal')
plt.title('equivalent strain')
plt.subplot(122)
ds.eqStress.plot()
plt.axis('equal')
plt.title('equivalent stress')
Text(0.5, 1.0, 'equivalent stress')
../_images/Quick_Start_7_1.png
ds
<xarray.Dataset>
Dimensions:      (g: 12, sT: 6, time: 1, uvecs: 2, x: 495, y: 539)
Coordinates:
  * x            (x) float64 0.0 0.15 0.3 0.45 0.6 ... 73.65 73.8 73.95 74.1
  * y            (y) float64 0.0 0.15 0.3 0.45 0.6 ... 80.25 80.4 80.55 80.7
Dimensions without coordinates: g, sT, time, uvecs
Data variables:
    orientation  (y, x, uvecs) float64 5.112 1.017 5.112 ... 1.14 3.454 1.14
    quality      (y, x) float64 100.0 100.0 100.0 100.0 ... 100.0 100.0 100.0
    micro        (y, x) bool True True True True True ... True True True True
    grainId      (y, x) float32 74.0 74.0 74.0 74.0 74.0 ... 11.0 11.0 11.0 11.0
    strain       (time, y, x, sT) float64 0.003301 -0.005215 ... 0.0006602
    stress       (time, y, x, sT) float64 1.274 0.5916 0.6825 ... -0.1443 0.2065
    gamma        (time, y, x, g) float64 0.004711 -0.007798 ... -5.391e-08
    eqStrain     (time, y, x) float64 0.005463 0.007155 ... 0.00312 0.002566
    eqStress     (time, y, x) float64 1.121 1.095 1.153 ... 0.4573 0.3392 0.3612
Attributes:
    unit:       millimeters
    step_size:  0.15
    path_dat:   /home/chauvet/Documents/GitToolboxs/pyCraFT/Exemple/data/CI02...
    simu_time:  09.20000000e+04
ds['strain_energy']=ds.craft.strain_energy()
plt.figure(figsize=(10,10))
ds.strain_energy.plot()
plt.axis('equal')
(-0.075, 74.17499999999998, -0.075, 80.775)
../_images/Quick_Start_10_1.png
ds['nba_ac']=ds.gamma.gamma.gamma_activity(plane='ba')
ds['npr_ac']=ds.gamma.gamma.gamma_activity(plane='pr')
ds['npy_ac']=ds.gamma.gamma.gamma_activity(plane='py')
plt.figure(figsize=(20,7))
plt.subplot(131)
ds.nba_ac.plot(vmin=0,vmax=1)
plt.axis('equal')
plt.title('basal activity')
plt.subplot(132)
ds.npr_ac.plot(vmin=0,vmax=1)
plt.axis('equal')
plt.title('prismatic activity')
plt.subplot(133)
ds.npy_ac.plot(vmin=0,vmax=1)
plt.axis('equal')
plt.title('pyramidal activity')
Text(0.5, 1.0, 'pyramidal activity')
../_images/Quick_Start_12_1.png
ds['ba_ac']=ds.gamma.gamma.gamma_activity(plane='ba',norm=False)
ds['pr_ac']=ds.gamma.gamma.gamma_activity(plane='pr',norm=False)
ds['py_ac']=ds.gamma.gamma.gamma_activity(plane='py',norm=False)
plt.figure(figsize=(20,7))
plt.subplot(131)
ds.ba_ac.plot()
plt.axis('equal')
plt.title('basal activity')
plt.subplot(132)
ds.pr_ac.plot()
plt.axis('equal')
plt.title('prismatic activity')
plt.subplot(133)
ds.py_ac.plot()
plt.axis('equal')
plt.title('pyramidal activity')
Text(0.5, 1.0, 'pyramidal activity')
../_images/Quick_Start_14_1.png
ds['dist2GB']=ds.aita.dist2GB()
plt.figure(figsize=(10,10))
ds.dist2GB.plot()
plt.axis('equal')
(-0.075, 74.17499999999998, -0.075, 80.775)
../_images/Quick_Start_16_1.png
ds['dist2TJ']=ds.aita.dist2TJ()
plt.figure(figsize=(10,10))
ds.dist2TJ.plot()
plt.axis('equal')
(-0.075, 74.17499999999998, -0.075, 80.775)
../_images/Quick_Start_18_1.png
ds
<xarray.Dataset>
Dimensions:        (g: 12, sT: 6, time: 1, uvecs: 2, x: 495, y: 539)
Coordinates:
  * x              (x) float64 0.0 0.15 0.3 0.45 0.6 ... 73.65 73.8 73.95 74.1
  * y              (y) float64 0.0 0.15 0.3 0.45 0.6 ... 80.25 80.4 80.55 80.7
Dimensions without coordinates: g, sT, time, uvecs
Data variables: (12/18)
    orientation    (y, x, uvecs) float64 5.112 1.017 5.112 ... 1.14 3.454 1.14
    quality        (y, x) float64 100.0 100.0 100.0 100.0 ... 100.0 100.0 100.0
    micro          (y, x) bool True True True True True ... True True True True
    grainId        (y, x) float32 74.0 74.0 74.0 74.0 ... 11.0 11.0 11.0 11.0
    strain         (time, y, x, sT) float64 0.003301 -0.005215 ... 0.0006602
    stress         (time, y, x, sT) float64 1.274 0.5916 ... -0.1443 0.2065
    ...             ...
    npy_ac         (time, y, x) float128 6.92e-06 1.029e-06 ... 4.254e-08
    ba_ac          (time, y, x) float128 8.428e-05 0.0001343 ... 1.403e-05
    pr_ac          (time, y, x) float128 5.951e-06 2.098e-05 ... 6.385e-06
    py_ac          (time, y, x) float128 6.244e-10 1.598e-10 ... 8.686e-13
    dist2GB        (y, x) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0
    dist2TJ        (y, x) float64 1.0 0.0 1.0 2.0 3.0 ... 3.0 2.0 1.0 0.0 1.0
Attributes:
    unit:       millimeters
    step_size:  0.15
    path_dat:   /home/chauvet/Documents/GitToolboxs/pyCraFT/Exemple/data/CI02...
    simu_time:  09.20000000e+04
ds['schmid']=ds.orientation.uvecs.calc_schmid(np.array([0,1,0]))
plt.figure(figsize=(10,10))
ds.schmid.plot()
plt.axis('equal')
(-0.075, 74.17499999999998, -0.075, 80.775)
../_images/Quick_Start_21_1.png
ds['schmid_cOGv']=ds.aita.closest_outG_value(ds.schmid)
plt.figure(figsize=(10,10))
ds.schmid_cOGv.plot()
plt.axis('equal')
(-0.075, 74.17499999999998, -0.075, 80.775)
../_images/Quick_Start_23_1.png
ds['orientation_cOGv']=ds.aita.closest_outG_value(ds.orientation)
ds['cmap_semi_cDGv']=ds.orientation_cOGv.uvecs.calc_colormap(semi=True)
plt.figure(figsize=(10,10))
ds.cmap_semi_cDGv.plot.imshow()
plt.axis('equal')
(-0.075, 74.175, -0.075, 80.775)
../_images/Quick_Start_26_1.png
ds['inner_angle_cDGv']=ds.orientation.uvecs.inner_angle(ds.orientation_cOGv)
plt.figure(figsize=(10,10))
ds.inner_angle_cDGv.plot()
plt.axis('equal')
(-0.075, 74.17499999999998, -0.075, 80.775)
../_images/Quick_Start_28_1.png