This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mtexdata sharp | |
| %make sure grain boundaries are not considered | |
| [grains, ebsd.grainId] = ebsd.calcGrains; | |
| % % smooth the data | |
| f = halfQuadraticFilter; | |
| ebsd = smooth(ebsd,f); | |
| % make a single phase, gridified ebsd | |
| ebsd =ebsd('c').gridify; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % lets's have some data | |
| mtexdata olivine | |
| % Let's take a crop of the data | |
| % This can also be accomplished interactively by: | |
| % plot(ebsd) | |
| % [ebsd,rec] = selectInteractive(ebsd); | |
| ebsd = ebsd(inpolygon(ebsd,[152 296 427 313])) | |
| plot(ebsd) | |
| %% calculating grains | |
| % In mtex, there are currently three different approaches to compute grains |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %% example how to compute inter-phase slip transmission (mprime) | |
| %% get some example data | |
| mtexdata forsterite | |
| %for simplicity restrict phases and fill | |
| [grains, ebsd.grainId] = ebsd.calcGrains; | |
| ebsd(grains(grains.grainSize < 50)) =[]; | |
| ebsd = fill(ebsd); | |
| [grains, ebsd.grainId] = ebsd.calcGrains; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function h = ellipse(r,a,b,varargin) | |
| % annotate an ellipse | |
| % | |
| % Input | |
| % r - @rotation specifying the ellipse position | |
| % a,b - long/short half axes of ellipse in radian | |
| % | |
| h = []; | |
| rho=(0:1:360)*degree; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [totfreq, bc, azi]=calcTDF(g,varargin) | |
| % calc circular axis/ trend distribution function of grain long axes | |
| % OR grain boundary segments or from a list of angles for axial data (0:pi) | |
| % | |
| % Syntax: | |
| % [freq,bc] = calcTDF(smoothgrains.boundary('indexed')) | |
| % or | |
| % [freq,bc] = calcTDF(smoothgrains('indexed')) | |
| % |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [pfTindex, m, pfg_max] = pfIntensity(odf,h) | |
| % calculate pfJ using S2Fun | |
| % input: | |
| % odf - odf | |
| % h - Miller | |
| % output: | |
| % pfTindex - pole figure J index | |
| % m - multiplicity (needs to be considered when comparing pfJ of different h) | |
| % pfmax - max of pf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % import demo data | |
| mtexdata forsterite | |
| % prepare some data that might look interesting | |
| [grains, ebsd.grainId, ebsd.mis2mean]=calcGrains(ebsd); | |
| ebsd=ebsd(grains(grains.grainSize>100 & grains.phase==1)); %discard all small grains and non-forsterite grains before labeling | |
| [grains, ebsd.grainId, ebsd.mis2mean]=calcGrains(ebsd,'unitcell'); | |
| % plot grains and find an interesting one | |
| om=ipfHSVKey(ebsd('f').CS,ebsd('f').CS); | |
| om.maxAngle=10*degree; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [ebsd, grains]=loadPhaseMap(varargin) | |
| % Load a phase map and create "ebsd" which can be used with some | |
| % of the avaiable tools for grain/grainboundary analysis | |
| % | |
| % Three cases are be distinguished. | |
| % | |
| % 1) Single phase,tightly packed no matrix ('single') | |
| % input: boundary map - binary image ("white" boundaries, value should be 255)! | |
| % output: ebsd with grains of distinct, nonsense orientation and notIndexed | |
| % at the boundaries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function SF = BinghamSphericalFunction(r,Z,varargin) | |
| % define a Bingham Distribution on a sphere | |
| % | |
| % Input | |
| % r - @ rotation | |
| % Z - 3-by-1 smoothing parameter with Z(1)>=Z(2)>=Z(3), Z3<0 | |
| % or diagonal matrix with Z1, Z2 ,Z3 | |
| % Z1=Z2 rotationally symmetric unimodal distribution | |
| % Z1<<Z2 (partial girdle distribution | |
| % |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % crystal shape demo | |
| % needs @crystalShape avaiable in mtex 4.5.3 | |
| % script plots a map and the user can select points where a little crystal shape | |
| % will be dispalyed -crystal will be cc according to the map | |
| mtexdata titanium | |
| [grains,ebsd.grainId]=calcGrains(ebsd,'angle',5*degree); | |
| % plot something | |
| cs=ebsd('t').CS; | |
| f=newMtexFigure; |
NewerOlder