-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrateMonitor.html
More file actions
249 lines (211 loc) · 11 KB
/
rateMonitor.html
File metadata and controls
249 lines (211 loc) · 11 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
<html>
<head>
<title>GRIFFIN Rate Monitor</title>
<script src='scripts/HTMLImports.min.js' type="text/javascript"></script>
<script src='scripts/mustache.js' type="text/javascript"></script>
<script src='scripts/easeljs-0.7.0.min.js' type="text/javascript"></script>
<script src='scripts/dygraphs.1.1.1.min.js' type="text/javascript"></script>
<script src='scripts/gammaSpectrum.js' type="text/javascript"></script>
<script src='scripts/fitit.js' type="text/javascript"></script>
<script src='scripts/regression.min.js' type="text/javascript"></script>
<script src="scripts/jquery1-11-3.min.js"></script>
<script src="scripts/bootstrap3-3-5.min.js"></script>
<script src='scripts/helpers.js' type="text/javascript"></script>
<script src='scripts/rateMonitor.js' type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/bootstrap3-3-5.min.css">
<link rel="stylesheet" type="text/css" href="css/custom.css">
<!--HTML imports-->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link id='header' rel="import" href="templates/header/header.html">
<link id='plotGrid' rel="import" href="templates/plotGrid/plotGrid.html">
<link id='plotControl' rel="import" href="templates/plotControl/plotControl.html">
<link id='striptool' rel="import" href="templates/striptool/striptool.html">
<link id='striptoolSliders' rel="import" href="templates/striptool/striptoolSliders.html">
<link id='rateControl' rel="import" href="templates/rateControl/rateControl.html">
<link id='gammaWindows' rel="import" href="templates/rateControl/gammaWindows.html">
<link id='levelsAndScalars' rel="import" href="templates/rateControl/levelsAndScalars.html">
<link id='footer' rel="import" href="templates/footer/footer.html">
</head>
<body>
<div id='head'></div>
<div id='messageDiv' class='col-md-12'>
<div id='messageDivText'></div><div id='messageDivButton'></div>
</div>
<!--Controls-->
<div class='sectionWrapper item expand' id='rateMonitorControl'>
<div id='timeaxisControlWrap' class='col-md-6 plotRegion'>
<h4>X-axis Control for all striptools</h4>
<div id='rateSlides'></div>
</div>
<div id='striptoolControlWrap' class='col-md-6 plotRegion'>
<div id='yaxisControlsWrap'>
<h4>Y-axis Control for all striptools</h4>
<div id='yaxisControls'></div>
</div>
</div>
</div>
<!--Static Plots-->
<div id='plotRegion2' class='sectionWrapper item'>
<div id='InfrastructurerateWrap' class='col-md-4 plotRegion'>
<div id='Infrarates'></div>
</div>
<div id='ISACrateWrap' class='col-md-4 plotRegion'>
<div id='ISACrates'></div>
</div>
<div id='SEPrateWrap' class='col-md-4 plotRegion'>
<div id='SEPrates'></div>
</div>
</div>
<div id='plotRegion3' class='sectionWrapper item'>
<div id='GRIFFINrateWrap' class='col-md-4 plotRegion'>
<div id='Photonrates'></div>
</div>
<div id='ChargedrateWrap' class='col-md-4 plotRegion'>
<div id='Chargedrates'></div>
</div>
<div id='OtherrateWrap' class='col-md-4 plotRegion'>
<div id='Otherrates'></div>
</div>
</div>
<!--Gamma spectrum and rates plots-->
<div id='plotRegion' class='sectionWrapper item'>
<div id='plotWrap' class='col-md-6 plotRegion'>
<div id='plottingGrid'></div>
<div id='plotCtrl'></div>
</div>
<div id='rateWrap' class='col-md-6 plotRegion'>
<div id='rates'></div>
</div>
</div>
<hr style='width:60%; border-top: 1px solid #999'></hr>
<!--Window Controls-->
<div class='sectionWrapper item expand' id='rateMonitorControl'>
<div id='rateCtrl'></div>
</div>
<div id='foot'></div>
<script>
window.addEventListener('HTMLImportsLoaded', function(e) {
var i, vw;
dataStore._plotGrid = new plotGrid('plottingGrid');
dataStore._plotControl = new plotControl('plotCtrl', 'horizontal');
dataStore._striptool = new striptool('rates');
dataStore._striptoolInfra = new striptool('Infrarates');
dataStore._striptoolISAC = new striptool('ISACrates');
dataStore._striptoolSEP = new striptool('SEPrates');
dataStore._striptoolPhoton = new striptool('Photonrates');
dataStore._striptoolCharged = new striptool('Chargedrates');
dataStore._striptoolOther = new striptool('Otherrates');
dataStore._striptoolSliders = new striptoolSliders('rateSlides');
dataStore._rateControl = new rateControl('rateCtrl');
vw = dataStore.plots[0];
dataStore.templates = prepareTemplates(['header', 'plotGrid', 'plotControl', 'striptool', 'striptoolSliders', 'rateControl', 'gammaWindows', 'levelsAndScalars', 'footer']);
setupHeader('head', 'Rate Monitor');
dataStore._plotGrid.setup();
dataStore._plotControl.setup();
dataStore._striptoolSliders.setup();
dataStore._rateControl.setup();
setupFooter('foot');
// Inject the dismiss button to the messageDiv
newButton = document.createElement('button');
newButton.setAttribute('id', 'messageDivDismissButton');
newButton.setAttribute('class', 'btn btn-default btn-lg');
newButton.innerHTML = "Dismiss";
//newButton.style.padding = '4px';
newButton.onclick = function(){
ClearErrorConnectingToAnalyzerServer();
}.bind(newButton);
document.getElementById('messageDivButton').appendChild(newButton);
//declare our one and only plot
dataStore._plotGrid.manageCellCreation(null, dataStore.plots[0]);
//don't want additional plots in this app
deleteNode('plottingGridnewPlotButton');
//prepare initial gamma windows
for(i=0; i<dataStore.defaults[0].gammas.length; i++){
dataStore._rateControl.drawWindow(i, dataStore.defaults[0].gammas[i].min, dataStore.defaults[0].gammas[i].max);
}
//plot the spectrum of interest
dataStore.viewers[vw].addData(dataStore.targetSpectrum, []);
dataStore._plotControl.activeSpectra = [dataStore.targetSpectrum];
dataStore._plotControl.refreshAll();
//set up dygraph
dataStore.plotStyle[0]['height'] = document.getElementById(dataStore.plots[0]).offsetHeight - dataStore.viewers[vw].bottomMargin + 20,
dataStore.plotStyle[0]['weight'] = document.getElementById(dataStore.plots[0]).offsetWidth
dataStore._striptool.setup();
dataStore._striptoolInfra.setup();
dataStore._striptoolISAC.setup();
dataStore._striptoolSEP.setup();
dataStore._striptoolPhoton.setup();
dataStore._striptoolCharged.setup();
dataStore._striptoolOther.setup();
//set up dygraph Y axis controls
var tbl = document.createElement('table');
tbl.id = 'yaxisControlsTable';
tbl.style.width = '80%';
//var tbdy = document.createElement('tbody');
//tbl.appendChild(tbdy);
document.getElementById('yaxisControls').appendChild(tbl);
var row = document.getElementById('yaxisControlsTable').insertRow(0);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = 'Series:';
cell2.innerHTML = '<select id=SeriesSelector></select>';
var row = document.getElementById('yaxisControlsTable').insertRow(1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = 'Y-axis Min.:';
cell2.innerHTML = '<input id=YMinInput></input>';
var row = document.getElementById('yaxisControlsTable').insertRow(2);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = 'Y-axis Max.:';
cell2.innerHTML = '<input id=YMaxInput></input>';
sel = document.getElementById("SeriesSelector");
for(i=1; i<dataStore.defaults.length; i++){
for(j=0; j<dataStore.defaults[i].levels.length; j++){
var opt = document.createElement("option");
opt.value =(i*10)+j;
opt.text = dataStore.defaults[i].levels[j].title;
sel.appendChild(opt);
}
}
i=0;
for(j=0; j<dataStore.defaults[i].levels.length; j++){
var opt = document.createElement("option");
opt.value = 1;
opt.text = dataStore.defaults[i].levels[j].title;
sel.appendChild(opt);
}
var opt = document.createElement("option");
opt.value = 0;
opt.text = "Gamma-ray Gates";
sel.appendChild(opt);
sel.onchange = function () { ChangeSeriesSelect(this.value); };
document.getElementById("YMinInput").onchange = function () { SetYAxisMin(this.value); };
document.getElementById("YMaxInput").onchange = function() { SetYAxisMax(this.value); };
// set initial values of the inputs
document.getElementById("YMinInput").value = dataStore.YAxisMinValue[Math.floor(document.getElementById("SeriesSelector").value/10)][document.getElementById("SeriesSelector").value%10];
document.getElementById("YMaxInput").value = dataStore.YAxisMaxValue[Math.floor(document.getElementById("SeriesSelector").value/10)][document.getElementById("SeriesSelector").value%10];
//manage which gamma window are on by defualt
for(i=0; i<dataStore.defaults[0].gammas.length; i++){
if(!dataStore.defaults[0].gammas[i].onByDefault)
document.getElementById('display' + dataStore.defaults[0].gammas[i].index).click()
}
//don't allow refresh period to change
deleteNode('updateWrap');
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
});
function ChangeSeriesSelect(thisValue){
document.getElementById("YMinInput").value = dataStore.YAxisMinValue[Math.floor(thisValue/10)][Math.floor(thisValue%10)];
document.getElementById("YMaxInput").value = dataStore.YAxisMaxValue[Math.floor(thisValue/10)][Math.floor(thisValue%10)];
}
function SetYAxisMin(thisValue){
dataStore.YAxisMinValue[Math.floor(document.getElementById("SeriesSelector").value/10)][Math.floor(document.getElementById("SeriesSelector").value%10)] = parseFloat(thisValue);
}
function SetYAxisMax(thisValue){
dataStore.YAxisMaxValue[Math.floor(document.getElementById("SeriesSelector").value/10)][Math.floor(document.getElementById("SeriesSelector").value%10)] = parseFloat(thisValue);
}
</script>
</body>
</html>