Random Sampling edit page

Assume an arbitrary ODF either from texture modeling or recovered from XRD pole figure measurements a common problem is the simulation of random individual orientations that are distributed according the given ODF. This is helpful crucial in many application, e.g., for running plastic deformation models like VPSC or verifying the accuracy density estimation methods. Here we start with a trigonal alpha-fibre ODF which we define by

cs = crystalSymmetry('32');
fibre_odf = 0.5*uniformODF(cs) + 0.5*fibreODF(fibre.rand(cs),'halfwidth',20*degree);

plot(fibre_odf,'sections',6,'silent')
mtexColorbar

Computing Random Orientations

In order to compute \(500\) random orientations from the ODF fibre_odf we use the command discreteSample.

ori = fibre_odf.discreteSample(500)

% plot the orientations into the Bunge sections
hold on
plot(ori,'MarkerFaceColor','none','all','MarkerEdgeColor','k','MarkerSize',4)
hold off
ori = orientation (321 → y↓→x)
  size: 500 x 1

From the above plot it is very hard to judge whether the orientations are indeed distributed according to the given ODF. The reason for this is the not volume preserving projection of the Bunge sections. A better ODF representation for this purpose are sigma sections

% plot the ODF in sigma sections
plot(fibre_odf,'sections',6,'silent','sigma','contour','linewidth',2)

% plot the orientations into the sigma sections
hold on
plot(ori,'MarkerFaceColor','none','all','MarkerEdgeColor','k','MarkerSize',4)
hold off

ODF Estimation from Random Orientations

From the last plot we clearly see that the orientations are more dense close to the alpha fibre. In order more quantitative measure for how well do the orientations approximate the ODF we may use the orientations to estimate a new ODF and compare the fit of this estimate ODF with the initial ODF.

% estimate an ODF from the random orientations
odf_rec = calcDensity(ori,'halfwidth',20*degree);

% plot the estimated ODF
plot(odf_rec,'sections',6,'silent')
mtexColorbar

We may now compare the original model ODF fibre_odf with the reconstructed ODF odf_rec.

calcError(odf_rec,fibre_odf)
ans =
    0.0817

Optimal Sample

The command discreteSample computes the orientations completely at random. This is perfect if you want to statistically simulate different measurement procedures and estimate the accuracy of your computations, e.g. in a bootstrapping approach. However, if you are interested in orientations that reproduce your density function with the smallest error you are better off with the command odf.optimalSample(n). This function optimizes the sampled orientation to be as representative for the ODF as possible. Lets verify this by comparing the error with respect to the original model ODF.

ori = fibre_odf.optimalSample(500)

% Note that we can use here a much smaller halfwidth. If we would have used
% this halfwidth with the random orientations the error would have been
% even worse
odf_rec = calcDensity(ori,'halfwidth',12*degree);

calcError(odf_rec,fibre_odf)
ori = orientation (321 → y↓→x)
  size: 500 x 1
ans =
    0.0492

Exporting Random Orientations

In order to make use of the sampled orientations you probably want to export them as Euler angles into a text files. This can be done using the commands export and export_VPSC.