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

Issue when using calcDensity in v5.9.0 #1766

Closed marcoalopez closed 11 months ago

marcoalopez commented 1 year ago

What do I want to do? Estimate an ODF

What data do I have? I used the mtexdata forsterite dataset for testing purposes

What code do you use?

% import dataset
mtexdata forsterite

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

% estimate the ODF with an estimated kernel
psi = calcKernel(grains('Forsterite').meanOrientation)
odf = calcDensity(grains('Forsterite').meanOrientation,...
                  'weigths', grains('Forsterite').area,...
                  'kernel', psi)

What result do I get

Warning: The estimated ODF will suffer from truncation errors when truncated to harmonic degree 64.
You might want to increase the harmonic degree or the halfwidth. 

odf3 = SO3FunHarmonic (Forsterite → xyz)
  isReal: true
  bandwidth: 64
  weight: 1

What result do I expect

The parameters of the optimized kernel are

psi = SO3DeLaValleePoussinKernel
  bandwidth: 78
  halfwidth: 3°

therefore I expect that the bandwidth is set to 78 instead of 64 and not get a warning. Indeed when applied the same code in v5.8.2 I got no warning and the values of the kernel are correctly set, so this problem seems specific to v5.9.0. In short, it seems that calcDensity() in v5.9 is ignoring the kernel parameter entered as input.

Error Message Not an error but a warning that, in principle, should not occur

Warning: The estimated ODF will suffer from truncation errors when truncated to harmonic degree 64.
You might want to increase the harmonic degree or the halfwidth. 

What MTEX version do I use? 5.9 and 5.8.2 (for comparison) in Matlab 2022a and Windows 11

ralfHielscher commented 1 year ago

Hi Marco,

thank you for pointing this out. You can do

setMTEXpref('maxSO3Bandwidth',96)

to globally increase the maximum allowed bandwidth. The default in `mtex_settings' is 64. You can change it to any value. 128 should be sufficient in most case. Ralf.