-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspecrsettings.m
More file actions
249 lines (240 loc) · 9.07 KB
/
Copy pathspecrsettings.m
File metadata and controls
249 lines (240 loc) · 9.07 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
function specrsetting(varargin)
% GUI for specr settings
hFigSpecr = findall(0,'Tag','specr_Fig'); % handle of the mother figure (specr)
settings = getappdata(hFigSpecr,'settings');
icons = load('icons.mat');
% --- figure layout
p0 = get(hFigSpecr,'position'); % main figure position
p1(3) = 480; % p1 is the setting figure position
p1(4) = 375;
p1(1) = p0(1)+p0(3)/2-p1(3)/2;
p1(2) = p0(2)+p0(4)/2-p1(4)/2;
h = figure(...
'Units','pixels',...
'MenuBar','none',...
'Units','pixels',...
'Name','Spec Reader Settings',...
'NumberTitle','off',...
'IntegerHandle','off',...
'Position',p1,...
'HandleVisibility','callback',...
'Tag','figSpecrSettings',...
'Resize','off',...
'WindowStyle','modal',...
'UserData',[]);
panelSize = [10 60 p1(3)-20 p1(4)-70];
hPanel1 = uipanel(...
'Parent',h,...
'BackgroundColor',get(h,'Color'),...
'Title','Settings',...
'Units','pixels',...
'Position',panelSize);
hText1 = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[10 panelSize(4)-35 panelSize(3)*2/3-10 15],...
'String','Wavelength: (Angstrom)');
hEdit1 = uicontrol(...
'Parent',hPanel1,...
'Style','edit',...
'BackgroundColor','w',...
'Position',[panelSize(3)*2/3 panelSize(4)-35 panelSize(3)/3-27 20],...
'String',num2str(settings.wavelength,15),...
'HorizontalAlignment','left');
hPushbutton1 = uicontrol(...
'Parent',hPanel1,...
'Style','pushbutton',...
'CDATA',icons.calculator,...
'Position',[panelSize(3)-24 panelSize(4)-35 14 18],...
'callback','engwav');
hText2 = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[10 panelSize(4)-58 panelSize(3)*2/3-10 15],...
'String','Footprint angle on incident side: (degree)');
hEdit2 = uicontrol(...
'Parent',hPanel1,...
'Style','edit',...
'BackgroundColor','w',...
'Position',[panelSize(3)*2/3 panelSize(4)-58 panelSize(3)/3-10 20],...
'String',num2str(settings.footprintAngle,15),...
'HorizontalAlignment','left');
hText3 = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[10 panelSize(4)-81 panelSize(3)*2/3-10 15],...
'String','Scan merging settings:');
hText3a = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[20 panelSize(4)-104 panelSize(3)*2/3-20 15],...
'String','Discarding mode (for overlapped region)');
hPopupmenu3a = uicontrol(...
'Parent',hPanel1,...
'Style','popupmenu',...
'HorizontalAlignment','left',...
'BackgroundColor','w',...
'Position',[panelSize(3)*2/3 panelSize(4)-104 panelSize(3)/3-10 20],...
'String','Intensity priority|Number-of-point priority (default)',...
'Value',settings.merge.mode);
hText3b = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[20 panelSize(4)-127 panelSize(3)*2/3-20 15],...
'String','Interpolation method (for merging factors)');
hPopupmenu3b = uicontrol(...
'Parent',hPanel1,...
'Style','popupmenu',...
'HorizontalAlignment','left',...
'BackgroundColor','w',...
'Position',[panelSize(3)*2/3 panelSize(4)-127 panelSize(3)/3-10 20],...
'String','spline (default)|linear|nearest|cubic',...
'Value',settings.merge.interpMethod);
hText4 = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[10 panelSize(4)-150 panelSize(3)*2/3-10 15],...
'String','Scan monitor settings:');
hText4a = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[20 panelSize(4)-173 panelSize(3)*2/3-10 15],...
'String','Checking period (sec)');
hEdit4a = uicontrol(...
'Parent',hPanel1,...
'Style','edit',...
'BackgroundColor','w',...
'Position',[panelSize(3)*2/3 panelSize(4)-173 panelSize(3)/3-10 20],...
'String',num2str(settings.monitorPeriod,15),...
'HorizontalAlignment','left');
hText4b = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[20 panelSize(4)-196 panelSize(3)*2/3-10 15],...
'String','Automatically ajusting checking period (for large scans)');
hPopupmenu4b = uicontrol(...
'Parent',hPanel1,...
'Style','popupmenu',...
'HorizontalAlignment','left',...
'BackgroundColor','w',...
'Position',[panelSize(3)*2/3 panelSize(4)-196 panelSize(3)/3-10 20],...
'String','on (default)|off',...
'Value',settings.monitorAutoPeriodMode);
hText5 = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[10 panelSize(4)-219 panelSize(3)*2/3-10 15],...
'String','Mesh scan plot settings settings:');
hText5a = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[20 panelSize(4)-242 panelSize(3)*2/3-10 15],...
'String','Select 3D plot type');
hPopupmenu5a = uicontrol(...
'Parent',hPanel1,...
'Style','popupmenu',...
'HorizontalAlignment','left',...
'BackgroundColor','w',...
'Position',[panelSize(3)*2/3 panelSize(4)-242 panelSize(3)/3-10 20],...
'String','contour (default)|filled contour|mesh plot|surface plot|image',...
'Value',settings.meshScanPlotType);
hText5b = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[20 panelSize(4)-265 panelSize(3)*2/3-10 15],...
'String','Plot in log scale?');
hPopupmenu5b = uicontrol(...
'Parent',hPanel1,...
'Style','popupmenu',...
'HorizontalAlignment','left',...
'BackgroundColor','w',...
'Position',[panelSize(3)*2/3 panelSize(4)-265 panelSize(3)/3-10 20],...
'String','yes|no (default)',...
'Value',settings.meshScanPlotScale);
hText5c = uicontrol(...
'Parent',hPanel1,...
'Style','text',...
'HorizontalAlignment','left',...
'BackgroundColor',get(h,'Color'),...
'Position',[20 panelSize(4)-288 panelSize(3)*2/3-10 15],...
'String','Export mesh data to workspace automatically?');
hPopupmenu5c = uicontrol(...
'Parent',hPanel1,...
'Style','popupmenu',...
'HorizontalAlignment','left',...
'BackgroundColor','w',...
'Position',[panelSize(3)*2/3 panelSize(4)-288 panelSize(3)/3-10 20],...
'String','yes|no (default)',...
'Value',settings.meshScanExport2WS);
hPushbuttonOK = uicontrol(...
'Parent',h,...
'Style','pushbutton',...
'String','OK',...
'Position',[p1(3)-180 20 80 25],...
'callback',{@specrsettings_OKRequestFcn,hFigSpecr,h,hEdit1,hEdit2,hPopupmenu3a,hPopupmenu3b,hEdit4a,hPopupmenu4b,hPopupmenu5a,hPopupmenu5b,hPopupmenu5c});
hPushbuttonCancel = uicontrol(...
'Parent',h,...
'Style','pushbutton',...
'String','Cancel',...
'Position',[p1(3)-90 20 80 25],...
'Callback',@specrsettings_CloseRequestFcn);
%================================================================
% --- specrsettings close function
%================================================================
function specrsettings_CloseRequestFcn(hObject,eventdata)
delete(gcf);
return;
%================================================================
% --- specrsettings close function
%================================================================
function specrsettings_OKRequestFcn(hObject,eventdata,hFigSpecr,h,hEdit1,hEdit2,hPopupmenu3a,hPopupmenu3b,hEdit4a,hPopupmenu4b,hPopupmenu5a,hPopupmenu5b,hPopupmenu5c)
settings = getappdata(hFigSpecr,'settings');
wavelength = str2double(get(hEdit1,'string'));
if isnan(wavelength) | wavelength<=0
uiwait(msgbox('Invalid wavelength!','Settings Error','error','modal'));
return;
end
settings.wavelength = wavelength;
footprintAngle = str2double(get(hEdit2,'string'));
if isnan(footprintAngle) | footprintAngle<=0
uiwait(msgbox('Invalid foot print angle!','Settings Error','error','modal'));
return;
end
settings.footprintAngle = footprintAngle;
settings.merge.mode = get(hPopupmenu3a,'value');
settings.merge.interpMethod = get(hPopupmenu3b,'value');
monitorPeriod = str2double(get(hEdit4a,'string'));
if isnan(monitorPeriod) | monitorPeriod<0.001
uiwait(msgbox({'Invalid monitor period: must be larger than 0.1 sec.'},'Settings Error','error','modal'));
return;
end
settings.monitorPeriod = monitorPeriod;
settings.monitorAutoPeriodMode = get(hPopupmenu4b,'value');
settings.meshScanPlotType = get(hPopupmenu5a,'value');
settings.meshScanPlotScale = get(hPopupmenu5b,'value');
settings.meshScanExport2WS = get(hPopupmenu5c,'value');
setappdata(hFigSpecr,'settings',settings);
delete(h);
return;