Closed gilgannonj closed 6 years ago
Hi James,
just wondering, is in your case ebsd_smoothed
(the one your refer to when updating the grainId) the same as ebsd_merged
?
Cheers,
Rüdiger
Sorry that was a typo on my part when transferring the code for this post. I was using a smoothed EBSD data set and changed the code to make it simpler for posting here. The last two lines of the twinning code should have read as:
% make a copy of the ebsd dataset
ebsd_merged = ebsd;
% update the grainIds to the parentIds
ebsd_merged.grainId = parentID_grains(ebsd.grainId);
I also checked to see if the matrix size was preserved if I just duplicated the the unsmoothed ebsd data set and the matrix size changed there as well.
O, the result that you see with size ebsd_merged
has actually nothign to do with the ebsd_merged and is a 1-by-11 string (number of characters in ebsd_merged). Use size(ebsd_merged)
or ebsd.size
, but apart from that can you share the error that you get?
Unrelated: using orientation('axis',Miller(0,0,0,1,ebsd('c').CS),'angle',60*degree,ebsd('c').CS,ebsd('c'),CS);
may be better that rotation('axis',...
Ah I feel silly about that, thanks for pointing it out. When I use ebsd.size
and ebsd_merged.size
I get:
ans =
243343 1
ans =
243343 1
But this confuses me because when I run the full %% Merge twinned grains
that I posted above I get the error: Index exceeds matrix dimensions.
. If I comment out the last line, %ebsd_merged.grainId = parentID_grains(ebsd.grainId);
, then the script runs with out error.
Also thanks fo the advice on using rotation('axis',...
ok, and the last time you did a calcGrains in your script was after using a filter (smooth(ebsd,F)
) and just before the merging, right? and you called it also with [grains,ebsd.grainId]=calcgrains(ebsd,'angle','...)
?
Yes. In order I am:
defining ebsd
object
smoothing ebsd
calculating grains with new smoothed ebsd
And then moving through the %% Merge twinned grains
script section
In that case, I do not really see why this should happen.What's the output of
sum(isnan(ebsd('indexed').grainId))
?
The return of sum(isnan(ebsd('indexed').grainId))
ans =
0
Ok issue fixed! :) Rüdiger and I discussed it outside of this thread. This issue is that I was using calcGrains
twice in the same step, like this:
%% Grains and subgrains
[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',10*degree);
[subgrains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',0.5*degree);
which meant that that I was overwriting the grainId
. The fix either is to calcGrains
in two steps:
%% Grains
[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',10*degree);
%% Subgrains
[subgrains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',0.5*degree);
Or to replicate the ebsd to something where you can refer to specifically for the subgrains calculation.
Otherwise a mismatch is transferred across to my matrix sizes and doesn't let me merge at the step:
% update the grainIds to the parentIds
ebsd_merged.grainId = parentID_grains(ebsd.grainId);
Thanks for all the help Rüdiger :) it is much appreciated!
Hello all,
Problem: While going about identifying twin boundaries and merging them into grains I duplicate my EBSD data set in order to update the grainIds to the parentIds. The code looks like this:
The problem is that I can not perform the line:
because the matrix sizes don't match.
When I check the difference between the properties and size of the objects, ebsd and ebsd_merged, I get:
So I have the same set of properties but somehow I have lost two columns. Have I done something silly or is this a bug associated with duplicating an object?
Best,
James