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
272 stars 181 forks source link

grainMean function isn't working properly #2165

Open PedroPinh opened 4 days ago

PedroPinh commented 4 days ago

What do you want to do? Calculate GAM function What data do you have? EBSD What code do you use?


% Index grains and remove smaller ones, index subgrain and grain boundaries
[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd, 'alpha', 2.2);
ebsd(grains(grains.grainSize<5)) = [];
[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'alpha', 2.2, 'threshold',[5*degree, 15*degree]);

%Denoise
F = halfQuadraticFilter;
F.alpha = 0.25;
ebsd = smooth(ebsd,F,'fill');
EBSD = ebsd('indexed');
% calculate KAM
kam = EBSD.KAM(EBSD,'threshold',5*degree,'order',5)./degree;
% Calculate GAM
gam = EBSD.grainMean(EBSD,kam, grains);

**What result do you get**
KAM and GAM

**What result do you expect**
KAM and GAM

**Error Message**
Error using max
Invalid data type. First argument must be numeric or logical.

Error in EBSD/grainMean (line 42)
ulim = get_option(varargin,'ulim', max(prop));

Error in EBSD/subsref (line 57)
  [varargout{1:nargout}] = builtin('subsref',ebsd,s);

**What MTEX version do you use?**
5.11.1
Matlab R2018a
PedroPinh commented 4 days ago

Hello everyone.

I'm trying to obtain GAM with MTEX, but I keep getting this error; I'm trying other combinations of this code, like: gam = grainMean(EBSD,kam, grains); and get: Error using sum Invalid option. Option must be 'double', 'native', 'default', 'omitnan' or 'includenan'.

Error in mean (line 116) y = sum(x, dim, flag) ./ size(x,dim);

Error in EBSD/grainMean>@(x)mean(x,1,"omitmissing") (line 50) method = getClass(varargin,'function_handle',@(x) mean(x,1,"omitmissing"));

Error in EBSD/grainMean (line 53) mP = accumarray(ebsd.grainId(hasGrain),prop(hasGrain),[],method);

I've tried a combination with GOS calculation too, and didn't work either: GOS = EBSD.grainMean(mis2mean.angle, grains); didn't work either.

Glad from your help and attention.

Cheers, Pedro