parametrizing

This commit is contained in:
Martin Diehl 2019-12-11 17:38:31 +01:00
parent 37e52fd81f
commit bd12ef83b9
1 changed files with 29 additions and 87 deletions

View File

@ -1,99 +1,41 @@
%% Import Script for EBSD Data
%
% Start MTEX first in Matlab % Start MTEX first in Matlab
clear ; clear all ; close;
%% Specify Crystal and Specimen Symmetries tmp = matlab.desktop.editor.getActive;
cd(fileparts(tmp.Filename));
% crystal symmetry
CS_bcc = {...
crystalSymmetry('m-3m', [2.8665 2.8665 2.8665], 'mineral', 'Iron-alpha', 'color', 'light blue'),...
crystalSymmetry('m-3m', [1 1 1], 'color', 'light blue')};
CS_fcc = {... %% Specify Crystal
crystalSymmetry('m-3m', [3.662 3.662 3.662], 'mineral', 'Iron', 'color', 'light blue'),... symmetry = {crystalSymmetry('m-3m', [1 1 1], 'mineral', 'Iron', 'color', 'light blue')}
crystalSymmetry('m-3m', [1 1 1], 'color', 'light blue')};
% plotting convention % plotting convention
setMTEXpref('xAxisDirection','north'); setMTEXpref('xAxisDirection','north');
setMTEXpref('zAxisDirection','outOfPlane'); setMTEXpref('zAxisDirection','outOfPlane');
%% path to files
pname = 'L:\f.gallardo\DAMASK\python\tests\reference\Rotation'; % has to be changed to hwere you have DAMASK
% which files to be imported lattice_types = {'BCC','FCC'};
fname1 = [pname '\bcc_Bain.txt']; fname2 = [pname '\bcc_GT.txt']; fname3 = [pname '\bcc_GT_prime.txt']; models = {'Bain','GT','GT_prime','KS','NW','Pitsch'};
fname4 = [pname '\bcc_KS.txt']; fname5 = [pname '\bcc_NW.txt']; fname6 = [pname '\bcc_Pitsch.txt'];
fname7 = [pname '\fcc_Bain.txt']; fname8 = [pname '\fcc_GT.txt']; fname9 = [pname '\fcc_GT_prime.txt'];
fname10 = [pname '\fcc_KS.txt']; fname11 = [pname '\fcc_NW.txt']; fname12 = [pname '\fcc_Pitsch.txt'];
rotation = containers.Map;
rotation('BCC') = 'Passive Rotation';
rotation('FCC') = 'Active Rotation';
%% Import the Data for lattice = lattice_types
for p = 0:length(models)/3-1
% create an EBSD variable containing the data p
ebsd1 = loadEBSD(fname1,CS_bcc,'interface','generic',... EBSD_data = {loadEBSD(strcat(lattice,'_',models{p*3+1},'.txt'),symmetry,'interface','generic',...
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Passive Rotation'); 'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', rotation(char(lattice))),
ebsd2 = loadEBSD(fname2,CS_bcc,'interface','generic',... loadEBSD(strcat(lattice,'_',models{p*3+2},'.txt'),symmetry,'interface','generic',...
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Passive Rotation'); 'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', rotation(char(lattice))),
ebsd3 = loadEBSD(fname3,CS_bcc,'interface','generic',... loadEBSD(strcat(lattice,'_',models{p*3+3},'.txt'),symmetry,'interface','generic',...
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Passive Rotation'); 'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', rotation(char(lattice)))}
ebsd4 = loadEBSD(fname4,CS_bcc,'interface','generic',... h = [Miller(1,0,0,symmetry{1}),Miller(1,1,0,symmetry{1}),Miller(1,1,1,symmetry{1})]; % 3 pole figures
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Passive Rotation'); plotPDF(EBSD_data{1}.orientations,h,'MarkerSize',5,'MarkerColor','r','DisplayName',models{p*3+1})
ebsd5 = loadEBSD(fname5,CS_bcc,'interface','generic',... hold on
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Passive Rotation'); plotPDF(EBSD_data{2}.orientations,h,'MarkerSize',5,'MarkerColor','b','DisplayName',models{p*3+2})
ebsd6 = loadEBSD(fname6,CS_bcc,'interface','generic',... plotPDF(EBSD_data{3}.orientations,h,'MarkerSize',5,'MarkerColor','g','DisplayName',models{p*3+3})
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Passive Rotation'); legend('show','location','southoutside')
orient('landscape')
ebsd7 = loadEBSD(fname7,CS_fcc,'interface','generic',... print('-bestfit',strcat(int2str(p+1),'_',char(lattice),'.pdf'),'-dpdf')
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Active Rotation'); close
ebsd8 = loadEBSD(fname8,CS_fcc,'interface','generic',... end
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Active Rotation'); end
ebsd9 = loadEBSD(fname9,CS_fcc,'interface','generic',...
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Active Rotation');
ebsd10 = loadEBSD(fname10,CS_fcc,'interface','generic',...
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Active Rotation');
ebsd11 = loadEBSD(fname11,CS_fcc,'interface','generic',...
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Active Rotation');
ebsd12 = loadEBSD(fname12,CS_fcc,'interface','generic',...
'ColumnNames', { 'phi1' 'Phi' 'phi2' 'x' 'y'}, 'Bunge', 'Active Rotation');
%% Plot Data 1stpart_bcc
h1 = [Miller(1,0,0,ebsd1.CS),Miller(1,1,0,ebsd1.CS),Miller(1,1,1,ebsd1.CS)]; % 3 pole figures
plotPDF(ebsd1.orientations,h1,'MarkerSize',5,'MarkerColor','r','MarkerEdgeColor','r','DisplayName','BCC-Bain')
hold on
plotPDF(ebsd2.orientations,h1,'MarkerSize',5,'MarkerColor','w','MarkerEdgeColor','b','DisplayName','BCC-GT')
plotPDF(ebsd3.orientations,h1,'MarkerSize',5,'MarkerColor','w','MarkerEdgeColor','g','DisplayName','BCC-GT_Prime')
legend('show','location','southoutside')
cd 'L:\f.gallardo\DAMASK\python\tests\reference\Rotation'; % has to be changed
orient('landscape')
print('-bestfit','1_BCC.pdf','-dpdf')
%% Plot Data 2nd part_bcc
close
plotPDF(ebsd4.orientations,h1,'MarkerSize',5,'MarkerColor','r','MarkerEdgeColor','w','DisplayName','BCC-KS')
hold on
plotPDF(ebsd5.orientations,h1,'MarkerSize',5,'MarkerColor','w','MarkerEdgeColor','m','DisplayName','BCC-NW')
plotPDF(ebsd6.orientations,h1,'MarkerSize',5,'MarkerColor','y','MarkerEdgeColor','w','DisplayName','BCC-Pitsch')
legend('show','location','southoutside')
print('-bestfit','2_BCC.pdf','-dpdf')
%% Plot Data 1stpart_fcc
close
h2 = [Miller(1,0,0,ebsd7.CS),Miller(1,1,0,ebsd7.CS),Miller(1,1,1,ebsd7.CS)]; % 3 pole figures
plotPDF(ebsd7.orientations,h2,'MarkerSize',5,'MarkerColor','r','MarkerEdgeColor','r','DisplayName','FCC-Bain')
hold on
plotPDF(ebsd8.orientations,h2,'MarkerSize',5,'MarkerColor','w','MarkerEdgeColor','b','DisplayName','FCC-GT')
plotPDF(ebsd9.orientations,h2,'MarkerSize',5,'MarkerColor','w','MarkerEdgeColor','g','DisplayName','FCC-GT_Prime')
legend('show','location','southoutside')
print('-bestfit','1_FCC.pdf','-dpdf')
%% Plot Data 2nd part_bcc
close
plotPDF(ebsd10.orientations,h2,'MarkerSize',5,'MarkerColor','r','MarkerEdgeColor','w','DisplayName','FCC-KS')
hold on
plotPDF(ebsd11.orientations,h2,'MarkerSize',5,'MarkerColor','w','MarkerEdgeColor','m','DisplayName','FCC-NW')
plotPDF(ebsd12.orientations,h2,'MarkerSize',5,'MarkerColor','y','MarkerEdgeColor','w','DisplayName','FCC-Pitsch')
legend('show','location','southoutside')
print('-bestfit','2_FCC.pdf','-dpdf')
close