5. Function overview¶
Here we presente the function associated with the class aita
5.1. loadData_aita¶
-
AITAToolbox.loadData_aita.aita3col(data_adress, im_adress, micro_adress=0)[source]¶ Function to open data from AITA analyser using ‘cistodat’ which give output file with 3 column azi,col,qua) Require to load an image file to get the image dimension nx, ny
5.2. aita¶
Created on 3 juil. 2015 Toolbox for data obtained using G50 Automatique Ice Texture Analyser (AITA) provide by : Russell-Head, D.S., Wilson, C., 2001. Automated fabric analyser system for quartz and ice. J. Glaciol. 24, 117–130
@author: Thomas Chauve @contact: thomas.chauve@univ-grenoble-alpes.fr @license: CC-BY-CC
-
class
AITAToolbox.aita.aita(phi1_field, phi_field, qua_field, micro_field, resolution=1)[source]¶ -
class
aita¶
“aita” is a python class to analyse output from G50-AITA analyser. It provide an environnement to plot data, to create inpur for CraFT code,…
-
__init__(phi1_field, phi_field, qua_field, micro_field, resolution=1)[source]¶ - Parameters
phi1_field – Euler angle phi1 map
phi_field – Euler angle phi map
qua_field – quality facteur map
resolution – spatial step size (mm); default = 1 mm
micro_field – microstructure (0 background, 1 grain boundary)
:type phi1_field np.array :type phi_field np.array :type qua_field: np.array :type resolution: float :type micro_adress: np.array
- Returns
aita object output
- Return type
Note
Bunge Euler Angle convention is used (phi1,phi,phi2) ,phi2 is not compute as during optical measurement phi2 is not know.
-
__weakref__¶ list of weak references to the object (if defined)
-
craft(nameId)[source]¶ Create the inputs for craft
- Parameters
nameId (str) – name of the prefixe used for craft files
- Returns
create file : nameId_micro.vtk, nameId.phase, nameId.in, nameId.load, nameId.output
- Exemple
>>> data.craft('manip01')
Note
nameId.load, nameId.output need to be rewrite to get a correct loading and the output wanted
Note
nameId.in need to be adapt depending of your folder structure used for craft
Note
NaN orientation value are removed by the closest orientation
-
crop(xmin=0, xmax=0, ymin=0, ymax=0, new=False)[source]¶ Crop function to select the area of interest
- Returns
crop aita object
- Return type
- Exemple
>>> data.crop()
Note
clic on the top left corner and bottom right corner to select the area
-
fliplr()[source]¶ Applied an horizontal miror to the data
- Returns
aita object with an horizontal miror
- Return type
- Exemple
>>> data.fliplr()
-
grelon(posc=array([0, 0]))[source]¶ Compute the angle between the directions defined by the “center” and the pixel with the c-axis direction
- Returns
angle (degree)
- Return type
im2d.image2d
-
interactive_crop(new=False)[source]¶ out=data_aita.interactive_crop()
This function can be use to crop within a jupyter notebook It will crop the data and export the value of the crop in out.pos
- Parameters
new (bool) – create a new data variable (default:False; erase input data)
Note
If you use new=True (out=interactive_crop(new=true)) you can find the cropped data in out.crop_data
Note
The position of the rectangle used for the cropping is in out.pos
-
interactive_misorientation_profile()[source]¶ Interactive misorientation profile for jupyter notebook
-
interactive_segmentation(val_scharr_init=1.5, use_scharr_init=True, val_canny_init=1.5, use_canny_init=True, val_qua_init=60, use_qua_init=False, inc_border_init=False, mask=False)[source]¶ This function allow you to performed grain segmentation on aita data. The intitial value of the segmenation function can be set-up initially
- Parameters
val_scharr_init (float) – scharr filter usually between 0 and 10 (default : 1.5)
use_scharr_init (bool) – use scharr filter
val_canny_init (float) – canny filter usually between 0 and 10 (default : 1.5)
use_canny_init (bool) – use canny filter
val_qua_init (int) – quality filter usually between 0 and 100 (default : 60)
use_qua_init (bool) – use quality filter
inc_border_init (bool) – add image border to grain boundaries
Note
on data with holes such as snow, using quality filter is not recommended
-
mask(mask)[source]¶ Applied mask on aita data
- Parameters
mask (im2d.mask2d) –
- Returns
aita object with the mask applied
- Return type
-
mean_grain()[source]¶ Compute the mean orientation inside the grain
- Returns
data with only one orientation per grains, the mean orientation
- Return type
- Exemple
>>> data.mean_orientation()
-
mesh(name, resGB=1, resInG=5, DistMin=5)[source]¶ Create mesh in vtk format resInG _______
/
/
/ |
/
- resGB ________/ |
DistMin
-
misorientation(random=False, filter_angle=0.017453292519943295)[source]¶ Compute the misorientation with the neighbouring grain :param random: suffle the image and compute the angle :type random: bool :param filter_angle: threshold angle for removing small value in radians (default : pi/180) :type filter_angle: float
-
misorientation_profile(ploton=True, plot='all', orientation=False)[source]¶ Compute the misorientation profile along a line
- Parameters
plot (str) – option for to misorientation profile plot, ‘all’ (default), ‘mis2o’, ‘mis2p’
orientation (bool) – option for the color code used for the map, False (default) use phi1 and True use colorwheel (take time)
pos (array) – coordinate of the profile line - 0 (default) click on the map to select the 2 points
- Returns
x - coordinate along the line
- Return type
array, float
- Returns
mis2o,mis2p - misorientation angle to the origin, and misorientation angle to the previous pixel
- Return type
array, float
- Returns
h - matplotlib image with line draw on the orientation map, subplot with mis2o and/or mis2p profile
- Returns
pos - coordinate of the profile line
- Exemple
>>> [x,mis2o,mis2p,h,pos]=data.misorientation_profile() >>> rpos = pos[::-1] >>> [x,mis2o,mis2p,hr,pos]=data.misorientation_profile(pos=rpos) >>> plt.show()
-
plot(nlut=512, semi=False)[source]¶ Plot the data using a 2d lut
- Parameters
nlut (int) – number of pixel tou want for the 2d LUT (default 512)
- Returns
figure of orientation mapping
- Return type
matplotlib figure
- Exemple
>>> data.plot() >>> plt.show() >>> # print the associated color wheel >>> lut=lut() >>> plt.show()
Note
It takes time to build the colormap
-
plotpdf(peigen=True, grainlist=[], nbp=10000, contourf=True, cm2=<matplotlib.colors.ListedColormap object>, bw=0.1, projz=1, angle=array([30., 60.]), cline=15, n_jobs=-1)[source]¶ Plot pole figure for c-axis (0001)
- Parameters
peigen (bool) – Plot the eigenvalues and eigenvectors on the pole figure (default = False)
grainlist (list) – give the list of the grainId you want to plot
nbp (int) – number of pixel plotted
contourf (bool) – Do you want to add contouring to your pole figure ? (Default : False)
cm2 (cm) – colorbar (default : cm.viridis)
bw (float) – bandwidth to compute kernel density (default : 0.1) bw=0 mean find the best fit between 0.01 and 1
projz (int) – 0 or 1. It choose the type of projection. 0 (1) means projection in the plane z=0 (1).
angle (np.array) – plot circle for this angle value (default : np.array([30.,60.])) 0 if you don’t want inner circle.
cline (int) – Number of line in contourf (default 15) Used only when contourf=True.
n_jobs (int) – number of job in parellel (CPU). Only use when bw=0 (best fit) (default : -1 mean all processor)
- Returns
pole figure image
- Return type
matplotlib figure
- Returns
eigenvalue
- Return type
- Exemple
>>> eigenvalue = data.plotpdf(peigen=True)
-
project_end2init(self_e, image, mask=0, min_win=20, apply_morph=True)[source]¶ Project the final microstructure on the initial microstrucure :param self_e: final AITA :type self_e: aita :param image: Binairy image to project instead of final microstructure. :type image: im2d.image2d :return: image projected on aita initial :rtype: im2d.image2d
Note
It works better if you pass aita with mean_grain function applied before.
-
rectangular_mask()[source]¶ out=data_aita.mask()
This function can be use to crop within a jupyter notebook It will crop the data and export the value of the crop in out.pos
- Parameters
new (bool) – create a new data variable (default:False; erase input data)
Note
If you use new=True (out=interactive_crop(new=true)) you can find the cropped data in out.crop_data
Note
The position of the rectangle used for the cropping is in out.pos
-
class
-
AITAToolbox.aita.cart2pol(x, y)[source]¶ Convert cartesien coordinate x,y into polar coordinate rho, theta
-
AITAToolbox.aita.euler2azi(phi1, phi)[source]¶ Convert Euler angle to azimuth and colatitude :param phi1: :type phi1: array :param phi: :type phi: array :return: azi :rtype: array :return: col :rtype: array
-
AITAToolbox.aita.isInsideTriangle(P, p1, p2, p3)[source]¶ test if P is inside the triangle define by p1 p2 p3
- Parameters
P (array) – point you want test
p1 (array) – one submit of the triangle
p2 (array) – one submit of the triangle
p3 (array) – one submit of the triangle
- Returns
isIn
- Return type
- Exemple
>>> isInsideTriangle([0,0],[-1,0],[0,1],[1,0]) >>> isInsideTriangle([0,-0.1],[-1,0],[0,1],[1,0])