# The SantaFe example

Simulate a set of pole figures for the SantaFe standard ODF, estimate an ODF and compare it to the inital SantaFe ODF.

## Simulate pole figures

```CS = crystalSymmetry('m-3m');

% crystal directions
h = [Miller(1,0,0,CS),Miller(1,1,0,CS),Miller(1,1,1,CS),Miller(2,1,1,CS)];

% specimen directions
r = equispacedS2Grid('resolution',5*degree,'antipodal');

% pole figures
pf = calcPoleFigure(SantaFe,h,r);

pf = noisepf(pf,100);

% plot them
plot(pf,'MarkerSize',5)
mtexColorMap LaboTeX```

## ODF Estimation with Ghost Correction

`rec = calcODF(pf)`
```initialize solver
start iteration
error: 7.5501E-02 2.8063E-02 9.3695E-03 7.3906E-03 6.6598E-03 6.2840E-03 6.0699E-03 5.9210E-03 5.8252E-03 5.7490E-03 5.6956E-03
Finished PDF-ODF inversion.
error: 5.6956E-03
alpha: 9.9728E+01 1.0019E+02 9.9815E+01 1.0038E+02
initialize solver
start iteration
error: 3.5374E-01 2.0708E-01 1.0679E-01 5.4600E-02 3.3635E-02 3.1481E-02 3.0693E-02 3.0254E-02 2.9942E-02 2.9689E-02 2.9475E-02
Finished PDF-ODF inversion.
error: 2.9475E-02
alpha: 9.9801E+01 1.0023E+02 9.9763E+01 1.0043E+02

rec = ODF
crystal symmetry : 432
specimen symmetry: 222

Uniform portion:
weight: 0.59888

kernel: de la Vallee Poussin, halfwidth 5°
center: 1232 orientations, resolution: 5°
weight: 0.40112

```

## ODF Estimation without Ghost Correction

`rec2 = calcODF(pf,'NoGhostCorrection')`
```initialize solver
start iteration
error: 7.5501E-02 2.8063E-02 9.3695E-03 7.3906E-03 6.6598E-03 6.2840E-03 6.0699E-03 5.9210E-03 5.8252E-03 5.7490E-03 5.6956E-03
Finished PDF-ODF inversion.
error: 5.6956E-03
alpha: 9.9728E+01 1.0019E+02 9.9815E+01 1.0038E+02

rec2 = ODF
crystal symmetry : 432
specimen symmetry: 222

kernel: de la Vallee Poussin, halfwidth 5°
center: 1232 orientations, resolution: 5°
weight: 1

```

## Error analysis

```% calculate RP error
calcError(rec,SantaFe)

% difference plot between meassured and recalculated pole figures
plotDiff(pf,rec)```
```ans =
0.0410
progress: 100%
```

## Plot estimated pole figures

`plotPDF(rec,pf.h,'antipodal')`

## Plot estimated ODF (Ghost Corrected)

```plot(rec,'sections',18,'resolution',5*degree,...
'contourf','FontSize',10,'silent','figSize','large','minmax')
mtexColorMap white2black```

## Plot odf

```plot(SantaFe,'sections',18,'contourf','FontSize',10,'silent',...
'figSize','large','minmax')
mtexColorMap white2black```

## Plot Fourier Coefficients

```close all;
% true ODF
plotFourier(SantaFe,'bandwidth',32)
% keep plot for adding the next plots
hold all

% With ghost correction:
plotFourier(rec,'bandwidth',32)

% Without ghost correction:
plotFourier(rec2,'bandwidth',32)

legend({'true ODF','with ghost correction','without ghost correction'})
% next plot command overwrites plot
hold off```