Create input for CraFT

Warning

This notebook should be remove as it is specific for our use case. I don’t know how to deal with it. Therefore the same question is ask for the function within the notebook

This notebook show how to create input for CraFT.

import xarrayaita.loadData_aita as lda #here are some function to build xarrayaita structure
import xarrayaita.aita as xa
import xarrayuvecs.uvecs as xu
import xarrayuvecs.lut2d as lut2d

import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np

import datetime
from skimage import morphology
from tqdm.notebook import tqdm
import scipy

%matplotlib widget

Load your data

# path to data and microstructure
path_data='orientation_test.dat'
path_micro='micro_test.bmp'
data=lda.aita5col(path_data,path_micro)
data
<xarray.Dataset>
Dimensions:      (uvecs: 2, x: 1000, y: 2500)
Coordinates:
  * x            (x) float64 0.0 0.02 0.04 0.06 0.08 ... 19.92 19.94 19.96 19.98
  * y            (y) float64 49.98 49.96 49.94 49.92 49.9 ... 0.06 0.04 0.02 0.0
Dimensions without coordinates: uvecs
Data variables:
    orientation  (y, x, uvecs) float64 2.395 0.6451 5.377 ... 0.6098 0.6473
    quality      (y, x) int64 0 90 92 93 92 92 94 94 ... 96 96 96 96 96 97 97 96
    micro        (y, x) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0
    grainId      (y, x) int64 1 1 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1 1 1
Attributes:
    date:       Thursday, 19 Nov 2015, 11:24 am
    unit:       millimeters
    step_size:  0.02
    path_dat:   orientation_test.dat

CraFTWith G50 fabric analyser we usually filter the value with a quality below \(75\).

data.aita.filter(50)

Export input file for CraFT

Two files are creating using this function :

  1. The .vtk of the microstructure where the each pixel of the same grain as the same integer value.

  2. A .phase that is a text file where the orientation value are stored \([grainId, material, \phi_1, \phi, \phi_2]\). \(\phi_2\) is choosen randomly as it is unknown. If \(\phi_1, \phi\) are note resolved by the analyser they are also choosen randomly.

data.aita.craft('granular',res=0.5)
/home/chauvet/miniconda3/envs/basepy38/lib/python3.8/site-packages/xarray/core/computation.py:724: RuntimeWarning: invalid value encountered in remainder
  result_data = func(*input_data)