-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathas_normalisation__define.pro
139 lines (102 loc) · 5.97 KB
/
as_normalisation__define.pro
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
PRO as_normalisation_event, event
@as_scatterheader.macro
Widget_Control, event.top, GET_UVALUE = as_normalisation
as_normalisation.event, event
END
PRO as_normalisation::event, event
@as_scatterheader.macro
widgetName = Widget_Info(event.ID, /UNAME)
CASE widgetName OF
'NORM BASE' : BEGIN
IF Tag_Names(event, /STRUCTURE_NAME) EQ 'WIDGET_KILL_REQUEST' THEN Widget_Control, self.wNormBase, MAP = 0
END
'CONFIG COMBO' :
'NORM COUNTERS' : BEGIN
FOREACH obj, (*self.notifyObj) DO Call_Method, obj.method, obj.object, {NORMRETURN, normType : -1, counterRatio : self.ratio, I0Norm : self.I0rate, IBSNorm : self.IBSRate }
END
'NO NORM' : IF event.select THEN self.normSelected = 0
'I0 NORM' : IF event.select THEN self.normSelected = 1
'IBS NORM' : IF event.select THEN self.normSelected = 2
'I0BS NORM' : IF event.select THEN result = Dialog_Message('I told you not to select this option!!') ;self.normSelected = 3
'APPLY' : BEGIN
FOREACH obj, (*self.notifyObj) DO Call_Method, obj.method, obj.object, {NORMRETURN, normType : self.normSelected, counterRatio : -1, I0Norm : -1, IBSNorm : -1}
END
ELSE : Print, 'Widget Name ' + widgetName + ' not handled by event case.'
ENDCASE
END
FUNCTION as_normalisation::init, GROUPLEADER = groupLeader, NOTIFY_OBJ = notifyObj
@as_scatterheader.macro
IF N_Elements(notifyObj) GT 0 THEN BEGIN
FOR i = 0, N_Elements(notifyObj) - 1 DO BEGIN
tags = Tag_Names(notifyObj)
void = Where(tags EQ 'METHOD', count1)
void = Where(tags EQ 'OBJECT', count2)
IF count1 + count2 NE 2 THEN BEGIN
result = Dialog_Message('Incorrect tags. Normalisation GUI not started.')
RETURN, 0
ENDIF
ENDFOR
self.notifyObj = Ptr_New(notifyObj)
ENDIF ELSE self.notifyObj = Ptr_New(/ALLOCATE_HEAP)
IF KeyWord_Set(groupLeader) THEN BEGIN
IF Widget_Info(groupLeader,/VALID) THEN BEGIN
self.groupLeader = groupLeader
self.wNormBase = Widget_Base(GROUP_LEADER=groupLeader, TITLE = 'Normalisation GUI', EVENT_PRO = 'as_normalisation_event', /COLUMN, /FLOATING, /TLB_KILL_REQUEST_EVENTS, UNAME = 'NORM BASE')
ENDIF
ENDIF ELSE self.wNormBase = Widget_Base(TITLE = 'Normalisation GUI',EVENT_PRO = 'as_normalisation_event', /COLUMN, /FLOATING, /TLB_KILL_REQUEST_EVENTS, UNAME = 'NORM BASE')
wFrameBase = Widget_Base(self.wNormBase, /COLUMN, /FRAME)
wConfigBase = Widget_Base(wFrameBase, /ROW)
wConfigLabel = Widget_Label(wConfigBase, VALUE = 'Choose Configuration to Edit:')
wConfigCombo = Widget_Combobox(wConfigBase, VALUE = 'All', UNAME = 'CONFIG COMBO')
wBuffer = Widget_Label(wFrameBase, VALUE = '')
wNormDetBase = Widget_Base(wFrameBase, /COLUMN, /FRAME)
wNormDetLabel = Widget_Label(wNormDetBase, YSIZE = 30, XSIZE = 250, VALUE = 'Select airshot in scatterBrain plot screen to ' +String([13b]) + 'load counts for normalising counters.')
wNormDetRowBase = Widget_Base(wNormDetBase, /ROW)
wNormI0Text = FSC_Field(wNormDetRowBase, VALUE = '1', XSIZE = 10, TITLE = 'I0 (c/s)', /NONSENSITIVE, /COLUMN, UNAME = 'I0 VAL')
wNormSlashLabel = Widget_Label(wNormDetRowBase, VALUE = '/')
wNormIBSText = FSC_Field(wNormDetRowBase, VALUE = '1', XSIZE = 10, TITLE = 'IBS (c/s)', /NONSENSITIVE, /COLUMN,UNAME = 'IBS VAL')
wNormEqualsLabel = Widget_Label(wNormDetRowBase, VALUE = '=')
wNormNormText = FSC_Field(wNormDetRowBase, VALUE = '1', XSIZE = 10, TITLE = 'Ratio', /NONSENSITIVE, /COLUMN, UNAME = 'RATIO VAL')
wNormDetectors = Widget_Button(wNormDetBase, VALUE = 'Apply Normalisation to I0/Beam Stop Counters', UNAME = 'NORM COUNTERS')
wBuffer = Widget_Label(wFrameBase, VALUE = '')
wNormTypeBase = Widget_Base(wFrameBase, /COLUMN, /FRAME)
wNormTypeLabel = Widget_Label(wNormTypeBase, VALUE = 'Select to Change Type of Normalisation')
wNormTypeButBase = Widget_Base(wNormTypeBase, /EXCLUSIVE, /COLUMN)
wNoNormBut = Widget_Button(wNormTypeButBase, VALUE = 'No Normalisation', UNAME = 'NO NORM')
wI0NormBut = Widget_Button(wNormTypeButBase, VALUE = 'Incident Intensity Normalisation', UNAME = 'I0 NORM')
wIBSNormBut = Widget_Button(wNormTypeButBase, VALUE = 'Beamstop Intensity Normalisation', UNAME = 'IBS NORM')
wI0BSNormBut = Widget_Button(wNormTypeButBase, VALUE = 'Do Not Select This Option', UNAME = 'I0BS NORM')
wApplyBut = Widget_Button(wNormTypeBase, VALUE = 'Apply change of Normalisation', UNAME = 'APPLY')
Widget_Control, self.wNormBase, /REALIZE
Widget_Control, self.wNormBase, SET_UVALUE = self
RETURN, 1
END
PRO as_normalisation::ShowGUI
@as_scatterheader.macro
Widget_Control, self.wNormBase, /MAP
END
PRO as_normalisation::DetCounts, I0, IBS, expTime
@as_scatterheader.macro
IF N_Elements(I0) GT 0 AND N_Elements(IBS) GT 0 THEN BEGIN
self.ratio = I0/Float(IBS)
self.I0Rate = I0/expTime
self.IBSRate = IBS/expTime
Widget_Control, Widget_Info(self.wNormBase, FIND_BY_UNAME='I0 VAL'), SET_VALUE = String(self.I0Rate)
Widget_Control, Widget_Info(self.wNormBase, FIND_BY_UNAME='IBS VAL'), SET_VALUE = String(self.IBSRate)
Widget_Control, Widget_Info(self.wNormBase, FIND_BY_UNAME='RATIO VAL'), SET_VALUE = String(self.ratio)
ENDIF
END
PRO as_normalisation::EditConfig, RENAME=rename, DELETE=delete
@as_scatterheader.macro
END
PRO as_normalisation__define
void = {NORMRETURN, normType : 0, counterRatio : 0, I0Norm : 0.0, IBSNorm : 0.0}
void = {as_normalisation, $
groupLeader : 0L, $
notifyObj : Ptr_New(), $
normSelected : 0, $
ratio : 0.0, $
I0Rate : 0.0, $
IBSRate : 0.0, $
wNormBase : 0L }
END