-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexperimentWindow.pro
More file actions
executable file
·538 lines (500 loc) · 20.6 KB
/
Copy pathexperimentWindow.pro
File metadata and controls
executable file
·538 lines (500 loc) · 20.6 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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
; *******************************************************************
; PolydefixED stress, strain, and texture analysis for experiment in
; energy dispersive geometry
; Copyright (C) 2000-2011 S. Merkel, Universite Lille 1
; http://merkel.zoneo.net/Multifit/
;
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version 2
; of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
;
; *******************************************************************
FORWARD_FUNCTION experimentWindow
; ****************************************** about window **************
PRO aboutWindow_event, ev
WIDGET_CONTROL, ev.TOP, /DESTROY
END
pro aboutWindow, base
common fonts, titlefont, boldfont
basedialog = WIDGET_BASE(/COLUMN, /MODAL, GROUP_LEADER=base, Title='About Polydefix')
infobase = WIDGET_BASE(basedialog,/COLUMN)
la = WIDGET_TEXT(infobase, XSIZE=80, YSIZE=25, /ALIGN_LEFT, /EDITABLE, /WRAP)
ccr = STRING(13B) ; Carriage Return
clf = STRING([10B]) ; line feed
text = "PolydefixED" + clf
text += "Homepage: http://merkel.zoneo.net/Multifit-Polydefix" + clf + clf
text += "Multifit/Polydefix is an open-source IDL software package for an efficient processing of diffraction data obtained in deformation apparatuses at synchrotron beamlines. It is a compound of three different packages that can be run independently. Polydefix is for lattice strains, pressure, stress, and texture analysis. It will start from the output files created in Multifit and extract the information required for establishing the rheological behavior of the sample. PolydefixED is an adaptation of Polydefix for the specific needs of data collected using the array of energy dispersive detectors that was installed on the the X17B2 beamline of the National Synchrotron Light Source, USA." + clf + clf
text += "Copyright S. Merkel, N. Hilairet Universite Lille 1, France" + clf
text += "Polydefix is open source software, licensed under the GPL Version 2." + clf
text += "" + clf
text += "If you use results of Multifit/Polydefix in scientific publications, please refer to the following paper" + clf + clf
text += "S. Merkel and N. Hilairet, Multifit/Polydefix: a Framework for the Analysis of Polycrystal Deformation using X-Rays, Journal of Applied Crystallography, 48 (2015) [doi: 10.1107/S1600576715010390]."
WIDGET_CONTROL, la, SET_VALUE=text, /APPEND
WIDGET_CONTROL, la, SET_TEXT_TOP_LINE=0
buttons = WIDGET_BASE(basedialog,/ROW, /GRID_LAYOUT, /ALIGN_CENTER)
ok = WIDGET_BUTTON(buttons, VALUE='Ok', UVALUE='OK')
WIDGET_CONTROL, basedialog, /REALIZE
XMANAGER, 'aboutWindow', basedialog
end
; ************************************************************ setFitOptions ****************
; Functions to deal with offsets and fit options
; new in 1.3, 01-2010
pro doChangeOptions, stash
common experimentwindow, set, experiment
widget_control, stash.bgroupOffset, GET_VALUE=fitoffset
WIDGET_CONTROL, stash.inputOffsetSt, GET_VALUE=offsetS
offset = FLOAT(offsetS[0])
experiment->setFitOffset, fitoffset
experiment->setOffset, offset
WIDGET_CONTROL, stash.baseOffset, SET_VALUE=strtrim(string(experiment->getOffset()),2)
if (experiment->getFitOffset() eq 1) then begin
WIDGET_CONTROL, stash.baseFitOffset, SET_VALUE='Yes'
endif else WIDGET_CONTROL, stash.baseFitOffset, SET_VALUE='No'
logit, stash.log, "Changed fitting options and offset angle...\n"
WIDGET_CONTROL, stash.input, /DESTROY
end
PRO setFitOptions_event, ev
; Get the 'stash' structure.
WIDGET_CONTROL, ev.TOP, GET_UVALUE=stash
WIDGET_CONTROL, ev.ID, GET_UVALUE=uval
CASE ev.id OF
stash.inputOffsetSt:
else: begin
CASE uval OF
'OK': doChangeOptions, stash
'CANCEL': WIDGET_CONTROL, stash.input, /DESTROY
else:
ENDCASE
endcase
endcase
END
pro setFitOptions, base, baseOffset, baseFitOffset, log
common experimentwindow, set, experiment
if (set eq 0) then begin
tmp = DIALOG_MESSAGE("Error: you need to input some data first", /ERROR)
return
endif
; Getting the number of peaks (we may get an error)
CATCH, Error_status
IF Error_status NE 0 THEN BEGIN
themessage = !ERROR_STATE.MSG
tmp = DIALOG_MESSAGE(themessage, /ERROR)
return
endif
fitoffset = experiment->getFitOffset()
offset = experiment->getOffset()
; Prepare a gui
input = WIDGET_BASE(/COLUMN, Title='Fit options', /MODAL, GROUP_LEADER=base)
inputMacLa = WIDGET_LABEL(input, VALUE='Fit options', /ALIGN_CENTER, font=titlefont)
options = WIDGET_BASE(input, COLUMN=3, /GRID_LAYOUT, FRAME=1)
compLa = WIDGET_LABEL(options, VALUE='Azimuth of compression direction', /ALIGN_LEFT)
fitOffsetLa = WIDGET_LABEL(options, VALUE='Fit offset for compression', /ALIGN_LEFT)
inputOffsetSt = WIDGET_TEXT(options, VALUE=strtrim(string(offset),2), XSIZE=20, /EDITABLE)
values = ['No', 'Yes']
bgroupOffset = CW_BGROUP(options, values, /ROW, /EXCLUSIVE, SET_VALUE=fitoffset, UVALUE='OFFSET')
compLa2 = WIDGET_LABEL(options, VALUE='(in degrees)', /ALIGN_LEFT)
compLa2 = WIDGET_LABEL(options, VALUE='', /ALIGN_LEFT)
; Buttons
buttons = WIDGET_BASE(input,/ROW, /ALIGN_CENTER, /GRID_LAYOUT)
ok = WIDGET_BUTTON(buttons, VALUE='Ok', UVALUE='OK')
cancel = WIDGET_BUTTON(buttons, VALUE='Cancel', UVALUE='CANCEL')
; Finishing up
stash = {base: base, input: input, baseOffset: baseOffset, baseFitOffset: baseFitOffset, log: log, inputOffsetSt: inputOffsetSt, bgroupOffset: bgroupOffset}
WIDGET_CONTROL, input, SET_UVALUE=stash
WIDGET_CONTROL, input, /REALIZE
XMANAGER, 'setFitOptions', input
end
; ************************************************************ setHKLPlanes ****************
PRO doSetHKLPlanes, input, table, peaksSt, log
common experimentwindow, set, experiment
WIDGET_CONTROL, table, GET_VALUE=hklInfo
experiment->setHKLInfo, hklInfo
WIDGET_CONTROL, input, /DESTROY
WIDGET_CONTROL, peaksSt, SET_VALUE=experiment->infoHKLLine()
logit, log, experiment->infoHKLTxt()
END
PRO setHKLPlanes_event, ev
; Get the 'stash' structure.
WIDGET_CONTROL, ev.TOP, GET_UVALUE=stash
WIDGET_CONTROL, ev.ID, GET_UVALUE=uval
CASE ev.id OF
stash.input:
stash.table:
else: begin
CASE uval OF
'OK': doSetHKLPlanes, stash.input, stash.table, stash.peaksSt, stash.log
'CANCEL': WIDGET_CONTROL, stash.input, /DESTROY
else:
ENDCASE
endcase
endcase
END
PRO setHKLPlanes, base, peaksSt, log
common experimentwindow, set, experiment
if (set eq 0) then begin
tmp = DIALOG_MESSAGE("Error: you need to load data first", /ERROR)
return
endif
; Getting the number of peaks (we may get an error)
CATCH, Error_status
IF Error_status NE 0 THEN BEGIN
themessage = !ERROR_STATE.MSG
tmp = DIALOG_MESSAGE(themessage, /ERROR)
return
endif
nhkl = experiment->getNHKL();
hklInfo = experiment->getHKLInfo();
; Prepare a gui to edit peak information
input = WIDGET_BASE(/COLUMN, Title='Peak information', /MODAL, GROUP_LEADER=base)
label = ['Use', 'h', 'k', 'l']
rows = nhkl
cols = 4
rowlabels = strarr(nhkl)
for i=0, nhkl-1 do rowlabels[i] = "Peak " + STRTRIM(STRING(i + 1,/PRINT),2)
backgroundColors = MAKE_ARRAY( 3, cols, 2, /BYTE )
backgroundColors[*,*,*] = 255 ; white
table = WIDGET_TABLE(input, VALUE=hklInfo, /EDITABLE, COLUMN_LABELS=label, ROW_LABELS=rowlabels)
; BACKGROUND_COLOR=backgroundColors, )
; Buttons
buttons = WIDGET_BASE(input,/ROW, /ALIGN_CENTER, /GRID_LAYOUT)
ok = WIDGET_BUTTON(buttons, VALUE='Ok', UVALUE='OK')
cancel = WIDGET_BUTTON(buttons, VALUE='Cancel', UVALUE='CANCEL')
; Finishing up
stash = {base: base, input: input, table: table, peaksSt: peaksSt, log: log}
WIDGET_CONTROL, input, SET_UVALUE=stash
WIDGET_CONTROL, input, /REALIZE
XMANAGER, 'setHKLPLanes', input
end
; ************************************************************ setStepList ****************
PRO doSetStepList, input, table, log
common experimentwindow, set, experiment
WIDGET_CONTROL, table, GET_VALUE=value
; Catching errors with conversion
CATCH, Error_status
IF Error_status NE 0 THEN BEGIN
themessage = !ERROR_STATE.MSG
tmp = DIALOG_MESSAGE(themessage, /ERROR)
return
endif
nsteps = experiment->getnumberDatasets();
names = strarr(nsteps);
times = fltarr(nsteps);
temperatures = fltarr(nsteps);
strains = fltarr(nsteps);
for i=0, nsteps-1 do begin
names[i] = value[0,i]
times[i] = float(value[1,i])
temperatures[i] = float(value[2,i])
strains[i] = float(value[3,i])
endfor
experiment->setDatasetList, names
experiment->setTemperatures, temperatures
experiment->setTimes, times
experiment->setStrains, strains
WIDGET_CONTROL, input, /DESTROY
logit, log, "Changed list of steps, temperatures, and times.\n"
END
PRO setStepList_event, ev
; Get the 'stash' structure.
WIDGET_CONTROL, ev.TOP, GET_UVALUE=stash
WIDGET_CONTROL, ev.ID, GET_UVALUE=uval
CASE ev.id OF
stash.input:
stash.table:
else: begin
CASE uval OF
'OK': doSetStepList, stash.input, stash.table, stash.log
'CANCEL': WIDGET_CONTROL, stash.input, /DESTROY
else:
ENDCASE
endcase
endcase
END
PRO setStepList, base, log
common experimentwindow, set, experiment
if (set eq 0) then begin
tmp = DIALOG_MESSAGE("Error: you need to load data first", /ERROR)
return
endif
; Getting the number of peaks (we may get an error)
CATCH, Error_status
IF Error_status NE 0 THEN BEGIN
themessage = !ERROR_STATE.MSG
tmp = DIALOG_MESSAGE(themessage, /ERROR)
return
endif
nsteps = experiment->getnumberDatasets();
names = experiment->getDatasetList();
times = experiment->getTimes();
temperatures = experiment->getTemperatures();
strains = experiment->getStrains();
; Prepare a gui to edit peak information
input = WIDGET_BASE(/COLUMN, Title='Steps information', /MODAL, GROUP_LEADER=base)
label = ['name', 'time', 'temperature', 'strain']
rows = nsteps
rowlabels = strarr(nsteps)
value = strarr(4,nsteps)
for i=0, nsteps-1 do begin
value[0,i] = names[i]
value[1,i] = STRTRIM(STRING(times[i],/PRINT),2)
value[2,i] = STRTRIM(STRING(temperatures[i],/PRINT),2)
value[3,i] = STRTRIM(STRING(strains[i],/PRINT),2)
endfor
for i=0, nsteps-1 do rowlabels[i] = "Step " + STRTRIM(STRING(i + 1,/PRINT),2)
table = WIDGET_TABLE(input, VALUE=value, /EDITABLE, COLUMN_LABELS=label, ROW_LABELS=rowlabels, Y_SCROLL_SIZE = 20, COLUMN_WIDTHS=[150,100,100,100] )
; Buttons
buttons = WIDGET_BASE(input,/ROW, /ALIGN_CENTER, /GRID_LAYOUT)
ok = WIDGET_BUTTON(buttons, VALUE='Ok', UVALUE='OK')
cancel = WIDGET_BUTTON(buttons, VALUE='Cancel', UVALUE='CANCEL')
; Finishing up
stash = {base: base, input: input, table: table, log: log}
WIDGET_CONTROL, input, SET_UVALUE=stash
WIDGET_CONTROL, input, /REALIZE
XMANAGER, 'setStepList', input
end
; ************************************************************ setDetectors ****************
; Changed 10/2011 to allow for a change of reference intensity for each detector
PRO doSetDetectors, input, table, log
common experimentwindow, set, experiment
WIDGET_CONTROL, table, GET_VALUE=value
; Catching errors with conversion
CATCH, Error_status
IF Error_status NE 0 THEN BEGIN
themessage = !ERROR_STATE.MSG
tmp = DIALOG_MESSAGE(themessage, /ERROR)
return
endif
ndetectors = experiment->getnumberDetectors();
angles = fltarr(ndetectors);
use = intarr(ndetectors);
intensities = fltarr(ndetectors);
for i=0, ndetectors-1 do begin
angles[i] = float(value[0,i])
use[i] = fix(value[1,i])
intensities[i] = float(value[2,i])
endfor
experiment->setDetectorAngles, angles
experiment->setDetectorIntensities, intensities
experiment->setDetectorUses, use
WIDGET_CONTROL, input, /DESTROY
logit, log, "Changed detectors arrangement.\n"
END
PRO setDetectors_event, ev
; Get the 'stash' structure.
WIDGET_CONTROL, ev.TOP, GET_UVALUE=stash
WIDGET_CONTROL, ev.ID, GET_UVALUE=uval
CASE ev.id OF
stash.input:
stash.table:
else: begin
CASE uval OF
'OK': doSetDetectors, stash.input, stash.table, stash.log
'CANCEL': WIDGET_CONTROL, stash.input, /DESTROY
else:
ENDCASE
endcase
endcase
END
; Changed 10/2011 to allow for a change of reference intensity for each detector
PRO setDetectors, base, log
common experimentwindow, set, experiment
if (set eq 0) then begin
tmp = DIALOG_MESSAGE("Error: you need to load data first", /ERROR)
return
endif
; Getting the number of detectors (we may get an error)
CATCH, Error_status
IF Error_status NE 0 THEN BEGIN
themessage = !ERROR_STATE.MSG
tmp = DIALOG_MESSAGE(themessage, /ERROR)
return
endif
ndetectors = experiment->getnumberDetectors();
angles = experiment->getDetectorAngles();
use = experiment->getDetectorUses();
intensities = experiment->getDetectorIntensities();
; Prepare a gui to edit peak information
input = WIDGET_BASE(/COLUMN, Title='Detectors information', /MODAL, GROUP_LEADER=base)
label = ['angle', 'use', 'intensity']
rows = ndetectors
rowlabels = strarr(ndetectors)
value = strarr(3,ndetectors)
for i=0, ndetectors-1 do begin
value[0,i] = STRTRIM(STRING(angles[i],/PRINT),2)
value[1,i] = STRTRIM(STRING(use[i],/PRINT),2)
value[2,i] = STRTRIM(STRING(intensities[i],/PRINT),2)
endfor
for i=0, ndetectors-1 do rowlabels[i] = "Detector " + STRTRIM(STRING(i + 1,/PRINT),2)
table = WIDGET_TABLE(input, VALUE=value, /EDITABLE, COLUMN_LABELS=label, ROW_LABELS=rowlabels, Y_SCROLL_SIZE = 20, COLUMN_WIDTHS=[150,150] )
; Buttons
buttons = WIDGET_BASE(input,/ROW, /ALIGN_CENTER, /GRID_LAYOUT)
ok = WIDGET_BUTTON(buttons, VALUE='Ok', UVALUE='OK')
cancel = WIDGET_BUTTON(buttons, VALUE='Cancel', UVALUE='CANCEL')
; Finishing up
stash = {base: base, input: input, table: table, log: log}
WIDGET_CONTROL, input, SET_UVALUE=stash
WIDGET_CONTROL, input, /REALIZE
XMANAGER, 'setDetectors', input
end
; ************************************************************* SaveExpToAscii *************
PRO saveExpToAscii, base, log
common default, defaultdir
common experimentwindow, set, experiment
result=dialog_pickfile(title='Save experiment as', path=defaultdir, DIALOG_PARENT=base, DEFAULT_EXTENSION='.exp', FILTER=['*.exp'], /WRITE)
if (result ne '') then begin
if (FILE_TEST(result) eq 1) then begin
tmp = DIALOG_MESSAGE("File exists. Overwrite?", /QUESTION)
if (tmp eq 'No') then return
endif
logit, log, "Saving current experiment in " + result
FDECOMP, result, disk, dir, name, qual, version
defaultdir = disk+dir
setDefaultWorkDir, defaultdir
openw, lun, result, /get_lun
a = experiment->saveToAscii(lun)
free_lun, lun
if (a ne 1) then begin
tmp = DIALOG_MESSAGE("Error: " + a, /ERROR)
logit, log, "\tFailed!\n"
return
endif
logit, log, "\tSuccessful!\n"
endif
END
; ************************************************************* doReadExpFromAscii ********
pro doReadExpFromAscii, base, peaksSt, matSt, offsetSt, fitOffsetSt, log
common experimentwindow, set, experiment
if (set eq 1) then begin
tmp = DIALOG_MESSAGE("Anything done with the current experiment will be lost. Proceed?", /QUESTION)
if (tmp eq 'No') then return
endif
test = readExpFromAscii(base,log)
if (test->getTmp() ne 0) then begin
experiment = test
WIDGET_CONTROL, peaksSt, SET_VALUE=experiment->infoHKLLine()
WIDGET_CONTROL, matSt, SET_VALUE=experiment->infoMaterialLine()
WIDGET_CONTROL, offsetSt, SET_VALUE=strtrim(string(experiment->getOffset()),2)
if (experiment->getFitOffset() eq 1) then begin
WIDGET_CONTROL, fitOffsetSt, SET_VALUE='Yes'
endif else WIDGET_CONTROL, fitOffsetSt, SET_VALUE='No'
logit, log, experiment->infoTxt()
set = 1
endif
end
; ************************************************************* EDITMAT ********************
pro editMat, base, log, matSt
common experimentwindow, set, experiment
if (set eq 0) then begin
tmp = DIALOG_MESSAGE("Error: you need to set the FIT files first", /ERROR)
return
endif
newmat = materialWindow(experiment->getMaterial(), base)
if (newmat->getTmp() eq 1) then begin
experiment->setMaterial, newmat
WIDGET_CONTROL, matSt, SET_VALUE=experiment->infoMaterialLine()
logit,log, experiment->infoMaterialTxt()
end
end
; ************************************************************* Main window ****************
PRO experimentWindow_event, ev
; Get the 'stash' structure.
WIDGET_CONTROL, ev.TOP, GET_UVALUE=stash
WIDGET_CONTROL, ev.ID, GET_UVALUE=uval
CASE ev.id OF
stash.base:
stash.log:
else: begin
CASE uval OF
'SAVE': saveExpToAscii, stash.base, stash.log
'READ': doReadExpFromAscii, stash.base, stash.peaksSt, stash.matSt, stash.offsetSt, stash.fitOffsetSt, stash.log
'EXIT': reallyquit, stash.base
'MATERIAL': editMat, stash.base, stash.log, stash.matSt
'HKLPLANES': setHKLPlanes, stash.base, stash.peaksSt, stash.log
'STEPLIST': setStepList, stash.base, stash.log
'DETECTORS': setDetectors, stash.base, stash.log
'FITOPTIONS': setFitOptions, stash.base, stash.offsetSt, stash.fitOffsetSt, stash.log
'TESTLATTICESTRAINS': testLatticeStrainsWindow, stash.base
'FITOFFSET': fitOffsetWindow, stash.base
'FITUNITCELL': fitUnitCellWindow, stash.base
'FITPRESSURE': fitPressureWindow, stash.base
'FITLATTICESTRAINS': fitLatticeStrainsWindow, stash.base
'FITSTRESS': fitStressWindow, stash.base
'DETCALIB': detCalibWindow, stash.base
'DIFFRINTENSITIES': diffIntensityWindow, stash.base
'INTVSIMAGE': diffIntensityWindow2, stash.base
'BEARTEX': beartexWindow, stash.base
'ABOUT': aboutWindow, stash.base
'CHANGES': changesWindow, stash.base
'NOTAVAILABLE': tmp = DIALOG_MESSAGE("This function is not implemented yet!", /ERROR)
'FORBIDDEN': tmp = DIALOG_MESSAGE("You need to registered", /ERROR)
else:
ENDCASE
endcase
endcase
END
PRO experimentWindow
common experimentwindow, set, experiment
common fonts, titlefont, boldfont, mainfont
set = 0
load_defaults
experiment = OBJ_NEW('experimentObject')
; base GUI
base = WIDGET_BASE(Title='Stess and strain analysis',/COLUMN, MBAR=bar, /TLB_SIZE_EVENTS)
; File menu
file_menu = WIDGET_BUTTON(bar, VALUE='File', /MENU)
file_bttn1 = WIDGET_BUTTON(file_menu, VALUE='Open experiment', UVALUE='READ')
file_bttn2 = WIDGET_BUTTON(file_menu, VALUE='Save experiment', UVALUE='SAVE')
file_bttn3 = WIDGET_BUTTON(file_menu, VALUE='Exit', UVALUE='EXIT', /SEPARATOR)
; Experiment menu
exp_menu = WIDGET_BUTTON(bar, VALUE='Experiment', /MENU)
exp_bttn2 = WIDGET_BUTTON(exp_menu, VALUE='Material properties', UVALUE='MATERIAL')
exp_bttn3 = WIDGET_BUTTON(exp_menu, VALUE='Lattice planes', UVALUE='HKLPLANES')
exp_bttn3 = WIDGET_BUTTON(exp_menu, VALUE='Step list', UVALUE='STEPLIST')
exp_bttn3 = WIDGET_BUTTON(exp_menu, VALUE='Detectors', UVALUE='DETECTORS')
exp_bttn5 = WIDGET_BUTTON(exp_menu, VALUE='Fit options', UVALUE='FITOPTIONS')
; Fit menu
fit_menu = WIDGET_BUTTON(bar, VALUE='Stress and strain', /MENU)
fit_bttn1 = WIDGET_BUTTON(fit_menu, VALUE='Test fit quality', UVALUE='TESTLATTICESTRAINS')
fit_bttn1 = WIDGET_BUTTON(fit_menu, VALUE='Maximum stress direction', UVALUE='FITOFFSET')
fit_bttn1 = WIDGET_BUTTON(fit_menu, VALUE='Unit cells', UVALUE='FITUNITCELL')
fit_bttn2 = WIDGET_BUTTON(fit_menu, VALUE='Pressures', UVALUE='FITPRESSURE')
fit_bttn3 = WIDGET_BUTTON(fit_menu, VALUE='Lattice strains', UVALUE='FITLATTICESTRAINS')
fit_bttn4 = WIDGET_BUTTON(fit_menu, VALUE='Stresses', UVALUE='FITSTRESS')
; Texture menu
texture_menu = WIDGET_BUTTON(bar, VALUE='Texture', /MENU)
texture_bttn1 = WIDGET_BUTTON(texture_menu, VALUE='Calibration of Detectors', UVALUE='DETCALIB')
texture_bttn1 = WIDGET_BUTTON(texture_menu, VALUE='Diffraction intensities', UVALUE='DIFFRINTENSITIES')
texture_bttn2 = WIDGET_BUTTON(texture_menu, VALUE='Intensity vs image', UVALUE='INTVSIMAGE')
texture_bttn2 = WIDGET_BUTTON(texture_menu, VALUE='Input file for Beartex', UVALUE='BEARTEX')
; About menu
about_menu = WIDGET_BUTTON(bar, VALUE='About...', /MENU, /ALIGN_RIGHT)
about_bttn1 = WIDGET_BUTTON(about_menu, VALUE='About this program', UVALUE='ABOUT')
about_bttn1 = WIDGET_BUTTON(about_menu, VALUE='Recent changes', UVALUE='CHANGES')
; top container
top = WIDGET_BASE(base,/ROW)
summary = WIDGET_BASE(top,/COLUMN, FRAME=1)
matLa = WIDGET_LABEL(summary, VALUE='Material', /ALIGN_LEFT)
matSt = WIDGET_TEXT(summary, VALUE='Not set', XSIZE=10)
peaksLa = WIDGET_LABEL(summary, VALUE='Peaks', /ALIGN_LEFT)
peaksSt = WIDGET_TEXT(summary, VALUE='Not set', XSIZE=10)
compLa = WIDGET_LABEL(summary, VALUE='Compression direction', /ALIGN_LEFT)
offsetSt = WIDGET_TEXT(summary, VALUE='Not set', XSIZE=10)
fitOffsetLa = WIDGET_LABEL(summary, VALUE='Fit compression direction', /ALIGN_LEFT)
fitOffsetSt = WIDGET_TEXT(summary, VALUE='Not set', XSIZE=10)
log = WIDGET_TEXT(top, XSIZE=75, YSIZE=40, /ALIGN_CENTER, /EDITABLE, /WRAP, /SCROLL)
stash = {base: base, log:log, matSt: matSt, peaksSt: peaksSt, offsetSt: offsetSt, fitOffsetSt: fitOffsetSt}
WIDGET_CONTROL, base, SET_UVALUE=stash
WIDGET_CONTROL, base, /REALIZE
aboutWindow, base
XMANAGER, 'experimentWindow', base
END