mtex-toolbox / mtex

MTEX is a free Matlab toolbox for quantitative texture analysis. Homepage:
http://mtex-toolbox.github.io/
GNU General Public License v2.0
278 stars 183 forks source link

plotAngleDistribution on non uniform ODF #1822

Closed ThomasChauve closed 1 year ago

ThomasChauve commented 1 year ago

What do you want to do? I want to compute plotAngleDistribution on an non uniform ODF but it seems that the result is false.

What data do you have? I build ODF using custom function buildODF

What code do you use?

CS = crystalSymmetry('6/mmm', [4.51 4.51 7.34], 'X||a*', 'Y||b', 'Z||c', 'mineral', 'Ice-Ih', 'color', 'light blue');

odf = fibreODF(Miller(0,0,0,1,CS),yvector,'halfwidth',5*degree);

figure;
plotAngleDistribution(odf)

ori=odf.discreteSample(20000);

for i=1:9999
    i
    clc
    mk(i)=angle(ori(i*2),ori(i*2+1));
end

figure;
[counts,centers]=hist(mk);
plot(centers*180/pi,counts,LineWidth=2)
xlim([0,100])

What result do you get I compare a list of angle computed using angle function on 2 orientations obtained using odf.discreteSample to plotAngleDistribution(odf) The results does not match.

image

What result do you expect That both figures are similar.

Error Message none

Comment

What MTEX version do you use? MTEX 5.9.0 Matlab R2021a

I also tried with MTEX 5.8.2 : same result.

kilir commented 1 year ago

Hi Thomas, you are comparing the angle distribution of an odf to the misorientation angle distribution, that's two different things. You probaly should use an mdf.

CS = crystalSymmetry('6/mmm', [4.51 4.51 7.34], 'X||a*', 'Y||b', 'Z||c', 'mineral', 'Ice-Ih', 'color', 'light blue');
odf = fibreODF(Miller(0,0,0,1,CS),yvector,'halfwidth',5*degree);
mdf = calcMDF(odf)

plotAngleDistribution(mdf)

ori=odf.discreteSample(1000);
mk = angle_outer(ori);

% mori=mdf.discreteSample(100000);
% mk = mori.angle;

figure;
[counts,centers]=hist(mk(:),72);
plot(centers*180/pi,counts,LineWidth=2)
xlim([0,100])

Cheers, Rüdiger

ThomasChauve commented 1 year ago

Hi Rüdiger

Thanks for the quick fix. I haven't use MTEX for a while and I didn't recall mdf the last time used it. Therfore I don't really understand what does plotAngleDistribution(odf) . It is just out of curiosity.

Anyway thanks for fix. Best Thomas

kilir commented 1 year ago

Hi Thomas, the angle of an orientation would correspond to the axis-angle representation, the same applies to an odf, which is what plotAngleDistribution(odf) does. Often this makes sense for misorientations but in many cases not really for orientations. Cheers, Rüdiger