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
292 stars 186 forks source link

Calculate ODF from EBSD data in MTEX 4.1.0 #109

Closed jmbp closed 9 years ago

jmbp commented 9 years ago

Dear all!

When I try to calculate the ODF from EBSD data using the command odf_Hb = calcODF(ebsd('Hornblende').orientations) in the command window appears:

??? Error using ==> subsref
No appropriate method, property, or field orientation for
class EBSD.

Error in ==> EBSD.subsref at 32
  [varargout{1:nargout}] = builtin('subsref',ebsd,s);

and in the subsref.m:

function varargout = subsref(ebsd,s)
% indexing of EBSD data
%
% Syntax
%   ebsd('Fe')        - returns data of phase Fe
%   ebsd({'Fe','Mg'}) - returns data of phase Fe and Mg
%   ebsd(1:end)       - returns data 
%

if strcmp(s(1).type,'()')

  ind = subsind(ebsd,s(1).subs);
  ebsd = subSet(ebsd,ind);

  % is there something more to do?
  if numel(s)>1
    s = s(2:end);
  else
    varargout{1} = ebsd;
    return
  end  

end

% maybe reference to a dynamic property
if isProperty(ebsd,s(1).subs)

  [varargout{1:nargout}] = subsref@dynProp(ebsd,s);

else

  [varargout{1:nargout}] = builtin('subsref',ebsd,s);

end

end

I can´t fix it! I'm working with MTEX 4.1.0 in MATlab R2009b. Thanks,

Jose M. Benitez-Perez

ralfHielscher commented 9 years ago

according to you error message you missed the s at the end of orientations

odf_Hb = calcODF(ebsd('Hornblende').orientations)

Ralf

jmbp commented 9 years ago

Dear Ralf, Thanks for your fast reply. The problem remains in spite of I added the 's', but now the report this different:

??? Error using ==> unimodalComponent
The property 'CS' restriction defined in class
'unimodalComponent' must match the property definition in
base class 'unimodalComponent'.

Error in ==> unimodalODF at 58
component = unimodalComponent(center,psi,weights);

Error in ==> orientation.calcKernelODF at 79
  odf =
  unimodalODF(S3G,psi,ori.CS,ori.SS,'weights',weights);

Error in ==> orientation.calcODF at 67
  odf = calcKernelODF(ori,varargin{:},'kernel',psi);

Jose M. Benitez-Perez

ralfHielscher commented 9 years ago

Hi Jose M. Benitez-Perez,

I'm afraid the problem is your Matlab version. See

http://mtex-toolbox.github.io/files/doc/installation.html

mtex 3.5 will probably work with you matlab version but MTEX 4.x requires a more recent version.

Ralf.

jmbp commented 9 years ago

Ok! I will try to get a recent version and then I will reply you if it works. Thanks a lot!

jmbp commented 9 years ago

Hi Ralf again! I've achieved calculate the ODF! The problem was the old Matlab version. But we I've more questions: A. How can I mark the maximum value in a PF from the ODF? I tried using the comand: max = maxpdf(odf_Hb,h) hold all plot(max,'Marker','p','MarkerSize',15,'MarkerFaceColor','red','MarkerEdgeColor','black') annotate(max,... 'marker','s','MarkerSize',6,'MarkerFaceColor','r',... 'label','A','color','w') But it draws this figure:

untitled

B. How might I save the elastic tensor in a xlsx file? I´ve discovered that Mtex works with tensors (4th rank) like 9 quarternion. So, I can´t save like a matrix using xlswrite matlab command. Could you help me?

C. When I tried to calculate the anisotropy in the command max(vp) and min(vp) appears the following error and I don't understand their meaning:

Vp_max_value = max(vp) Vp_min_value = min(vp)

Error using subsref

Subscript indices must either be real positive integers or logicals.

Error in quaternion/subsref (line 7) q.a = subsref(q.a,s(1));

D. Calculating polycrystal elastic tensor appears these options:

CHill_Qtz_Polycrystal = tensor (show methods, plot) rank: 4 (3 x 3 x 3 x 3)

tensor in Voigt matrix representation: 99.25 6.62 6.28 0.1 0.3 -0.1 6.62 101.23 5.7 -1.5 -0.4 -0.26 6.28 5.7 100.4 -1.95 -0.14 0.07 0.1 -1.5 -1.95 46.78 -0.08 -0.53 0.3 -0.4 -0.14 -0.08 46.73 -1.56 -0.1 -0.26 0.07 -0.53 -1.56 47.66

My question is when I click in plot, which kind of plot is it? Velocities? Thanks a lot for your help.

Jose M. Benitez-Perez

zmichels commented 9 years ago

Hello Jose,

With question C... The problem is that you earlier assigned a value to a variable you named "max"... This will cause errors when you later try to run the max() function. It treats the values you put in the parentheses as indexes for the variable you created, rather than running the max() function. If you name your variable something else, then your commands will work better.

Best, Zach

On Oct 28, 2015, at 7:34 AM, jmbp notifications@github.com<mailto:notifications@github.com> wrote:

Hi Ralf again! I've achieved calculate the ODF! The problem was the old Matlab version. But we I've more questions: A. How can I mark the maximum value in a PF from the ODF? I tried using the comand: max = maxpdf(odf_Hb,h) hold all plot(max,'Marker','p','MarkerSize',15,'MarkerFaceColor','red','MarkerEdgeColor','black') annotate(max,... 'marker','s','MarkerSize',6,'MarkerFaceColor','r',... 'label','A','color','w') But it draws this figure:

[untitled]https://cloud.githubusercontent.com/assets/15121063/10788393/831d374c-7d77-11e5-97b2-7ba71a6c1c2b.jpg

B. How might I save the elastic tensor in a xlsx file? I?ve discovered that Mtex works with tensors (4th rank) like 9 quarternion. So, I can?t save like a matrix using xlswrite matlab command. Could you help me?

C. When I tried to calculate the anisotropy in the command max(vp) and min(vp) appears the following error and I don't understand their meaning:

Vp_max_value = max(vp) Vp_min_value = min(vp)

Error using subsref

Subscript indices must either be real positive integers or logicals.

Error in quaternion/subsref (line 7) q.a = subsref(q.a,s(1));

D. Calculating polycrystal elastic tensor appears these options:

CHill_Qtz_Polycrystal = tensor (show methods, plot) rank: 4 (3 x 3 x 3 x 3)

tensor in Voigt matrix representation: 99.25 6.62 6.28 0.1 0.3 -0.1 6.62 101.23 5.7 -1.5 -0.4 -0.26 6.28 5.7 100.4 -1.95 -0.14 0.07 0.1 -1.5 -1.95 46.78 -0.08 -0.53 0.3 -0.4 -0.14 -0.08 46.73 -1.56 -0.1 -0.26 0.07 -0.53 -1.56 47.66

My question is when I click in plot, which kind of plot is it? Velocities? Thanks a lot for your help.

Jose M. Benitez-Perez

Reply to this email directly or view it on GitHubhttps://github.com/mtex-toolbox/mtex/issues/109#issuecomment-151829893.

jmbp commented 9 years ago

Thank you Zach! Works perfectly.

Also, I've found the way to save the tensor (voigt, reuss or hill) in a excel file. It the follow script:

[CVoigt_Hb_Polycrystal,CReuss_Hb_Polycrystal,CHill_Hb_Polycrystal] = ... calcTensor(ebsd_smoothedspline('Hornblende'),C_Hb)

X= matrix(CVoigt_Hb_Polycrystal); filename = 'F:\MTEX)_Anisotropy.xlsx'; xlswrite(filename,'CVoigt_Hb_Polycrystal_ebsd tensor','Hb','B5'); xlswrite(filename,X(1,1,1,1),'Hb','B6'); xlswrite(filename,X(1,1,2,2),'Hb','C6'); xlswrite(filename,X(1,1,3,3),'Hb','D6'); xlswrite(filename,X(1,1,3,2),'Hb','E6'); xlswrite(filename,X(1,1,1,3),'Hb','F6'); xlswrite(filename,X(1,1,2,1),'Hb','G6'); xlswrite(filename,X(2,2,1,1),'Hb','B7'); xlswrite(filename,X(2,2,2,2),'Hb','C7'); xlswrite(filename,X(2,2,3,3),'Hb','D7'); xlswrite(filename,X(2,2,3,2),'Hb','E7'); xlswrite(filename,X(2,2,3,1),'Hb','F7'); xlswrite(filename,X(2,2,2,1),'Hb','G7'); xlswrite(filename,X(3,3,1,1),'Hb','B8'); xlswrite(filename,X(3,3,2,2),'Hb','C8'); xlswrite(filename,X(3,3,3,3),'Hb','D8'); xlswrite(filename,X(3,3,3,2),'Hb','E8'); xlswrite(filename,X(3,3,3,1),'Hb','F8'); xlswrite(filename,X(3,3,2,1),'Hb','G8'); xlswrite(filename,X(2,3,1,1),'Hb','B9'); xlswrite(filename,X(2,3,2,2),'Hb','C9'); xlswrite(filename,X(3,2,3,3),'Hb','D9'); xlswrite(filename,X(2,3,2,3),'Hb','E9'); xlswrite(filename,X(2,3,3,1),'Hb','F9'); xlswrite(filename,X(2,3,2,1),'Hb','G9'); xlswrite(filename,X(1,3,1,1),'Hb','B10'); xlswrite(filename,X(1,3,2,2),'Hb','C10'); xlswrite(filename,X(1,3,3,3),'Hb','D10'); xlswrite(filename,X(1,3,2,3),'Hb','E10'); xlswrite(filename,X(1,3,3,1),'Hb','F10'); xlswrite(filename,X(1,3,2,1),'Hb','G10'); xlswrite(filename,X(1,2,1,1),'Hb','B11'); xlswrite(filename,X(2,1,2,2),'Hb','C11'); xlswrite(filename,X(1,2,3,3),'Hb','D11'); xlswrite(filename,X(2,1,2,3),'Hb','E11'); xlswrite(filename,X(1,2,3,1),'Hb','F11'); xlswrite(filename,X(1,2,2,1),'Hb','G11');

Cheers, Jose M. Benitez-Perez