Git Product home page Git Product logo

mtex-toolbox / mtex Goto Github PK

View Code? Open in Web Editor NEW
277.0 46.0 182.0 91.65 MB

MTEX is a free Matlab toolbox for quantitative texture analysis. Homepage:

Home Page: http://mtex-toolbox.github.io/

License: GNU General Public License v2.0

MATLAB 88.73% Mercury 0.01% M 0.08% Python 0.09% AGS Script 3.90% OpenEdge ABL 0.01% Objective-C 0.05% Shell 0.01% C 3.82% C++ 3.33%
matlab mtex ebsd texture-analysis crystallography orientation-maps xrd pole-figures

mtex's People

Contributors

aditya-shukl avatar azdiargazder avatar bjajac avatar bjoerneske avatar davidmainprice avatar djm87 avatar doriandepriester avatar famb avatar felixbartel avatar filippeof avatar fjangfaragesh avatar frankniessen avatar gcapes avatar gnolze avatar hakonanes avatar jhiscocks avatar kellertuer avatar kilir avatar laura1110 avatar lfgmorales avatar michaelquellmalz avatar num3rik avatar nyyssont avatar ppinard avatar ralfhielscher avatar tijmenvermeij avatar timmitohnetim avatar tori-miller avatar vtvivian avatar yuchung-chuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mtex's Issues

Question u = h.uvw with h as Miller gives u as double variable not Miller

Question u = h.uvw with h as Miller gives u as double variable not Miller

h = Miller (show methods, plot)
 size: 1 x 1
 mineral: An100 (-1, X||a*, Z||c)
  h 1
  k 1
  l 1
u = h.uvw
u = 0.0238    0.0070    0.0113

How do convert u to Miller?

Miller(u,CS)
Error using Miller (line 106)
You need at least 3 Miller indice!
% only solution seems to be for an integer result
round(Miller(u(1),u(2),u(3),CS,'uvw'))
ans = Miller (show methods, plot)
 size: 1 x 1
 mineral: An100 (-1, X||a*, Z||c)
  u 9
  v 3
  w 4

all the best David

Internal grain boundaries

Hey

Does the internal grain boundaies are include in MTEX or not yet.

Because in the doc, it write :

Subboundaries
Another special type of boundaries, are boundaries that are located within a grain, nevertheless this happens, if two adjacent measurements are somehow conneted by a lattice rotation within a grain.

plot(grains.boundary,'external')
hold on
plot(grains.boundary,'internal','linecolor','r','linewidth',2)

because for me it doesn't seem to work. I using matlab2013a and MTEX4.0.9

Thanks for all
and merry christmas and happy new year

Thomas

Problems with the marker dimension and plot merging

Dear Ralf,
about the plotting procedure by EBSD open wizard, if you choose orientation from the fifth onwards,, the marker on the figure is not correct (see image).
i

Moreover, the merging process works very good, but you choose (by for instance the wizard process) some phase in your library, e.g. Iron, this is the message error (after a warning):

[grains,ebsd.grainId] = calcGrains(ebsd('indexed'),'angle',2_degree)
gB = grains.boundary('Iron','Iron')
gB3 = gB(gB.isTwinning(CSL(3),5_degree));
[mergedGrains,parentIds] = merge(grains,gB3);
plot(gB3,'lineColor','g','linewidth',2,'DisplayName','CSL 3');

  • Attempted to access limits(5); index out of bounds because numel(limits)=2.
  • Error in axis>LocSetTight1 (line 287)
  • hasdepth = limits(5) ~= limits(6);
  • Error in axis>LocSetTight (line 273)
  •     LocSetTight1(ax)
    
  • Error in axis (line 102)
  •             LocSetTight(ax(j));
    
  • Error in grainBoundary/plot (line 92)

Thank you very much

Regards

RicCNR

Roadmap

I will keep the list updated with the further deveopment of MTEX. You may add any wishes you have.

  • more slip transmission parameters
  • better support for hex grid - #282
  • interpolation of scattered EBSD maps
  • recrystalization
  • image registration - low
  • a class representing spherical functions, to be returned by ODF/calcPDF, tensors, axisDistributions, etc. - see https://github.com/felixbartel/mtex/tree/feature/sphFun
  • separate classes for different types of tensors, e.g. compliance, stiffness, ...
  • pole figure tensor - more information required
  • simultaneous rotation of figures
  • misorientation axis / angle plot (specimen + crystal reference frame)
  • labels for color bars
  • implement a class representing fibres
  • nearest neighbor volume computation - requires still documentation 🌵
  • special class for Miller plots - which show ipdf like data cursor in opossite to sphericalPlot
  • Miller/symmetrise and orientation/symmetrise should return only unique elements on request

Documentation

Import / Export

  • import hfd5 files
  • EBSD import wizard plots map + pole figures, clicking the plot button in the import wizard on the crystal symmetry page should plot the current phase
  • export to VPSC orientation + grain shape ellipse
  • improve import of ctf files
  • improve import of osc files: symmetry + reference frame, ask Karsten for different files

4-digit notation for tetragonal and 3-digit notation for trigonal

Dear Ralf,

issue: when plotting colorbars for rutile (tetragonal) and corundum (trigonal), planes have been assigned incorrectly

%% plot EBSD data with ipd colour code 4/mmm
oM = ipdfHSVOrientationMapping(crystalSymmetry('4/mmm'));
%oM = ipdfHSVOrientationMapping(ebsd('rutile').cs_rutile.properGroup);
figure
plot(oM)
color = oM.orientation2color(ebsd('rutile').orientations);
figure
plot(ebsd('rutile'),color)

%% plot EBSD data with ipd colour code -3m1
oM2 = ipdfHSVOrientationMapping(crystalSymmetry('-3m1'));
%oM2 = ipdfHSVOrientationMapping(ebsd('corundum').cs_corundum.properGroup);
figure
plot(oM2)
color = oM2.orientation2color(ebsd('corundum').orientations);
figure
plot(ebsd('corundum'),color)

Represent the pole figures in m.r.d.

Hi,

I recently started using mtex (version mtex-4.0.23) and I am trying to represent some pole figures normalized in multiples of a random distribution.
I managed plotting great normalized pole figures by using the function plotPDF but the error given by the function plotDiff(pf,odf) can be high for some data.

Is it possible to normalize the pole figures in mrd without going through the ODF transformation to avoid the loss of information? I tried the function normalize(pf) but the obtained pole figures have a colorbar with negative data, so I suppose it is not mrd.

My code is given below.

%% Import Script for PoleFigure Data
%
% This script was automatically created by the import wizard. You should
% run the whoole script or parts of it in order to import your data. There
% is no problem in making any changes to this script.

%% Specify Crystal and Specimen Symmetries

% crystal symmetry
CS = crystalSymmetry('2/m11', [5.2 5.2 5.36], [90,99,90]*degree, 'X||a', 'Y||b', 'Z||c*', 'color', 'light         blue');

% specimen symmetry
SS = specimenSymmetry('1');

% plotting convention
setMTEXpref('xAxisDirection','north');
setMTEXpref('zAxisDirection','outOfPlane');

%% Specify File Names

% path to files
pname = 'C:\Users\Hang Yu\Dropbox (MIT)\IPF_plot';

% which files to be imported
fname = {...
  [pname '\Stress_111.uxd'],...
  [pname '\Stress002.uxd'],...
  [pname '\Stress111.uxd'],...
  };

%% Specify Miller Indice

h = { ...
  Miller(-1, 1, 1,CS),...
  Miller(0,0,2,CS),...
  Miller(1,1,1,CS),...
  };

%% Import the Data

% create a Pole Figure variable containing the data
pf_Stress = loadPoleFigure(fname,h,CS,SS,'interface','uxd');
pf_back_Stress = correct(pf_Stress,'background',pf_Random);
odf_Stress = calcODF(pf_back_Stress);
plotPDF(odf_Stress,pf_back_Stress.h,'antipodal');
annotate([xvector,yvector,zvector],'label',{'X','Y','Z'},'BackgroundColor','w');
% plotDiff(pf_back_Stress,odf_Stress);

% pf_norm_Stress = normalize(pf_back_Stress);
% plot(pf_norm_Stress)

Pole figures from the function plotPDF
pf_fromodf_stress

Error from the transformation to ODF
error_fromodf_stress

Normalized pole figures with the function normalize
pf_norm_stress

Probleme with the scale on plot(ebsd)

Hi

I've got a probleme with the scale on the ebsd plot. I didn't get the gray rectangle as shown on the home page of the website.

By the way, it look very nice but I didn't get it. I working on Matlab R2013a with MTEX 4.0.6 on debian 7.

All the Best
Thomas

ebsd

ImportWizard: Pole figures with superposition

The superposition weights (c) are not correctly imported when entered manually using the import wizards:

a) missing in m-scripts is the line
% structure coefficients
c = {1,[0.52 ,1.23]};

b) the workspace variable pf is possible to display using plot(pf), but

odf = calcODF(pf)
------ MTEX -- PDF to ODF inversion ------------------
Error using cat
Dimensions of matrices being concatenated are not consistent.

Error in Miller/cat (line 26)
m.x = cat(dim,vx{:});

Error in vector3d/horzcat (line 4)
v = cat(2,varargin{:});

Error in PoleFigure/get.h (line 81)
h = [pf.allH{:}];

Error in PoleFigure/calcODF (line 90)
gh = symmetrise(S3G).' * pf.h; % S3G x SS x CS x h

pf.h
pf.c

ans =

[1x2 double]    [1]    [1x2 double]    [1x2 double]    [1]    [1]

Probleme with calcGrains in MTex 4.0.2

Hey
It is again me, I hope I don't bother you.

I found something that I thinks is weird but Iam not sure.
I am loading ebsd data without probleme and if a do this

grains = calcGrains(ebsd('indexed'),'angle',g_angle*degree);
oM = ipdfHSVOrientationMapping(ebsd('Ice-Ih'));

or this

[grains,ebsd.grainId, ebsd.mis2mean] = calcGrains(ebsd,'angle',g_angle*degree);
oM = ipdfHSVOrientationMapping(ebsd('Ice-Ih'));

I have no probleme but if I do this

[grains,ebsd.grainId, ebsd.mis2mean] = calcGrains(ebsd('indexed'),'angle',g_angle*degree);
oM = ipdfHSVOrientationMapping(ebsd('Ice-Ih'));

I've got this error and I don't understand why ?

Index exceeds matrix dimensions.

Error in dynProp/subSet (line 58)
        dp.prop.(fn{i}) = dp.prop.(fn{i})(ind);

Error in EBSD/subSet (line 8)
ebsd = subSet@dynProp(ebsd,ind);

Error in EBSD/subsref (line 13)
  ebsd = subSet(ebsd,ind);

Error in ebsd_CI06_triple_junction (line 42)
oM = ipdfHSVOrientationMapping(ebsd('Ice-Ih')); 

I found this weird. I hope this can help.

Thanks
Thomas

Defining your own color map in MTEX4

In MTEX 3.5 it was relatively easy to define your own color map for pole figure colorbar scales using

colormap.
For example a simple 3-color based on White (RedBlueGreen=111) to Yellow (RBG=110) to Red(RGB=100) called "very red hot metal" is very popular with some students.

In Matlab you can use

% white to yellow to red
r = [1.0 1.0 1.0]
g = [1.0 1.0 0.0]
b = [1.0 0.0 0.0]
map = [r; g; b]
colormap(map)

but this does not work too well with MTEX4 as the colors are not gradual transitions from White to Yellow to Red.

We seem to be missing some documentation in this area.

all the best David

Removing pole figure Outliers - changes data structure

Follow sequence below, my conclusion is that removing pole figure Outliers changes data structure
of pfs_expt and causes an error when using

Error_RP = calcError(pfs_expt,pfs_calc,'RP')

all the best David

Imported data looks like this

pfs_expt = PoleFigure (show methods, plot)
  crystal symmetry : Anhydrite (mmm)
  specimen symmetry: 1

  h = (111), r = 72 x 19 points
  h = (002)(020), r = 72 x 19 points
  h = (202)(220), r = 72 x 19 points
  h = (103), r = 72 x 19 points
  h = (131), r = 72 x 19 points
  h = (301), r = 72 x 19 points
  h = (133), r = 72 x 19 points
  h = (230), r = 72 x 19 points
  h = (204)(240), r = 72 x 19 points
  h = (232), r = 72 x 19 points

After the application of the short script below

%% Check for outliers (wild spikes) in pole figures
condition = pfs_expt.isOutlier;
% remove outliers
pfs_expt(condition) = [];
% plot the corrected pole figures
plot(pfs_expt)

New data structure is now

pfs_expt = PoleFigure (show methods, plot)
  crystal symmetry : Anhydrite (mmm)
  specimen symmetry: 1

  h = (111), r = 72 x 19 points
  h = (002)(020), r = 72 x 19 points
  h = (202)(220), r = 72 x 19 points
  h = (103), r = 72 x 19 points
  h = (131), r = 72 x 19 points
  h = (301), r = 1 x 1366 points
  h = (133), r = 1 x 1366 points
  h = (230), r = 72 x 19 points
  h = (204)(240), r = 1 x 1364 points
  h = (232), r = 72 x 19 points

now when applying

%% Calculate pole figure densities error using estimated ODF
pfs_calc = calcPoleFigure(odf,h,'superposition',c,'antipodal')
  h = (111), r = 72 x 19 points
  h = (002)(020), r = 72 x 19 points
  h = (202)(220), r = 72 x 19 points
  h = (103), r = 72 x 19 points
  h = (131), r = 72 x 19 points
  h = (301), r = 72 x 19 points
  h = (133), r = 72 x 19 points
  h = (230), r = 72 x 19 points
  h = (204)(240), r = 72 x 19 points
  h = (232), r = 72 x 19 points
calculate: [....................                    ]

% now using default error analysis
Error_RP = calcError(pfs_expt,pfs_calc,'RP')

Error using  * 
Inner matrix dimensions must agree.

Error in PoleFigure/calcNormalization (line 22)
  alpha(i) = sum(w(:)'*d1(:) / (w(:)'*d2(:))); %#ok<AGROW>

Error in PoleFigure/calcErrorPF (line 37)
  alpha = calcNormalization(pfmeas.select(i),pfcalc.select(i));

Error in PoleFigure/calcError (line 32)
errorpf = calcErrorPF(pf,rec,varargin{:});

Error messages

Dear Ralf,

I measured EBSD in sample which contains two phases, the Ferrite (Fe) and martensite (Ma). I attached a CTF example. I calculated my grains using the last version 4.0.17, and I want to plot gb (Fe) whose misorientation axis form angle less than 10 degrees with x axis. For this end, I used:

gb = grains.boundary('Fe','Fe');
gB= grains.boundary;
ind1 = angle(gb.misorientation.axis,xvector)<10*degree;
plot(gB)
hold on
plot(Fgb(ind1),'linecolor','b','linewidth',2)

But I get these messages:

Warning: Symmetry mismatch 
> In Miller.dot at 19
  In vector3d.angle at 12 
Warning: Symmetry mismatch 
> In Miller.dot_outer at 14
  In Miller.dot at 23
  In vector3d.angle at 12

Similarly, I get error messages when using the expression:

rot = rotation('axis',vector3d(1,1,1),'angle',60*degree);
ind2= angle(gb.misorientation,rot)<10*degree;
plot(gB)
hold on
plot(Fgb(ind2),'linewidth',1.5,'linecolor','b')

The error messages are:

Out of memory. Type HELP MEMORY for your
options.
Error in rotation/dot_outer (line 16)
  d = min(~i,abs(q1 * q2'));
Error in orientation/dot (line 62)
  d = max(abs(dot_outer(q,qcs)),[],2);
Error in orientation/angle (line 20)
  omega = real(2*acos(dot(o1,o2)));

Can you please clarify what I´m doing wrong?
Thank you for all
Eddahbi

Merge grains errors

Hi Ralf,

I’ve found a couple of small bugs in the ‘merge’ function. My code is as follows:

grains = calcGrains(ebsd,'angle',10*degree);

gb_qtz = grains.boundary('Quartz-new','Quartz-new');

rot = rotation('axis',Miller(0,0,0,1,CS{2}),'angle',60*degree);
ind = angle(gb_qtz.misorientation,rot)<2*degree; 
twinBoundary = gb_qtz(ind);

mergedGrains = merge(grains,twinBoundary);

The first error I get reads:

No public field meanRotation exists for class grain2d.

Error in grain2d/merge (line 47)
grains_merged.meanRotation = idRotation(numNewGrains,1);

Error in mergeGrainsDemo (line 69)
mergedGrains = merge(grains,twinBoundary);

Which I can disable by removing any lines containing meanRotation in the merge.m file (but then I can’t plot the IPF colours for merged grains).

The second error is when I remove some grains before merging:

grains = calcGrains(ebsd,'angle',10*degree);
grains = grains(grains.grainSize > 4);

And then the rest of the code as before. Removing small grains reduces the number of grains from 328 to 36. When running the merge function, I get this error:

Error using sparse
Index exceeds matrix dimensions.

Error in grain2d/merge (line 35)
A = sparse(mergeId(:,1),mergeId(:,2),1,length(grains),length(grains));

Error in mergeGrainsDemo (line 70)
mergedGrains = merge(grains,twinBoundary);

Any help would be great.

Thanks
Andrew

kernel density estimator

Hi Ralf,
using the function tools/math_tools/kde.m for a one-dimensional data results in an error. Example:

a=[randn(100,1)];
kde(a)
Error using  .* 
Matrix dimensions must agree.

Error in kde (line 83)
a_t = a .* exp(-(0:n-1)'.^2 * pi^2 * t_star / 2);

However, the kde function at:
https://www.mathworks.com/matlabcentral/fileexchange/14034-kde-data-n-min-max
doesn't do it.

I'm wondering if this behavior is intentional?

All the best,
Rüdiger

update: this is with mtex4.1beta4

Problem with calcGrains for indexed pixels only

There is a small bug when getting grain ID's and mis2mean using calcGrains with the ebsd('indexed') option.

The following command.....

[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd('indexed'),'angle',10*degree)

Gives.....

Index exceeds matrix dimensions.

Error in dynProp/subSet (line 58)
        dp.prop.(fn{i}) = dp.prop.(fn{i})(ind);

Error in EBSD/subSet (line 8)
ebsd = subSet@dynProp(ebsd,ind);

Error in EBSD/plot (line 65)
    color = ebsd.subSet(ind).color;

Error in MTEX4_test (line 60)
plot(ebsd)

But there is no problem with using.....

ebsd = ebsd('indexed')
[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',10*degree)

memory usage in plotODF

Hello Ralf,
plotODF consumes temporarily more than 5 GB of memory, as recorded by task manager.
This creates out of memory errors on older systems running XP.

Observed on several examples for trigonal CS (quartz), e.g.
demo pole figures in ..\data\PoleFigure\BearTex\go_2_2.XPa

Just import pole figure data and run
odf = calcODF(pf)
pause
plotODF(odf)

Are there any options which would reduce memory consumption?
Thanks, kk.

Seismic velocity underestimated in Average tensors/ set outer margin

Dear Dr. Ralf

  1. Mtex 4.0.16 seems to underestimate aggregate average seismic velocity evaluated by any of the three methods (voigt,reuss,hill). Please, find attached the figure output of mtex4.0.14 and mtex4.0.16 , for voigt method, using the same code (simmilar to mtex examples, but if you need my codes or ebsd file i can send it via e mail)

  2. Some of my plots im mtex 4.x are cutting the titles. Interactively changing outer margin to 40 (mtexmenu>Set outer margin) seems to solve the issue for me. I would like to ask how can i change it by code, something like setMTEXpref('setOuterMargin',40)?

Thanks,
Filippe

mtex4 0 14
mtex4 0 16

error with gB_Fo = grains.boundary('Fo','Fo') using MTEX data

Dear Ralf,

Here is a M-file, based on the MTEX help file, but it does not run on my computer because of the line below gB_Fo = grains.boundary('Fo','Fo')

I have tried also everything to get it run. It seems important that it runs correctly, as far as I understand it is the ONLY route correlated misorientation in MTEX4.

Where as for uncorrelated there is calcMDF and calcMisorientation both seem to ultimately use the ODF of calcMDF.
all the best David

%
% Example of grain boundary and misorientation analysis
% Based on MTEX help file
%
% MTEX 4.0.9
%
% David Mainprice 26/01/2014
%
%% Clear memory and close all plots
clear all;
close all;
%% import example data set
mtexdata forsterite
% plot X to East
plotx2east
% consider only indexed data for grain segmentation
ebsd = ebsd('indexed');
% use small angle for subboundary detection
[grains,ebsd.grainId] = calcGrains(ebsd,'angle',2*degree)
%%
gB = grains.boundary
plot(gB)

%%
plot(grains(931).boundary)
%% Misorientation
close all
gB_Fo = grains.boundary('Fo','Fo');
plot(grains,'translucent',.3)
legend off
hold on
plot(gB_Fo,gB_Fo.misorientation.angle./degree,'linewidth',1.5)
hold off
colorbar

%% Special boundary
grains.boundary('Fo','En')

%% Subboundary
%close all
%plot(grains.boundary,'external')
%hold on
%plot(grains.boundary,'internal','linecolor','r','linewidth',2)
%
% replaced by grain.innerBoundary by grains.innerBoundary
% reply to Thomas Chave
%
plot(grains.boundary)
hold on
plot(grains.innerBoundary,'linecolor','r','linewidth',2)
hold off

sample symmetry replaces crystal symmetry if specified

Small bug generic Euler angle import wizard.

If use the wizard it creates a file like this with not specimen symmetry

%% Import Script for VPSC Self2 Data
%
% MTEX 4.0.8
%
% David Mainprice 1/12/2014
%
%% Specify Crystal and Specimen Symmetries

% crystal symmetry
CS = crystalSymmetry('mmm', [4.7646 10.2296 5.9942], 'mineral', 'Olivine', 'color', 'dark green');

% plotting convention
setMTEXpref('xAxisDirection','east');
setMTEXpref('zAxisDirection','outOfPlane');

%% Specify File Names

% path to files
pname = '/MatLab_Programs/A_type_VPSC_Euler_Angles_1_3_5_alpha100';

% which files to be imported
fname = [pname '/1000-euler'];

%% Import the Data

% create an EBSD variable containing the data
ebsd = loadEBSD(fname,CS,'interface','generic',...
  'ColumnNames', { 'phi1' 'Phi' 'phi2'}, 'Columns', [1 2 3], 'Bunge')
%%

This gives a command window output as follows, but is wrong as there are 1000 orientations in this file

ebsd = EBSD (show methods, plot)

 Phase   Orientations     Mineral       Color  Symmetry  Crystal reference frame
     1  245952 (100%)  Forsterite  dark green       mmm                         

 Properties: 
 Scan unit : um

If I add

SS = specimenSymmetry ('triclinic’);

and

% create an EBSD variable containing the data
ebsd = loadEBSD(fname,CS,SS,'interface','generic',...
  'ColumnNames', { 'phi1' 'Phi' 'phi2'}, 'Columns', [1 2 3], 'Bunge')

This gives a command window output as follows, with 1000 orientations in this file

ebsd = EBSD (show methods, plot)

 Phase  Orientations  Mineral       Color  Symmetry  Crystal reference frame
     1   1000 (100%)  Olivine  dark green       mmm                         

 Properties: 
 Scan unit : um

I think this is just a problem that you have not updated to the MTEX4 convention of not defining SS when importing.

Generic interface could not detect any numeric data in file with numeric data

I have a problem loading my pole figure data from short files.

I have two identically formatted files that I would like to load in using the loadPolefigure function. The files content is at the end. 'data.002' loads and can be plotted and processed successfully. 'data2.002' has the same format as the other file and the only difference is that it has one less line. When I attempt to load 'data2.002', MTEX returns an error.

Here is a short code that I run (file content follows):

%% Demo file
mSym = crystalSymmetry('6/mmm', [3.2 3.2 5.2]);
mH = Miller(0,0,2,mSym);

pf1 = loadPoleFigure('data.002', mH,mSym,'ColumnNames', {'Polar Angle' 'Azimuth Angle' 'Intensity'});
pf2 = loadPoleFigure('data2.002', mH,mSym,'ColumnNames', {'Polar Angle' 'Azimuth Angle' 'Intensity'});

I get the following error when the code runs, when it attempts to load file 'data2.002'.



Error using check_interfaces (line 53)
Could not detect file format. Please contact one of the maintainers of MTEX and send him a copy of your
data files.

Error in loadPoleFigure (line 46)
  [interface,options] = check_interfaces(fname{1},'PoleFigure',varargin{:});

The contents of 'data.002' are as follows:

89.021302 0.000000 4.852817
89.021039 0.500695 4.481285
89.020007 1.001391 54.912020
89.020119 1.502086 19.681300
89.021166 2.002782 8.915007
89.021233 2.503477 8.203831
89.020192 3.004172 37.414638
89.021764 3.504868 6.891674
89.020221 4.005563 32.701342
89.018924 4.506259 34.609893

and 'data2.002' :

89.021302 0.000000 4.852817
89.021039 0.500695 4.481285
89.020007 1.001391 54.912020
89.020119 1.502086 19.681300
89.021166 2.002782 8.915007
89.021233 2.503477 8.203831
89.020192 3.004172 37.414638
89.021764 3.504868 6.891674
89.020221 4.005563 32.701342

There appears to be a hard limit on the minimum number of lines in the file, as coded on line 50 of loadPoleFigure_generic.m. Is there any specific reason that 10 was chosen as the minimum? Is there any way around this?

get vertices of one grain

Maybe it would be a good idea that

grains(1).V

gives the vertices of the first grain but not all as it is currently the case. As a workaround one could define

grains.allV % to be what was previously grains.V and
grains.V = grains.allV(unique(grains.poly{:}),:);

Weighting of individual orientations - does this still work in MTEX 4 ?

For example working with grains

% mean orientations weighted by grain area
%
% odf calculation that works in MTEX3.5.0
odf_by_area = calcODF(o_mean_grains,'kernel',k,'Fourier','weight',g_area)

does not seem to take into account the weighting in MTEX4 ?

% You can use the orientations within the grains
odf_by_orientations = calcODF(ebsd(grains).orientations,'kernel',k,'Fourier')

this would give the same as weighting by area if all positions are indexed in the grains, if there are non-indexed points (holes) in the grains then weighting by area would give slightly different result.

all the best David

Possibility of merging .osc datas

Hi @ralfHielscher @ppinard

I have seveal .osc files for some parts of one samples, the observed areas for these .osc files are neighbouring and overlapping. I would like to merge these files using mtex, or import these files to mtex and merging the generated data together. Is this possible?

Thanks for any help!

Blank window when plotting EBSD

Dear MTEX developers:

I get a blank window when trying to plot EBSD data.
File formats are .osc and .ang.
I am having this problem in MTEX 4.0.12 and 4.0.10, while MTEX 3.5.0 works fine for the same data.

Thanks,
Marat.

Contoured pole figure plots

In previous versions you could use the cursor get the density value (multiple of uniform distribution) and azimuth and polar angle at that position by clicking the mouse. Now for several versions we only get Error in custom data tip sting function

all the best David

bug for KAM calculation in MTEX 4.0.2

Hey

Thanks for the new released of MTEX, I am testing and moving my script into it.

My question is about the KAM in MTEX 4.0.2
In the online documentation here. http://mtex-toolbox.github.io/files/doc/EBSD.KAM.html you say that the "input" is a grain2d as it should be, but you can just applie the function to ebsd (method of EBSD) .

I wonder in this case how do you take care of the grains boundary in the calculation.
I thinks, it is important to take care of grains boundary for KAM calculation.

I hope this will help but thanks for the job done anyway.
I will continue to test MTEX 4

All the best

Thomas Chauve
Phd Student
Laboratoire de Glaciologie et Geophysique de l'Environnement (LGGE - France)
MTEX 4.0.2 on Matlab R2013a on Debian 7

ODF/discreteSample

Sampling orientations from an odf by

discreteSample(odf,1000)

returns

Error using  .* 
Matrix dimensions must agree.

Error in quaternion/times (line 21)
     a = a1 .* a2 - b1 .* b2 - c1 .* c2 - d1 .* d2;

Error in ODF/discreteSample (line 24)
ori = orientation(quaternion(S3G_global,r1) .*
quaternion(S3G_local,r2),odf.CS,odf.SS);

on mtex-4.0.14.
Changing ODF/discreteSample.m line. 24 to
ori = orientation(quaternion(S3G_global,r1) .* transpose(quaternion(S3G_local,r2)),odf.CS,odf.SS);
works for me

Request for information about grain boundary properties segLength, segmentSize and direction

In the help it says

Properties of grain boundaries

A variable of type grain boundary contains the following properties

misorientation
direction
segLength

however there is also

grains.boundary.segmentSize

I wonder if we could have some examples to help understand what are segLength, segmentSize and direction and if they have units of length (micros ?) , area ? or just number of integer counts ?

all the best David

Single orientation pole figures

For a single orientation (0,0,0) of a triclinic crystal, the pole figure plots do not coincide for the discrete orientation (blue dots, correct to my opinion) and the odf derived contours (incorrect). Below please find the output of the attached script, using MTEX 4.20. The convention on the crystal coordinate system follows the OIM format using 'Y||b*', 'Z||c'. I have not tested the same issue on any other symmetry settings yet.
Many thanks & regards,
kk.
polefigures_hkl
polefigures_uvw

%% Single orientation with triclinic symmetry
%
close all; clear all; 

% crystal symmetry triclinic (Albite)
cs = crystalSymmetry('1', [8.155 12.821 7.14], [93.965,116.4,89.46]*degree,...
    'Y||b*', 'Z||c', 'mineral', 'Albite', 'color', 'cyan');
ss = specimenSymmetry('1')

% plotting convention
setMTEXpref('xAxisDirection','north');
setMTEXpref('zAxisDirection','outOfPlane');

% basis vectors and plane normals
r_a = Miller(1,0,0,cs,'uvw');
r_b = Miller(0,1,0,cs,'uvw');
r_c = Miller(0,0,1,cs,'uvw');
h_a = Miller(1,0,0,cs);
h_b = Miller(0,1,0,cs);
h_c = Miller(0,0,1,cs);
h = [h_a,h_b,h_c,-h_a,-h_b,-h_c];
r = [r_a,r_b,r_c,-r_a,-r_b,-r_c];

% ODF calculation 
o = orientation('Euler',0*degree,0*degree,0*degree,cs,ss)
odf = calcODF(o,'halfwidth',30*degree)

% plot discrete and contour pole figures
plotPDF(odf,h,'grid','grid_res',90*degree)
hold on
plotPDF(o,h,'Marker','o','MarkerSize',10,'MarkerColor','b')
hold off

figure
plotPDF(odf,r,'grid','grid_res',90*degree)
hold on
plotPDF(o,r,'Marker','o','MarkerSize',10,'MarkerColor','b')
hold off

Determination of grain size by intercept line method

Dear Ralf,
There are several methods for grain size determination, and the most common one used by the scientific community is the method of intercept line (See figure).

Please, can you introduce syntaxes to calculate the number (Nxi) and (Nyi) of grain boundaries intersecting lines X= xi and Y=yj, to estimate the grain size along X and Y directions, respectively. At least it should be done for 5 lines in each direction ( 1i5 and 1j5).
If the line intercepts a triple point it is must be count as 1/2.
Thank you very much for the huge time expend for developing mtex.
Best regards
Mohamed
figure

Error on using calcOrientations

I have an ODF-dataset which is otherwise completely fine.
However, on trying to calculate the orientations from it I run into an error.
The documentation on calcOrientaitions is quite sparse, so I am pretty much clueless right now.
Matlab 2014b, mtex 4.0.6

ori = calcOrientations(odf,4000)
Error using .*
Matrix dimensions must agree.

Error in .* (line 21)
a = a1 .* a2 - b1 .* b2 - c1 .* c2 - d1 .* d2;

Error in unimodalComponent/discreteSample (line 27)
ori = orientation(quaternion(component.center,ic(:)) .* ...

Error in ODF/calcOrientations (line 30)
ori(iodf==i) = discreteSample(odf.components{i},nnz(iodf==i),varargin{:});

Color coding of pole figures and maps

Dear Ralf

I am very happy with the new version of Mtex, however I think I came across a bug when using custom color coding scheme for EBSD maps and corresponding scatter point pole figures. When plotting EBSD data with custom color coding it seem to be working, unless you choose the option 'all' for the scatterpoints. When I apply a similar approach to grains with the mean grain orientations the whole color scheme breaks down. I applied a for loop to workaround the problem, but I suspect there may be simpler solutions. The problems appear when plotting figures 1003 (if the number of scatterpoints is replaced by 'all' and in figure 1004 if I replace the for loop with the code that has been commented out.

%% Import Script for EBSD Data
%
% This script was automatically created by the import wizard. You should
% run the whoole script or parts of it in order to import your data. There
% is no problem in making any changes to this script.

%% Specify Crystal and Specimen Symmetries
clear all
close all
% crystal symmetry
CS = {crystalSymmetry('32', [4.91 4.91 5.41], 'X||a', 'Y||b*', 'Z||c', 'mineral', 'Quartz', 'color', 'light blue')};
% specimen symmetry
SS = specimenSymmetry('triclinic');
% plotting convention
setMTEXpref('xAxisDirection','east');
setMTEXpref('yAxisDirection','outOfPlane');
%setMTEXpref('yAxisDirection','north');

%% Specify File Names
% path to files
pname = 'C:\Users\eskesore\Documents\MATLAB\ebsd_data\EBSD_HJK\EBSD_osc_files';
% which files to be imported
fname = [pname '\HJK001_01.osc'];
% create an EBSD variable containing the data

%% Import the Data
% create an EBSD variable containing the data
ebsd = loadEBSD(fname,CS,SS,'interface','osc');

%% Correct Data orientation of euler and sample reference frame
rot = rotation('Euler',90*degree,180*degree,180*degree);
ebsd = rotate(ebsd,rot,'keepEuler');
rot = rotation('Euler',0*degree,0*degree,90*degree);
ebsd = rotate(ebsd,rot);
clf 
%% Plot settings
    %ipfsettings
    halfwidth = 20*degree;
    %colors for ipf and ebsd map
    oM = ipdfCenterOrientationMapping(ebsd('Quartz').CS);%define variable for the colormap
    nColors = 4;
    oM.color = [[0 0 1];[0 1 1];[1 1 0];[1 0 0];[1 0.5 0]];
    oM.center = [Miller(3,3,0,ebsd('Quartz').CS);Miller(2,0,0,ebsd('Quartz').CS);Miller(0,0,1,ebsd('Quartz').CS);Miller(3,1.5,3,ebsd('Quartz').CS);Miller(0.9,3,2.47,ebsd('Quartz').CS)];
    oM.psi = deLaValeePoussinKernel('halfwidth',halfwidth);
    oM.inversePoleFigureDirection = zvector;
    %Miller indices for pole figures
    h = [Miller(0,0,1,ebsd('Quartz').CS),Miller(1,0,1,ebsd('Quartz').CS),Miller(0,1,1,ebsd('Quartz').CS)];
    %number of random points for scatter
    number_of_scatterpoints = 10000;
    Markersize = 1.25;
    %grain settings
    grainangle = 10*degree;
    titleangle = num2str(grainangle/degree,'%u');%have angle string for title in integer format (%u)
    b = vector3d(0,0,1);%smaple direction vector for the inverse pole figure
    %Special boundaries excluded from grain-boundary maps
    rot = rotation('axis',Miller(0,0,0,1,ebsd('Quartz').CS),'angle',60*degree); %Dauphine twin
    Delta = 10*degree;
    ebsd = ebsd(ebsd.confidenceindex>0.0145);
    %calculate grains
    [grains,ebsd.grainId] = calcGrains(ebsd('indexed'),'angle',grainangle);
    %clean grain map
    condition = grains.grainSize >10;
    goodgrains = grains(condition);
    ebsd = ebsd(goodgrains);
    [grains,ebsd.grainId,meanOrientation] = calcGrains(ebsd('indexed'),'angle',grainangle);

    figure(1000)
 plotIPDF(ebsd('Quartz').orientations,zvector,'MarkerSize',3,'property',oM.orientation2color(ebsd('quartz').orientations), 'points',number_of_scatterpoints);

   figure(1001)
       plot(ebsd('quartz'),oM.orientation2color(ebsd('quartz').orientations))%,'parent',axesPos)
       hold on
       plot(grains.boundary,'linewidth',1.5)%
       hold off
figure(1002)
        plot(oM) 
figure(1003)
        plotPDF(ebsd('quartz').orientations,h,'property',oM.orientation2color(ebsd('quartz').orientations), 'points',number_of_scatterpoints);
figure(1004)
        %this doesnt work
        %plotPDF(grians('quartz').meanOrientation,h,'property',oM.orientation2color(grains('quartz').orientations), 'all')
        %so I had to do this:
        a =oM.orientation2color(grains('quartz').meanOrientation);
        t = length(grains);
        c = sqrt(grains.area);
        clf
        for i=1:t
       % a = fliplr(a);
       hold on
               plotPDF(grains('quartz').meanOrientation(i),h,'MarkerColor',a(i,:,:),'MarkerSize', c(i)/10)
               drawnow
        end
figure(1005)                 plot(grains('quartz'),oM.orientation2color(grains('quartz').meanOrientation))%,'parent',axesPos)
       hold on
       plot(grains.boundary,'linewidth',1.5)%
       hold off

Removing "merged" grains truncated by the map boundaries

Hi,
thank you very much for your MTEX.
I am determining the grain size from EBSD maps, removing the grains near the edge of map that are truncated by the map boundary. I am working by MEX 3.5.0 with Matlab 11 (because of the present limits of my PC).
About this, I have seen that you developed the very useful function "select_full_grains.m". In my case, before to apply it, I should merge my grains with CSL(3) boundaries in a new grains object. But, after that, the function does not work (while it works very well on the original grain object without merging).
These are the steps (error message included):

grains1 = calcGrains(ebsd,'angle',2*degree)
plotBoundary(grains2,'property',CSL(3),'delta',2*degree,'linecolor','b','linewidth',2)
grains=merge(grains1,CSL(3))
grains_n = select_full_grains(grains)
Do you want reduice the sample area ? (1 yes, 0 no (default)) : 0
--- Undefined function or variable "pos".-------
----Error in select_full_grains (line 72)
new_grains = findByLocation(grains,pos)-----

The resolution is very important for me: could you help me about this my issue, or give some indication where to find the relevant answers?

Thank you very much again
Best regards

Riccardo
Researcher at the National Research Council of Italy, Milan

Misorientation Axes (Regression with 4.0.20?)

Hello Ralf,
in short: determination of misorientation axes with 4.0.20 does not yield the same as with 4.0.15 and the those from 4.0.15 seem to make more sense to me.

In longer: When colorcoding grain boundaries according to their misorientation axis I noticed that with 4.0.20 some axis directions (wrt to sample reference frame) were determined differently on the same boundary, e.g. for vertical or horizontal segments. The difference seems not to be related with polarity of the vector3d of the misorientation axis wrt to the sample reference frame. Misorientation axes in crystal reference frame are identical. There are 11 boundareis with angles misorientation angles high enough that they do not scatter to much. With 4.0.15 I can find those 11 clusters in the polefigure for misorienatioon axes (wrt sample reference frame) while in 4.0.20, there are more then 11, coincident with the additional colors of boundaries as seen on the map.
This wasn't an issue with 4.0.15 and I could not find the commit which might be the reason for it.
Attached are sample code as well as a maps and pole figure of misorientation axes obtained with 4.0.20 and 4.0.15.

With 4.0.20
Misorientation axes (sample reference frame) mapped and orientation map. Boundary colorcoding according to the "beach ball" below. Note color jumping along grain boundary segments.
misor_axes_sample_map

Misorientation axes (sample reference frame) and oM used to colorcode boundaries above. Markers colorcoded by misorientation angle. (Note, there are more clusters of points than boundaries),
misor_axes_sample

Misorientation axes (crystal reference frame) mapped and orientation map. Boundary colorcoding according to the "piece of pie" below.
misor_axes_crystal_map

Misorientation axes (crystal reference frame) and oM used to colorcode boundaries above.
misor_axes_crystal

With 4.0.15
Misorientation axes (sample reference frame) mapped and orientation map. Boundary colorcoding according to the "beach ball" below.
misor_axes_sample_map_mtex0 15

Misorientation axes (sample reference frame) and oM used to colorcode boundaries above.Markers colorcoded by misorientation angle.
misor_axes_sample_mtex0 15

Misorientation axes (crystal reference frame) mapped and orientation map. Boundary colorcoding according to the "piece of pie" below.
misor_axes_crystal_map_mtex0 15

Misorientation axes (crystal reference frame) and oM used to colorcode boundaries above.
misor_axes_crystal_mtex0 15

The input can be found here: https://bitbucket.org/kiliru/stuff/downloads/test_ebsd.mat
and this is the code I used with 4.0.20

% crystal symmetry
CS = {... 
  'notIndexed',...
  crystalSymmetry('-3m1', [4.913 4.913 5.504], 'X||a*', 'Y||b', 'Z||c', 'mineral', 'Quartz-new', 'color', 'light blue')};
% plotting convention
setMTEXpref('xAxisDirection','east');
setMTEXpref('zAxisDirection','intoPlane');
hs= [... % directions
    Miller(0,0,0,1,CS{2},'uvw'),... %c
    Miller(1,1,-2,0,CS{2},'uvw'),... %a
    Miller(1,0,-1,0,CS{2},'uvw'),... %m
    Miller(0,1,-1,1,CS{2},'uvw'),... %z
    Miller(1,0,-1,1,CS{2},'uvw'),... %r
    Miller(1,1,-2,2,CS{2},'uvw')... %xi
    ];
%-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
%load the data
load('test_ebsd.mat')
%do some grains
[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',10*degree);

%-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
%get the boundary
gb_sel= grains.boundary('Q','Q');
%get the boudnary orientations
gbo1 = ebsd(gb_sel.ebsdId(:,1)).orientations;
gbo2 = ebsd(gb_sel.ebsdId(:,2)).orientations;

%calc the crysta/ sample misorientation axes
misor= inv(gbo1).*gbo2;

%/////////////////////////////////////////////////////////////////////////
%wrt to crystal
%/////////////////////////////////////////////////////////////////////////
axis_crystal = axis(misor);

    %make orientation mapping Crystal / axis
    oMC = ipdfHSVOrientationMapping(axis_crystal);
    oMC.CS1=crystalSymmetry('-3m1');% I guess it needs a symmetry
    oMC.colorStretching =3;
    oMC.whiteCenter = Miller(1,1,-2,1,oMC.CS1);
    oMC.sR.N = vector3d(2,1,3);

%plot axes wrt to crystal
figure

plot(ebsd('Q'),oMC.orientation2color(ebsd('Q').orientations))
hold on
plot(gb_sel,'linecolor','k','linewidth',8)
hold on
plot(gb_sel,oMC.Miller2color(axis_crystal),'linewidth',4)
hold off

figure;
plot(oMC)
hold on
plot(Miller(axis_crystal.project2FundamentalRegion,oMC.CS1),...
    misor.angle./degree,'MarkerSize',10,'MarkerEdgeColor','k',...
    'antipodal')
hold off
colorbar
%that's ok so far


%/////////////////////////////////////////////////////////////////////////
%wrt to sample
%/////////////////////////////////////////////////////////////////////////
misor_ax_sample = gbo1.*axis_crystal;

%figure;plot(misor_ax_sample,angle(misor)./degree,'MarkerSize',8,'MarkerEdgeColor','k')
%misor_ax_sample = project2FundamentalRegion(misor_ax_sample,crystalSymmetry('-1'))
%figure;plot(misor_ax_sample,angle(misor)./degree,'MarkerSize',8,'MarkerEdgeColor','k')

    %make a nice oM for sample ref. frame
    oMs = ipdfHSVOrientationMapping(misor_ax_sample);
    oMs.CS1=oMs.CS1.Laue;
    oMs.whiteCenter = vector3d(0,-1,0)
    oMs.colorStretching =1
    oMs.colorPostRotation = reflection(vector3d(-1,0,-1))*rotation('axis',vector3d(1,0,0),'angle',180*degree);

figure   
plot(ebsd('Q'),oMC.orientation2color(ebsd('Q').orientations))
hold on
plot(gb_sel,'Linecolor','k','linewidth',8)
hold on
plot(gb_sel,oMs.Miller2color(misor_ax_sample),'linewidth',4)
hold off

figure
plot(oMs)
hold on
plot(misor_ax_sample,angle(misor)./degree,'MarkerSize',8,'MarkerEdgeColor','k','antipodal')
hold off
colorbar

%that's not ok

while this is the script used with 4.0.15. with the only difference using

%get the boundary
gb_sel= grains.boundary('Q','Q');
%get the boudnary orientations
ebsd.id=[1:size(ebsd)]' 
gbo1= ebsd.orientations(gb_sel.ebsdId(:,1))
gbo2= ebsd.orientations(gb_sel.ebsdId(:,2))
% crystal symmetry
CS = {... 
  'notIndexed',...
  crystalSymmetry('-3m1', [4.913 4.913 5.504], 'X||a*', 'Y||b', 'Z||c', 'mineral', 'Quartz-new', 'color', 'light blue')};
% plotting convention
setMTEXpref('xAxisDirection','east');
setMTEXpref('zAxisDirection','intoPlane');
hs= [... % directions
    Miller(0,0,0,1,CS{2},'uvw'),... %c
    Miller(1,1,-2,0,CS{2},'uvw'),... %a
    Miller(1,0,-1,0,CS{2},'uvw'),... %m
    Miller(0,1,-1,1,CS{2},'uvw'),... %z
    Miller(1,0,-1,1,CS{2},'uvw'),... %r
    Miller(1,1,-2,2,CS{2},'uvw')... %xi
    ];
%-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
%load the data
load('test_ebsd.mat')
%do some grains
[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',10*degree);

%-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
%get the boundary
gb_sel= grains.boundary('Q','Q');
%get the boudnary orientations
ebsd.id=[1:size(ebsd)]' 
gbo1= ebsd.orientations(gb_sel.ebsdId(:,1))
gbo2= ebsd.orientations(gb_sel.ebsdId(:,2))
%calc the crysta/ sample misorientation axes
misor= inv(gbo1).*gbo2;

%/////////////////////////////////////////////////////////////////////////
%wrt to crystal
%/////////////////////////////////////////////////////////////////////////
axis_crystal = axis(misor);

    %make orientation mapping Crystal / axis
    oMC = ipdfHSVOrientationMapping(axis_crystal);
    oMC.CS1=crystalSymmetry('-3m1');% I guess it needs a symmetry
    oMC.colorStretching =3;
    oMC.whiteCenter = Miller(1,1,-2,1,oMC.CS1);
    oMC.sR.N = vector3d(2,1,3);

%plot axes wrt to crystal
figure
plot(ebsd,oMC.orientation2color(ebsd('Q').orientations))
hold on
plot(gb_sel,'linecolor','k','linewidth',8)
hold on
plot(gb_sel,oMC.Miller2color(axis_crystal),'linewidth',4)
hold off

figure;
plot(oMC)
hold on
plot(Miller(axis_crystal.project2FundamentalRegion,oMC.CS1),...
    misor.angle./degree,'MarkerSize',10,'MarkerEdgeColor','k',...
    'antipodal')
hold off
colorbar
%that's ok so far


%/////////////////////////////////////////////////////////////////////////
%wrt to sample
%/////////////////////////////////////////////////////////////////////////
misor= inv(gbo1).*gbo2;
misor_ax_sample = gbo1.*axis_crystal;

%figure;plot(misor_ax_sample,angle(misor)./degree,'MarkerSize',8,'MarkerEdgeColor','k')
%misor_ax_sample = project2FundamentalRegion(misor_ax_sample,crystalSymmetry('1'),'antipodal')
%figure;plot(misor_ax_sample,angle(misor)./degree,'MarkerSize',8,'MarkerEdgeColor','k')

    %make a nice oM for sample ref. frame
    oMs = ipdfHSVOrientationMapping(misor_ax_sample);
    oMs.CS1=oMs.CS1.Laue;
    oMs.whiteCenter = vector3d(0,-1,0)
    oMs.colorStretching =1
    oMs.colorPostRotation = reflection(vector3d(-1,0,-1))*rotation('axis',vector3d(1,0,0),'angle',180*degree);

figure   
plot(ebsd('Q'),oMC.orientation2color(ebsd('Q').orientations))
hold on
plot(gb_sel,'Linecolor','k','linewidth',8)
hold on
plot(gb_sel,oMs.Miller2color(misor_ax_sample),'linewidth',4)
hold off

figure
plot(oMs)
hold on
plot(misor_ax_sample,angle(misor)./degree,'MarkerSize',8,'MarkerEdgeColor','k','antipodal')
hold off
colorbar

Do you have any idea, what is going wrong?
All the best,
Rüdiger

Restrict data to phase

Dear Mtex users/developers,

I am currently starting to translate my codes from mtex 3.5 for 4.x syntax,working with ebsd(cpr,crc)files, and i am facing a problem to restrict my data for a specific phase in Mtex 4.0.10 , such as grains('phase') or ebsd('phase'), although gB = grains.boundary('phase','phase') works fine.

The number informed by grains of 'phase' grains exceeds 500 (nevertheless when i try to get the number of grains by numel(grains) the answer is always 1.).
I already tried to reinstall Mtex but the following msgerror persists:

Subscript indices must either be real positive integers or logicals.
Error in subsind (line 40)
ind = ind & phases(ebsd.phaseId);
Error in EBSD/subsref (line 12)
ind = subsind(ebsd,s(1).subs);

Thanks,
Filippe.

Beartex file import

Hello Ralf,
Pole figure files in Beartex format are not recognized.
They are loaded using loadPoleFigure_generic.m, which leads to wrong result.
Gruss, kk.

diameter

Hello,

The 'diameter' function is not working anymore in my code.


Code:

grain = calcGrains(ebsd,'angle','unitcell',15*degree);
d=diameter(grain);

Error:

Error using get
Conversion to double from grain2d is not possible.

Error in grain2d/diameter (line 9)

I_VG = get(grains,'I_VG');

I also tried 'grain.diameter' as we can use 'grain.area' in this new version but nothing works.
Do you have any idea?

MTEX version: 4.0 (it was working on the previous versions)

Thank you,
Alex

findByLocation@grain2d applied to multiple positions

Dear Ralf,

I had some issues in MTEX 4.0.13 when applying findByLocation@grain2d on multiple coordinates. In MTEX3.5 this seemed to work fine for me.

Here is a code that reproduces the error:

x=[1 2 3];
y=[1 2 3];
pos=[x(:) y(:)];
findByLocation(grains,pos)
Error using  == 
Matrix dimensions must agree.

Error in grain2d/findByLocation>@(x)any(x==closestVertex) (line 29)
id = find(cellfun(@(x) any(x==closestVertex), poly));


Error in grain2d/findByLocation (line 29)
id = find(cellfun(@(x) any(x==closestVertex), poly));

I've replaced the code in grain2d/findByLocation from line 28 onwards by, which seems to produce what I want.

% list of candidates
id = find(cellfun(@(x) any(ismember(closestVertex,x)), poly));
poly = poly(id);

% check whether pos is inside the candidates
inside = false(size(id));
for k=1:numel(poly)
  V_k = grains.V(poly{k},:);
  for j=1:size(pos,1)
    inside(k) = inside(k) + inpolygon(pos(j,1),pos(j,2),V_k(:,1),V_k(:,2));
  end
  inside(k)=any(inside(k),1);
end
id = id(inside);

It's probably not a very elegant solution. But I hope it helps

Best regards
Brian

restricting grain boundaries to the fundamental region ?

We can create a inter-phase grain boundary set by

gB_Opx_Cpx = grains.boundary('Enstatite','Diopside')

But the misorientations are not restricted to the fundamental region in gB_Opx_Cpx, where as
can the plot of the axis can be.

plotAxisDistribution(gB_Opx_Cpx,'antipodal','contourf','fundamentalRegion')

gB_Opx_Cpx = grains.boundary('Enstatite','Diopside','fundamentalRegion')

gives an error.

Is there anyway to apply fundamentalRegion to gB_Opx_Cpx ?

all the best David

Problem with rotating pole figure about Z-axis

I have been testing the differences between pole figures using RP,L1 and L2, see script below.
However rotation about Z does not seem to work, it should change the azimuth of all values.

David

%% Defined new orientation
% Define a rotation around the specimen Z-axis about 90 degree
rot = rotation('axis',zvector,'angle',90*degree)
pfs_hkl_rot = rotate(pfs_hkl,rot)
figure
plot(pfs_hkl_rot,'antipodal')
%% Original orientation
figure
plot(pfs_hkl)
%% Compare with rotated pole figures
% RP value of Matthies
e_RP = calcError(pfs_hkl_rot,pfs_uvw,'RP')
% L1 is mean absolute difference abs(d1-d2)
e_L1 = calcError(pfs_hkl_rot,pfs_uvw,'l1')
% L2 is mean squared difference (d1-d2)^2
e_L2 = calcError(pfs_hkl_rot,pfs_uvw,'l2')

Plotting user defined plane on pole figure with antipodal and specified hemisphere

%% STEP 3 : contoured pole figures in SEM X to east Z to out of plane LOWER
% This works fine
%***********************************************************************
close all
plotx2east
figure
plotPDF(odf_Bytownite,pfs_Bytownite,'lower','contourf')
colorbar
% plot trace of inclined plane
hold on
polar_angle = 60*degree;
azimuth_angle = 110*degree;
v = vector3d('polar',polar_angle,azimuth_angle);
plot(v,'plane','color','r','linewidth',2)
saveFigure('/MatLab_Programs/PFs_LOWER_Bytownite_Example.pdf')

pfs_lower_bytownite_example

However, if we want to specify lower hemisphere and antipodal (that is all directions rotated to the lower hemisphere) the is a small bug in the plot of the trace of the user defined plane.

%% Plot Bytownite Pole Figures (PFs) in Sample co-ordinates (X,Y,Z) LOWER  + plane chosen by user - DOES NOT WORK PROPERLY IF THE PF IS ANTIPODAL AND LOWER hemisphere

pfs_lower_antipodal_bytownite_example

figure
plotPDF(odf_Bytownite,pfs_Bytownite,'antipodal','lower','contourf')
%CLim(gcm,'equal');
colorbar
hold on
polar_angle = 60*degree;
azimuth_angle = 110*degree;
v = vector3d('polar',polar_angle,azimuth_angle);
plot(v,'plane','color','r','linewidth',2)
saveFigure('/MatLab_Programs/PFs_LOWER_ANTIPODAL_Bytownite_Example.png')

all the best David

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.