-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpeakFitter.html
More file actions
executable file
·270 lines (236 loc) · 12.6 KB
/
peakFitter.html
File metadata and controls
executable file
·270 lines (236 loc) · 12.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
<html>
<head>
<title>GRIFFIN Peak Fitter</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/helpers.js' type="text/javascript"></script>
<script src='scripts/peakFitter.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='peakFitterReport' rel="import" href="templates/peakFitterReport/peakFitterReport.html">
<link id='peakFitterReportTable' rel="import" href="templates/peakFitterReport/peakFitterReportTable.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='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 hidden">
<div id='peakFitterProgress' 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>
This app will fit one or more peaks in a set of spectra for a set of histogram files, and then provide the results in a few formats. Fill in the Histogram files, spectra and peaks details in the input boxes. Alternatively a script can be uploaded to quickly fill the inputs.
</div>
<div id='fetchingMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Spectra are downloading from the server...
</div>
<div id='projectionsMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Projecting the 2d matrices...
</div>
<div id='fittingSinglesMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Fitting the peaks in the 1d spectra...
</div>
<div id='fittingProjectionsMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Fitting the peaks in the projected spectra from the 2d spectra...
</div>
<div id='reviewMessage' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Analysis complete. Review the results in the table below. Results can be downloaded as CSV or text files.
</div>
</div>
<!--User input for initial setup-->
<div id='userInputBar' class='col-md-12'>
<div id='histoChoiceDir' class='col-md-12'></div>
<div id='dropareaContainerDiv' class='col-md-12'>
<div id='drop-area' class='col-md-6'>
<form class="my-form">
<p>Optionally upload a script file to populate the inputs. Drag and drop the file into the dashed region, or click the button to select a file</p>
<input type="file" id="fileElem" accept="json/*" onchange="handleDropFiles(this.files)">
<label class="btn btn-info" for="fileElem">Upload script file</label>
<div id="dropAreaTitleDiv"></div>
</form>
</div>
<div id='error-messages-for-drop-area' class='col-md-6 error-text'></div>
</div>
<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 id='buttonsContainerDiv' class='col-md-12'>
<div id='launchSubmitDiv' class='col-md-6'></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>
<!--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>
<!--Table of calculations and results-->
<div id='peakFitter'></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', 'peakFitterReport', 'peakFitterReportTable', 'plotGrid', 'plotControl', 'plotListLite', 'footer']);
setupHeader('head', 'Peak Fitter');
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');
// Setup the drop area
setupDropArea();
// 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);
// 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();
// Set up the refit button
document.getElementById('refitButton').onclick = function(){ 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(); }
// Set up the onchange functions for the textinput boxes
document.getElementById('inputHistogramFiles').onchange = function(){
receiveInputTextBoxChange(this.id,this.value);
}
document.getElementById('input1dSpectrumNames').onchange = function(){
receiveInputTextBoxChange(this.id,this.value);
}
document.getElementById('input1dPeaks').onchange = function(){
receiveInputTextBoxChange(this.id,this.value);
}
document.getElementById('input2dSpectrumNames').onchange = function(){
receiveInputTextBoxChange(this.id,this.value);
}
document.getElementById('input2dGates').onchange = function(){
receiveInputTextBoxChange(this.id,this.value);
}
document.getElementById('input2dPeaks').onchange = function(){
receiveInputTextBoxChange(this.id,this.value);
}
// Create the Launch Submit button to begin the process
newButton = document.createElement('button');
newButton.setAttribute('id', 'launchSubmitButton');
newButton.setAttribute('class', 'btn btn-default btn-lg');
newButton.innerHTML = "Begin the peak fitting";
newButton.style.padding = '4px';
newButton.onclick = function(){
dataStore.dataType = 'Fetch';
launchPeakFittingProcess();
}.bind(newButton);
document.getElementById('launchSubmitDiv').appendChild(newButton);
// Reveal the progress bar
document.getElementById('progressDiv').classList.remove('hidden');
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
});
</script>
</body>
</html>