-
Notifications
You must be signed in to change notification settings - Fork 24
/
start_AstroEBSD.m
138 lines (107 loc) · 3.52 KB
/
start_AstroEBSD.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
function Astro_FP=start_AstroEBSD(varargin)
% Load AstroEBSD
%pc or mac
if ispc==1
link='\';
else
link='/';
end
%set up the path
local_path = fileparts(mfilename('fullpath'));
fprintf('Loading AstroEBSD');
if MATLABverLessThan('9.0')
error('AstroEBSD needs at least version 9 of Matlab')
end
%read Astro version from version file - adapted from MTEX
try
fid = fopen('VERSION','r');
AstroVersion = fgetl(fid);
fclose(fid);
fprintf([' ' AstroVersion ' ']);
catch
AstroVersion = 'AstroEBSD';
end
%initalise folders as needed
% %read the current folder
% astroloc=strfind(local_path,'AstroEBSD');
%
% %check that w are in a subfolder
% if isempty(astroloc)
% error('Path must be run first from a subfolder of ''AstroEBSD''');
% end
%
% %get the file path
% Astro_FP=local_path(1:astroloc+8);
Astro_FP=local_path;
%build folders for things if this is a first run
if exist([Astro_FP, link,'testing'],'dir') ~= 7
mkdir([Astro_FP, link,'testing']);
end
if exist([Astro_FP ,link,'outputs'],'dir') ~= 7
mkdir([Astro_FP ,link,'outputs']);
end
if exist([Astro_FP ,link,'decks'],'dir') ~= 7
mkdir([Astro_FP ,link,'decks']);
end
%build the paths
addpath([Astro_FP,link, 'decks']);
addpath([Astro_FP,link, 'decks',link,'PCA']);
addpath([Astro_FP,link, 'decks',link,'RTM']);
addpath([Astro_FP,link, 'gen',link,'loading']);
addpath([Astro_FP,link, 'gen',link,'prep']);
addpath([Astro_FP,link, 'modules',link,'indexing']);
addpath([Astro_FP,link, 'modules',link,'pca']);
addpath([Astro_FP,link, 'modules',link,'pca',link,'Analysis']);
addpath([Astro_FP,link, 'modules',link,'pca',link,'Analysis',link,'Bruker_Spectra_Hack']);
addpath([Astro_FP,link, 'modules',link,'pca',link,'bin']);
addpath([Astro_FP,link, 'modules',link,'pca',link,'LoadingData']);
addpath([Astro_FP,link, 'modules',link,'pca',link,'plugins']);
addpath([Astro_FP,link, 'modules',link,'pca',link,'plugins',link,'cbrewer']);
addpath([Astro_FP,link, 'modules',link,'pca',link,'plugins',link,'Colormaps']);
addpath([Astro_FP,link, 'modules',link,'pca',link,'RunPCA']);
addpath([Astro_FP,link, 'modules',link,'ded_tkd']);
addpath([Astro_FP,link, 'modules',link,'ded_general']);
addpath([Astro_FP,link, 'modules',link,'ded_ebsd']);
addpath([Astro_FP,link, 'modules',link,'rtm']);
addpath([Astro_FP,link, 'modules',link,'rtm',link,'bin']);
addpath([Astro_FP,link, 'modules',link,'rtm',link,'example_patterns']);
addpath([Astro_FP,link, 'modules',link,'rtm',link,'logsample']);
addpath([Astro_FP,link, 'modules',link,'rtm',link,'runRTM']);
addpath([Astro_FP,link, 'modules',link,'rtm',link,'misc_refine']);
addpath([Astro_FP,link, 'utils']);
addpath([Astro_FP,link, 'phases']);
addpath([Astro_FP,link, 'testing']);
addpath([Astro_FP,link, 'outputs']);
addpath([Astro_FP,link, 'plot']);
addpath([Astro_FP,link, 'modules',link,'ded_tkd']);
addpath([Astro_FP]);
disp('AstroEBSD file paths loaded');
end
% check MATLAB version - borrowed from MTEX loader
% --------------------
function result = MATLABverLessThan(verstr)
MATLABver = ver('MATLAB');
toolboxParts = getParts(MATLABver(1).Version);
verParts = getParts(verstr);
result = (sign(toolboxParts - verParts) * [1; .1; .01]) < 0;
end
function parts = getParts(V)
parts = sscanf(V, '%d.%d.%d')';
if length(parts) < 3
parts(3) = 0; % zero-fills to 3 elements
end
end
function p()
if isempty(lasterr)
fprintf('.');
end
end
function pathadd(path)
pathCell = regexp(path, pathsep, 'split');
if ispc % Windows is not case-sensitive
onPath = any(strcmpi(Folder, pathCell));
else
onPath = any(strcmp(Folder, pathCell));
end
end
%eof