Closed DavidMainprice closed 7 years ago
David,
I understand that your question is regarding how can we add data to the grains, and I don't know the answer to that. However, if by chance the motivation for your question is so that you can make quiver plots like the ones you mentioned, you do not need to append the grains structure to make them. In your example, if you calculate grains_fo and r_001 as you did, you can make the quiver plot by doing:
quiver(grains_fo,r_001,'color','r');
Granted that does nothing to append the grain data-structure... but the plot can be made. I, too, would like to be able to append grain data, but I think that the grain objects are not designed to allow this. When I try, I get the error: "No public field r_001 exists for class grain2d." I think this suggests that the objects are not setup to allow you to create/set properties dynamically.
Best, Zach
On Nov 14, 2016, at 7:27 AM, DavidMainprice notifications@github.com<mailto:notifications@github.com> wrote:
We have the possibility of plotting grains vector3d properties at the grain centroid using MTEX quiver
%% example of using MTEX quiver with grains mtexdata fo close all figure grains = calcGrains(ebsd('indexed')) % standard plot at grain centroids the meanRotation.axis quiver(grains,grains.meanRotation.axis,'color','r') where the vector3d property meanRotation.axis already exists
If I want add a vector3d property to grains how can I do this.
for example the c-axes orientation in specimens coordinates grains_fo = grains('fo'); % [001] axes in specimen coordinates using mean grain orientation r_001 = grains_fo.meanOrientation*Miller(0,0,1,ebsd('Forsterite').CS,'uvw');
like quiver(grains,grains.r_001,'color','r') or quiver(grains,grains.meanOrientation.r_001,'color','r')
all the best David
You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mtex-toolbox/mtex/issues/222, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIXQU3mx-218bRNE5P8XINOoR5IM1knhks5q-GF7gaJpZM4KxULf.
Dear Zach,
Thanks for you suggestion, my idea is that "MTEX quiver" as I called it for ebsd or grains should have the possibility of adding an other vector3d data, not just those properties of ebsd or grains.
I can plot these things using MATLAB quiver using hold on and off.
Example
% use grain mean orientaton and centroid to plot [100] directions on map
r_100_mO = grains('fo').meanOrientation*Miller(1,0,0,ebsd('fo').CS,’uvw');
% x,y coordinates of centroid for each grain
XY_centroid = grains('fo').centroid;
close all
figure
% plot grains
plot(grains('fo'))
hold on
% plot grain boundary outline
plot(grains('fo').boundary,'lineColor','k','LineWidth',2)
hold on
% plot crystallograpic axes in specimen coordinates
quiver(XY_centroid(:,1),XY_centroid(:,2),r_100_mO.x,r_100_mO.y,'m','LineWidth',2)
But some of these functionality are already built-in to "MTEX quiver”, the possibility of adding any vector3d data to grain (or ebsd) structure would result in much simpler syntax in MTEX.
So start plotting those arrows ...
all the best David
Yes.
My point was simply that you can use “mate quiver” to replicate the line you wrote:
quiver(XY_centroid(:,1),XY_centroid(:,2),r_100_mO.x,r_100_mO.y,'m','LineWidth',2)
with:
quiver(grains_fo,r_100_mO,'m','LineWidth',2)
if you want to make the arrows longer… you can multiply by some scaler…
quiver(grains_fo,r_100_mO*3,'m','LineWidth',2)
cheers, Zach
On Nov 14, 2016, at 9:39 AM, DavidMainprice notifications@github.com<mailto:notifications@github.com> wrote:
Dear Zach,
Thanks for you suggestion, my idea is that "MTEX quiver" as I called it for ebsd or grains should have the possibility of adding an other vector3d data, not just those properties of ebsd or grains.
I can plot these things using MATLAB quiver using hold on and off.
Example % use grain mean orientaton and centroid to plot [100] directions on map r_100_mO = grains('fo').meanOrientation*Miller(1,0,0,ebsd('fo').CS,’uvw'); % x,y coordinates of centroid for each grain XY_centroid = grains('fo').centroid; close all figure % plot grains plot(grains('fo')) hold on % plot grain boundary outline plot(grains('fo').boundary,'lineColor','k','LineWidth',2) hold on % plot crystallograpic axes in specimen coordinates quiver(XY_centroid(:,1),XY_centroid(:,2),r_100_mO.x,r_100_mO.y,'m','LineWidth',2)
But some of these functionality are already built-in to "MTEX quiver”, the possibility of adding any vector3d data to grain (or ebsd) structure would result in much simpler syntax in MTEX.
So start plotting those arrows ...
all the best David
Le 14 nov. 2016 à 15:46, Zachary Michels notifications@github.com<mailto:notifications@github.com> a écrit :
David,
I understand that your question is regarding how can we add data to the grains, and I don't know the answer to that. However, if by chance the motivation for your question is so that you can make quiver plots like the ones you mentioned, you do not need to append the grains structure to make them. In your example, if you calculate grains_fo and r_001 as you did, you can make the quiver plot by doing:
quiver(grains_fo,r_001,'color','r');
Granted that does nothing to append the grain data-structure... but the plot can be made. I, too, would like to be able to append grain data, but I think that the grain objects are not designed to allow this. When I try, I get the error: "No public field r_001 exists for class grain2d." I think this suggests that the objects are not setup to allow you to create/set properties dynamically.
Best, Zach
On Nov 14, 2016, at 7:27 AM, DavidMainprice notifications@github.com<mailto:notifications@github.commailto:notifications@github.com> wrote:
We have the possibility of plotting grains vector3d properties at the grain centroid using MTEX quiver
%% example of using MTEX quiver with grains mtexdata fo close all figure grains = calcGrains(ebsd('indexed')) % standard plot at grain centroids the meanRotation.axis quiver(grains,grains.meanRotation.axis,'color','r') where the vector3d property meanRotation.axis already exists
If I want add a vector3d property to grains how can I do this.
for example the c-axes orientation in specimens coordinates grains_fo = grains('fo'); % [001] axes in specimen coordinates using mean grain orientation r_001 = grains_fo.meanOrientation*Miller(0,0,1,ebsd('Forsterite').CS,'uvw');
like quiver(grains,grains.r_001,'color','r') or quiver(grains,grains.meanOrientation.r_001,'color','r')
all the best David
You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mtex-toolbox/mtex/issues/222, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIXQU3mx-218bRNE5P8XINOoR5IM1knhks5q-GF7gaJpZM4KxULf. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mtex-toolbox/mtex/issues/222#issuecomment-260353388, or mute the thread https://github.com/notifications/unsubscribe-auth/AKN1JDTMQJCQz_hBm43_4YD70Menv322ks5q-HRBgaJpZM4KxULf.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/mtex-toolbox/mtex/issues/222#issuecomment-260369550, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIXQU8ID2wbLTraIgpUoWeRy5dLNgUOfks5q-IDKgaJpZM4KxULf.
Dear Zach,
Thanks that is shorter syntax, that uses the MTEX quiver as you can see by the arrow type, effectively it is a rather small arrow !
all the best David
Le 14 nov. 2016 à 16:53, Zachary Michels notifications@github.com a écrit :
Yes.
My point was simply that you can use “mate quiver” to replicate the line you wrote:
quiver(XY_centroid(:,1),XY_centroid(:,2),r_100_mO.x,r_100_mO.y,'m','LineWidth',2)
with:
quiver(grains_fo,r_100_mO,'m','LineWidth',2)
if you want to make the arrows longer… you can multiply by some scaler…
quiver(grains_fo,r_100_mO*3,'m','LineWidth',2)
cheers, Zach
On Nov 14, 2016, at 9:39 AM, DavidMainprice notifications@github.com<mailto:notifications@github.com> wrote:
Dear Zach,
Thanks for you suggestion, my idea is that "MTEX quiver" as I called it for ebsd or grains should have the possibility of adding an other vector3d data, not just those properties of ebsd or grains.
I can plot these things using MATLAB quiver using hold on and off.
Example % use grain mean orientaton and centroid to plot [100] directions on map r_100_mO = grains('fo').meanOrientation*Miller(1,0,0,ebsd('fo').CS,’uvw'); % x,y coordinates of centroid for each grain XY_centroid = grains('fo').centroid; close all figure % plot grains plot(grains('fo')) hold on % plot grain boundary outline plot(grains('fo').boundary,'lineColor','k','LineWidth',2) hold on % plot crystallograpic axes in specimen coordinates quiver(XY_centroid(:,1),XY_centroid(:,2),r_100_mO.x,r_100_mO.y,'m','LineWidth',2)
But some of these functionality are already built-in to "MTEX quiver”, the possibility of adding any vector3d data to grain (or ebsd) structure would result in much simpler syntax in MTEX.
So start plotting those arrows ...
all the best David
Le 14 nov. 2016 à 15:46, Zachary Michels notifications@github.com<mailto:notifications@github.com> a écrit :
David,
I understand that your question is regarding how can we add data to the grains, and I don't know the answer to that. However, if by chance the motivation for your question is so that you can make quiver plots like the ones you mentioned, you do not need to append the grains structure to make them. In your example, if you calculate grains_fo and r_001 as you did, you can make the quiver plot by doing:
quiver(grains_fo,r_001,'color','r');
Granted that does nothing to append the grain data-structure... but the plot can be made. I, too, would like to be able to append grain data, but I think that the grain objects are not designed to allow this. When I try, I get the error: "No public field r_001 exists for class grain2d." I think this suggests that the objects are not setup to allow you to create/set properties dynamically.
Best, Zach
On Nov 14, 2016, at 7:27 AM, DavidMainprice notifications@github.com<mailto:notifications@github.commailto:notifications@github.com> wrote:
We have the possibility of plotting grains vector3d properties at the grain centroid using MTEX quiver
%% example of using MTEX quiver with grains mtexdata fo close all figure grains = calcGrains(ebsd('indexed')) % standard plot at grain centroids the meanRotation.axis quiver(grains,grains.meanRotation.axis,'color','r') where the vector3d property meanRotation.axis already exists
If I want add a vector3d property to grains how can I do this.
for example the c-axes orientation in specimens coordinates grains_fo = grains('fo'); % [001] axes in specimen coordinates using mean grain orientation r_001 = grains_fo.meanOrientation*Miller(0,0,1,ebsd('Forsterite').CS,'uvw');
like quiver(grains,grains.r_001,'color','r') or quiver(grains,grains.meanOrientation.r_001,'color','r')
all the best David
You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mtex-toolbox/mtex/issues/222, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIXQU3mx-218bRNE5P8XINOoR5IM1knhks5q-GF7gaJpZM4KxULf. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mtex-toolbox/mtex/issues/222#issuecomment-260353388, or mute the thread https://github.com/notifications/unsubscribe-auth/AKN1JDTMQJCQz_hBm43_4YD70Menv322ks5q-HRBgaJpZM4KxULf.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/mtex-toolbox/mtex/issues/222#issuecomment-260369550, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIXQU8ID2wbLTraIgpUoWeRy5dLNgUOfks5q-IDKgaJpZM4KxULf.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mtex-toolbox/mtex/issues/222#issuecomment-260373865, or mute the thread https://github.com/notifications/unsubscribe-auth/AKN1JDDCSVjWkrDDdg6gipbWDPXyGFtEks5q-IQOgaJpZM4KxULf.
Hi David,
this can be done by
grains_fo.prop.r_001 = grains_fo.meanOrientation*Miller(0,0,1,ebsd('Forsterite').CS,'uvw');
after this you can assign the property as any other property with
quiver(grains_fo,grains_fo.r_001,'color','r')
This works also for EBSD data and allows for subsindexing in all variants.
Ralf.
Excellent.
Cheers, Zach
On Nov 14, 2016, at 2:09 PM, Ralf Hielscher notifications@github.com<mailto:notifications@github.com> wrote:
Hi David,
this can be done by
grains_fo.prop.r_001 = grains_fo.meanOrientation*Miller(0,0,1,ebsd('Forsterite').CS,'uvw');
after this you can assign the property as any other property with
quiver(grains_fo,grains_fo.r_001,'color','r')
This works also for EBSD data and allows for subsindexing in all variants.
Ralf.
You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/mtex-toolbox/mtex/issues/222#issuecomment-260447611, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIXQU7sdGCTiyvmPheNIGOY67OgP5hPSks5q-L_ogaJpZM4KxULf.
Dear Ralf,
Many thanks.
It was pointed out to me by Zac that you can also write
r_001 = grains_fo.meanOrientation*Miller(0,0,1,ebsd('Forsterite').CS,'uvw’);
quiver(grains_fo,r_001,'Color','m','LineWidth',2)
Still useful to know that we can add properties using this syntax grains_fo.prop.new_property
all the best David
Le 14 nov. 2016 à 21:09, Ralf Hielscher notifications@github.com a écrit :
Hi David,
this can be done by
grains_fo.prop.r_001 = grains_fo.meanOrientation*Miller(0,0,1,ebsd('Forsterite').CS,'uvw'); after this you can assign the property as any other property with
quiver(grains_fo,grains_fo.r_001,'color','r') This works also for EBSD data and allows for subsindexing in all variants.
Ralf.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mtex-toolbox/mtex/issues/222#issuecomment-260447611, or mute the thread https://github.com/notifications/unsubscribe-auth/AKN1JBe5-duX63CMui6oa36FIPu8WUH1ks5q-L_ogaJpZM4KxULf.
Excellent possibilities, however I experienced an error when adding property to only grains of one phase.
That error was avoid by preassigning a arbitrary value to that property for all grains:
Grains_Therapy = zeros(1,length(grains));
grains.prop.Therapy = Grains_Therapy ;
grains('mineral1').Therapy =somefunction;
Hi Bjoern,
your solution is good. But for me suprisingly also the direct way works:
grains('fo').prop.xxx = 1:length(grains('fo')
for all other phases xxx is set to 0 with this code.
Ralf.
Yes it also worked for me the first times I ran it, however it arbitrarily stopped working and came with error even after restart of Matlab. I suspect this is really a mistake that occurred in Matlab and was stored somehow.
We have the possibility of plotting grains vector3d properties at the grain centroid using MTEX quiver
where the vector3d property meanRotation.axis already exists
If I want add a vector3d property to grains how can I do this.
for example the c-axes orientation in specimens coordinates
like
or
all the best David