-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathangularCorrelations.html
More file actions
462 lines (396 loc) · 20.5 KB
/
angularCorrelations.html
File metadata and controls
462 lines (396 loc) · 20.5 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
<html>
<head>
<title>GRIFFIN Angular Correlations</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/regression.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/jquery1-11-3.min.js"></script>
<script src="scripts/bootstrap3-3-5.min.js"></script>
<script src="scripts/plotly-1.5.0.min.js"></script>
<script src='scripts/helpers.js' type="text/javascript"></script>
<script src='scripts/angularCorrelations.js' type="text/javascript"></script>
<script src='scripts/angularCorrelations-helpers.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='paginationMenu' rel="import" href="templates/paginationMenu/paginationMenu.html">
<link id='angularCorrelationsReport' rel="import" href="templates/angularCorrelations/angularCorrelationsReport.html">
<link id='angularCorrelationsReportTable' rel="import" href="templates/angularCorrelations/angularCorrelationsReportTable.html">
<link id='angularCorrelationsDataReportTable' rel="import" href="templates/angularCorrelations/angularCorrelationsReportTable.html">
<link id='angularCorrelationsWeightsReportTable' rel="import" href="templates/angularCorrelations/angularCorrelationsReportTable.html">
<link id='angularCorrelationsFitsReportTable' rel="import" href="templates/angularCorrelations/angularCorrelationsReportTable.html">
<link id='angularCorrelationsChiSquareReportTable' rel="import" href="templates/angularCorrelations/angularCorrelationsReportTable.html">
<link id='plotGrid' rel="import" href="templates/plotGrid/plotGrid.html">
<link id='plotControl' rel="import" href="templates/plotControl/plotControl.html">
<link id='plotListLite' rel="import" href="templates/plotList/plotListLite.html">
<link id='dataplot' rel="import" href="templates/dataplot/dataplot.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>
<div id='progressDiv' class="container progress">
<div id='angularCorrelationsProgress' class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">Initializing App...
</div>
</div>
<!--helpful hints-->
<div class='col-md-6'>
<div id='welcomeMessage' class="alert alert-warning" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="false"></span>
Select which detector systems to use for angular correlations.
</div>
<div id='fetchingMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Initializing. Spectra are downloading, please wait...
</div>
<div id='readyMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Ready to make gamma-gamma angular correlations. Please enter the two peak energies.
</div>
<div id='projectionsMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Projecting the angular correlation matrices.
</div>
<div id='fittingMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Fitting peaks for all angular correlation projections and singles histograms.
</div>
<div id='reviewMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Review the results in the table below, and refit any troublesome peaks one at a time.
</div>
</div>
<div id='error-messages-for-drop-area' class='col-md-6 error-text'></div>
<div id="peakFitterDivContainer" class='col-md-12 hidden'>
<div id='inputsHistosContainerDiv' class='col-md-12'>
<div class='col-md-12'>
<label for="inputHistogramFiles" class='col-md-4'>List of Histogram files (.tar):</label>
<div id='histo-list-menu-div' class='col-md-4'>
<label for="HistoListSelect">Select files to add them:</label>
</div>
<div class='col-md-6'>
<textarea id="inputHistogramFiles" name="inputHistogramFiles" rows="4" cols="50"></textarea>
</div>
</div>
</div>
<div id='inputs1dContainerDiv' class='col-md-12'>
<div class='col-md-4'>
<label for="input1dSpectrumNames" class='col-md-12'>List of 1d spectra:</label>
<textarea id="input1dSpectrumNames" name="input1dSpectrumNames" rows="4" cols="50"></textarea>
</div>
<div class='col-md-4'>
<label for="input1dPeaks" class='col-md-12'>List of peaks to fit in all 1d spectra:</label>
<textarea id="input1dPeaks" name="input1dPeaks" rows="4" cols="50"></textarea>
</div>
</div>
<div id='inputs2dContainerDiv' class='col-md-12'>
<div class='col-md-4'>
<label for="input2dSpectrumNames" class='col-md-12'>List of 2d spectra:</label>
<textarea id="input2dSpectrumNames" name="input2dSpectrumNames" rows="4" cols="50"></textarea>
</div>
<div class='col-md-4'>
<label for="input2dGates" class='col-md-12'>List of gates to make projections for all 2d spectra:</label>
<textarea id="input2dGates" name="input2dGates" rows="4" cols="50"></textarea>
</div>
<div class='col-md-4'>
<label for="input2dPeaks" class='col-md-12'>List of peaks to fit in all projections:</label>
<textarea id="input2dPeaks" name="input2dPeaks" rows="4" cols="50"></textarea>
</div>
</div>
</div>
<div id='buttonsContainerDiv' class='col-md-12'>
<div id='launchSubmitDiv' class='col-md-6 hidden'></div>
<div id='saveCalDiv' class='col-md-3 hidden'>
<button type="button" class="btn btn-primary btn-lg" id='saveCal'>
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Save Cal file
</button>
<input id='saveCalname' type='text' value='GRIFFIN-Cal-File.cal' width='500px'></input>
</div>
<div id='saveCSVDiv' class='col-md-3 hidden'>
<button type="button" class="btn btn-primary btn-lg" id='saveCSV'>
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>Download results as CSV
</button>
</div>
<div id='saveScriptDiv' class='col-md-3 hidden'>
<button type="button" class="btn btn-primary btn-lg" id='saveScript'>
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>Download input script
</button>
</div>
</div>
</div>
<!-- Histogram Choice Div -->
<div id='histoChoiceBar' class='col-md-12'>
<div id='histoChoiceDir' class='col-md-8'></div>
<div id='histoChoiceSubmitDiv' class='col-md-4'></div>
</div>
<div id='detectorChoiceBar' class='col-md-12'></div>
<div id='decisionBarAuto' class='col-md-12 hidden'></div>
<div id='customPeaksContainerDiv' class='col-md-12 hidden'>
<div class='col-md-4'>
<label for="customInput1dPeakEnergy" class='col-md-12'>Enter a comma-separated list of peak calibrated energies for gain-matching:</label>
<textarea id="customInput1dPeakEnergy" name="customInput1dPeakEnergy" rows="4" cols="50"></textarea>
</div>
<div class='col-md-4'>
<label for="customInput1dPeakPulseHeight" class='col-md-12'>Enter a comma-separated list of peak uncalibrated centroids:</label>
<textarea id="customInput1dPeakPulseHeight" name="customInput1dPeakPulseHeight" rows="4" cols="50"></textarea>
</div>
<div id='customPeaksButtonDiv' class='col-md-4'></div>
</div>
<!--user input-->
<div id='userInputParentDiv' class='col-md-12 hidden'>
<div id='gateInputsParentDiv' class='col-md-3 hidden'>
<h3>Gate and Peak Details</h3>
<div id='gateInputsDiv' class="input-group">
<div class='col-md-12'>
<label for="gamma1Input" class="right inline"><b>Peak1 Energy:</b></label>
<input id="gamma1Input" value="1173" min="0" max="4095" type="number" class='black-text'></input>
<button type="button" class="btn btn-default btn-sm" id='gamma1SetLimits' engaged='0'>
<span id='gamma1SetLimitsBadge' class="glyphicon glyphicon-equalizer" aria-hidden="true">Set Limits with Mouse</span>
</button>
</div>
<div class='col-md-12'>
<label for="gamma2Input" class="right inline"><b>Peak2 Energy:</b></label>
<input id="gamma2Input" value="1332" min="0" max="4095" type="number" class='black-text'></input>
<button type="button" class="btn btn-default btn-sm" id='gamma2SetLimits' engaged='0'>
<span id='gamma2SetLimitsBadge' class="glyphicon glyphicon-equalizer" aria-hidden="true">Set Limits with Mouse</span>
</button>
</div>
</div>
<div class='col-md-12'>
<label for="peakGateChoiceInput" class="right inline"><b>Peak used as gate:</b></label>
<select id="peakGateChoiceInput">
<option value=1 selected>Peak 1</option>
<option value=2>Peak 2</option>
</select>
</div>
<div class='col-md-12'>
<button type="button" class="btn btn-default btn-sm" id='ggAngCorrProject' engaged='0'>
<span id='gateBadge' class="glyphicon glyphicon-equalizer" aria-hidden="true">Launch the peak fitting</span>
</button>
</div>
</div>
<div id='cascadeInputsDiv' class='col-md-3 hidden'>
<div id='cascadeInputs' class='col-md-12'>
<!-- This form taken from http://griffincollaboration.github.io/AngularCorrelationUtility/ -->
<form class='content' autocomplete='off'>
<!-- even / odd -->
<div>
<h3>Angular Momentum Options</h3>
</div>
<div><b>J<sub>1</sub></b> and <b>L<sub>1b</sub>/L<sub>1a</sub> Mixing</b> will be determined.</div><div id="j1OptionsDiv"></div>
<hr></hr>
<!-- j2 -->
<label for="j2" class="right inline"><b>J<sub>2</sub>:</b></label>
<select id="j2" onchange="check_jvalues(); recalculate_L(2); recalculate();"></select>
<div id="l2a_value"></div>
<div id="l2b_value"></div>
<label>L<sub>2b</sub>/L<sub>2a</sub> Mixing:</label>
<input id='delta2-slider' type='range' min='-1' max='1' step='0.01' value='0' oninput='syncElements("delta2-slider", "mix2")' onchange='recalculate()' class='mixer'></input>
<input id='mix2' type='number' min='-1' max='1' step='0.01' value='0' onchange='syncElements("mix2", "delta2-slider"); recalculate();' class='mixer'></input>
<hr></hr>
<!-- j3 -->
<div class="col-md-6">
<label for="j3" class="right inline"><b>J<sub>3</sub>:</b></label>
<select id="j3" onchange="check_jvalues();recalculate_L(2);recalculate();"></select>
</div>
<div class="col-md-6">
<input type="radio" id="even" name="r-group" data-toggle="button" onchange="evenA();recalculate_L(2);recalculate();" checked>
<label class="button" for="even">Even mass</label>
<input type="radio" id="odd" name="r-group" data-toggle="button" onchange="oddA();recalculate_L(2);recalculate();">
<label class="button" for="odd">Odd mass</label>
</div>
<hr></hr>
</form>
<p id="error1"></p>
</div>
</div>
<div id='analysisInputsDiv' class='col-md-4 hidden'>
<div class='col-md-12'>
<form class='content' autocomplete='off'>
<h3>Analysis Control Options</h3>
<label for="confidence_limit_value" class="right inline"><b>Desired confidence limit:</b></label>
<div id="confidenceLimitValueDiv">
<label for="99CL" class="right inline">99%</label>
<input id='99CL' name='confidenceLimitValue' type='radio' value='2' checked></input>
<label for="95CL" class="right inline">95%</label>
<input id='95CL' name='confidenceLimitValue' type='radio' value='1'></input>
<label for="90CL" class="right inline">90%</label>
<input id='90CL' name='confidenceLimitValue' type='radio' value='0'></input>
</div>
</div>
<hr></hr>
<div class='col-md-10'>
<label for="sysUnc" class="right inline"><b>Systematic uncertainty (added in quadrature to each data point):</b></label>
<div id="systematicUncertaintyValueDiv">
<input id='sysUnc' type='number' min='0' max='10' step='0.1' value='0' onchange='dataStore.systematicUncertainty=(this.value/100)'></input>%
</div>
</div>
<hr></hr>
<div class='col-md-10'>
<label for="time_random_select_value" class="right inline"><b>Subtract time-random background:</b></label>
<div id="timeRandomSelectValueDiv">
<label for="TR_Auto" class="right inline">Auto (if >3%)</label>
<input id='TR_Auto' name='time_random_select_value' type='radio' value='2' checked></input>
<label for="TR_Yes" class="right inline">Always</label>
<input id='TR_Yes' name='time_random_select_value' type='radio' value='1'></input>
<label for="TR_No" class="right inline">Never</label>
<input id='TR_No' name='time_random_select_value' type='radio' value='0'></input>
</div>
</div>
<hr></hr>
</form>
</div>
</div>
<!-- Pagination menu Div -->
<div id='menu' class='col-md-12'></div>
<!-- Spectrum Plotting -->
<div id='plotRegion' class='sectionWrapper'>
<div id='plotWrap' class='col-md-9 plotRegion item'>
<div id='plottingGrid'></div>
<div class='col-md-8' id='plotCtrl'></div>
<div class='sectionWrapper refitButtons'>
<div class='col-md-12'>
<select id="refitSelect"></select>
<button type="button" class="btn btn-default btn-lg" id='refitButton' engaged='0'>
<span id='refitButtonBadge' class="glyphicon glyphicon-equalizer" aria-hidden="true"></span>
<span id='refitButtonText'>Refit this Peak</span>
</button>
</div>
</div>
</div>
<div class='col-md-2 item'>
<div id='plotList' style='overflow-y:scroll; height:400px;'></div>
</div>
</div>
<!-- Peak-Fitting results tables -->
<div id='resultsFitsTableRegion' class='col-md-12 hidden'>
<div id='angularCorrelationsFits' class='col-md-12'></div>
</div>
<div id='resultsDataTableRegion' class='col-md-12 hidden'>
<div id='angularCorrelationsFits' class='col-md-12'></div>
</div>
<div id='resultsWeightTableRegion' class='col-md-12 hidden'>
<div id='angularCorrelationsFits' class='col-md-12'></div>
</div>
<!-- Plots -->
<div id='resultsPlotRegion' class='col-md-12'>
<div id='dataPlotWarnings' class='col-md-12 red-text'></div>
<div id='dataPlotMessage' class='col-md-12'></div>
<div id='angularCorrelationsDataPlot' class='col-md-6 plotlyDiv'></div>
<div id='angularCorrelationsChiSqPlot' class='col-md-6 plotlyDiv'></div>
<div id='chiSquareReportTableDiv' class='row justify-content-center'>
<h3>Results of chi-square analysis:</h3>
<table id="chiSquareReportTable"></table>
</div>
</div>
<div id='foot'></div>
<script>
window.addEventListener('HTMLImportsLoaded', function(e) {
dataStore._plotGrid = new plotGrid('plottingGrid');
dataStore._plotControl = new plotControl('plotCtrl', 'horizontal');
dataStore.templates = prepareTemplates(['header', 'paginationMenu', 'angularCorrelationsReport', 'angularCorrelationsDataReportTable', 'angularCorrelationsWeightsReportTable', 'angularCorrelationsFitsReportTable', 'plotGrid', 'plotControl', 'plotListLite', 'dataplot', 'footer']);
setupHeader('head', 'Angular Correlations');
setupPaginationMenu('menu');
dataStore._plotGrid.setup();
dataStore._plotControl.setup();
//set up spectrum cell
dataStore._plotGrid.manageCellCreation(null, dataStore.plots[0]);
setupFooter('foot');
//don't want additional plots in this app
deleteNode('plottingGridnewPlotButton');
// Inject the dismiss button to the server messageDiv
newButton = document.createElement('button');
newButton.setAttribute('id', 'messageDivDismissButton');
newButton.setAttribute('class', 'btn btn-default btn-lg');
newButton.innerHTML = "Dismiss";
newButton.onclick = function(){
ClearErrorConnectingToAnalyzerServer();
}.bind(newButton);
document.getElementById('messageDivButton').appendChild(newButton);
// Create the text input for the Histogram file directory and file inputs
var newLabel = document.createElement("label");
newLabel.for = 'HistoDirectoryInput';
newLabel.innerHTML = 'Directory of Histogram files: ';
document.getElementById('histoChoiceDir').appendChild(newLabel);
newInput = document.createElement('input');
newInput.id = 'HistoDirectoryInput';
newInput.type = 'text';
newInput.style.width = '400px';
newInput.value = dataStore.histoFileDirectoryPath;
newInput.onchange = function(){
dataStore.histoFileDirectoryPath = this.value;
getHistoFileListFromServer();
}.bind(newInput);
document.getElementById('histoChoiceDir').appendChild(newInput);
// Grab the histogram list for the default directory
getHistoFileListFromServer();
getMidasFileListFromServer(); // The request for details follows this. Needed for adding run titles to selects
// Set up event listener for adding run titles to selects
listener('histoChoiceBar', 'midasFileDetailsAvailable', addTitlesToHistoListSelect);
// Plug in the onchange functions
document.getElementById('gamma1Input').onchange = function(){
dataStore.gg_ang_corr_gamma1E = this.value;
}.bind(document.getElementById('gamma1Input'));
document.getElementById('gamma2Input').onchange = function(){
dataStore.gg_ang_corr_gamma2E = this.value;
}.bind(document.getElementById('gamma2Input'));
document.getElementById('ggAngCorrProject').onclick = function(){
dataStore.viewers[dataStore.plots[0]].clearFits(); // Clear the fits that were made during Limit setting.
launchAngularCorrelations();
};
document.getElementById('gamma1SetLimits').onclick = function(){
dataStore.viewers[dataStore.plots[0]].setAppLimitsCallback = dataStore.setAppLimitsCallback;
delete dataStore.appLimitsStore["gateLimits"];
dataStore.viewers[dataStore.plots[0]].setupSetAppLimitsMode("gateLimits");
document.getElementById('gamma1SetLimitsBadge').classList.add('red-text')
};
document.getElementById('gamma2SetLimits').onclick = function(){
dataStore.viewers[dataStore.plots[0]].setAppLimitsCallback = dataStore.setAppLimitsCallback;
delete dataStore.appLimitsStore["peakLimits"];
dataStore.viewers[dataStore.plots[0]].setupSetAppLimitsMode("peakLimits");
document.getElementById('gamma1SetLimitsBadge').classList.add('red-text')
};
// initial set up of angular momentum spin option dropdowns
// and generate initial calculation state
evenA();
check_jvalues();
//recalculate_L(1);
recalculate_L(2);
recalculate();
// Set up the refit button
document.getElementById('refitButton').onclick = function(){ dataStore.currentTask = "refit"; toggleRefitMode(); }
document.getElementById('refitButton').disabled = true; // Disabled until there are peaks to refit
// Set up the CSV file button
document.getElementById('saveCSV').onclick = function(){ buildCSVfile(); }
// Set up the Script download file button
document.getElementById('saveScript').onclick = function(){ buildScriptfile(); }
// Create Detector choice buttons
for(var i=0; i<dataStore.detectorChoice.length; i++){
newButton = document.createElement('button');
newButton.setAttribute('id', 'detectorChoice-'+dataStore.detectorChoice[i].name);
newButton.setAttribute('class', 'btn btn-default');
newButton.setAttribute('engaged', '0');
newButton.value = dataStore.detectorChoice[i].name;
newButton.innerHTML = dataStore.detectorChoice[i].title;
newButton.onclick = function(){
initializeAngularCorrelations(this.value);
}.bind(newButton);
document.getElementById('detectorChoiceBar').appendChild(newButton);
}
// Hide the subpage menu for now
document.getElementById('menu').classList.add('hidden');
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
});
</script>
</body>
</html>