tindex.php - cosmo - front and backend for Markov-Chain Monte Carlo inversion of cosmogenic nuclide concentrations
(HTM) git clone git://src.adamsgaard.dk/cosmo
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
tindex.php (15417B)
---
1 <?php
2
3 // reCAPTCHA setup
4 require_once('recaptchalib.php');
5
6 // your secret key
7 $secret = "6LeMrRATAAAAAOdcvVGi6PfR__XGOVoUP7lCqHp1";
8
9 // empty response
10 $response = null;
11
12 // check secret key
13 $reCaptcha = new ReCaptcha($secret);
14
15 // if submitted check response
16 if ($_POST["g-recaptcha-response"]) {
17 $response = $reCaptcha->verifyResponse(
18 $_SERVER["REMOTE_ADDR"],
19 $_POST["g-recaptcha-response"]
20 );
21 }
22
23 // include top of html template
24 include('head.html');
25
26 ?>
27 <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
28 <script type="text/javascript" src="js/history-form-prefiller.js"></script>
29 <?php
30
31 if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) {
32
33 // read status file contents
34 if (!$statusfile = fopen("/home/adc/cosmo/input/status_" . $_GET['wait_id'], "r")) {
35 echo("Error! Sample data not found.");
36 }
37
38 $status = fgets($statusfile);
39 fclose($statusfile);
40
41 $show_percentage = false;
42 if (strpos($status, '<!--') !== false) {
43 $percentage = preg_replace('/.*<!--/', '', $status);
44 $percentage = preg_replace('/-->/', '', $percentage);
45 $percentage = preg_replace('/ /', '', $percentage);
46 $show_percentage = true;
47 }
48
49 // redirect to results page if computations are complete
50 if (strcmp($status, "Computations complete") == 0) {
51 header("Location: /index.php?results_id=" . $_GET['wait_id']);
52 }
53
54 // refresh the page every 5 seconds while computations are running
55 ?>
56 <meta http-equiv="refresh" content="5" >
57 <?php
58 }
59
60 include('navigation.html');
61 ?>
62 <main>
63 <?php
64 if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) {
65 ?>
66
67 <div class="container">
68
69 <br><br><br><br>
70 <div class="row center">
71 <h2 class="header col s12 orange-text">Please wait</h2>
72 </div>
73
74 <div class="row center">
75 <h4 class="header col s12">
76 <?php
77 echo $status;
78 ?>
79 </h4>
80 </div>
81
82 <div class="row progress center-align s12">
83 <?php
84 if ($show_percentage) { ?>
85 <div class="determinate"
86 style="width: <?php echo($percentage); ?>%"></div>
87 <?php
88 } else { ?>
89 <div class="indeterminate"></div>
90 <?php } ?>
91 </div>
92
93 <div class="row center valign-wrapper">
94
95 <p class="flow-text">
96 Please wait while the inversion computations are taking place.
97 These may make take several minutes to complete. For long waits you may
98 bookmark this page and revisit it later. Please do not resubmit the
99 sample.</p>
100 </div>
101
102 <div class="row center-align">
103 <p class="center-align"> If the computations are queued for more than 24
104 hours, please contact <a href="mailto:anders.damsgaard@geo.au.dk">Anders
105 Damsgaard</a>.</p>
106 </div>
107 <br><br><br><br><br><br>
108
109 </div>
110
111 <?php
112 } elseif (isset($_GET['results_id']) && !empty($_GET['results_id'])) {
113 // show plots
114 ?>
115
116 <div class="section no-pad-bot" id="index-banner">
117 <div class="container">
118 <br><br>
119 <!-- page header -->
120 <h2 class="header center orange-text">MCMC inversion results</h2>
121
122 <div class="row">
123 <div class="col s12">
124 <div class="card">
125 <div class="card-image">
126 <?php
127 include('output/' . $_GET['results_id'] . '_Walks.html');
128 ?>
129 </div>
130 <div class="card-content">
131 <h5 class="blue-text">
132 Results</h5>
133 <p>The table shows the general statistical results of
134 interglacial erosion rate (ε<sub>int</sub>),
135 glacial erosion rate (ε<sub>gla</sub>), climate
136 record threshold value
137 (δ<sup>18</sup>O<sub>threshold</sub>), and total
138 erosion over the last 1 Myr (E), produced the Markov-Chain
139 Monte-Carlo inversion. Results are displayed per walker
140 and on average. The 50th percentiles (also called second
141 quartile) denote the median parameter value. The 25th
142 percentiles (first quartile) marks the value that splits
143 the lowest 25% percent of data from the highest 75%.
144 The 75th percentiles mark the limit to the upper 25% of
145 data. If the 25th, 50th, and 75th percentile values for a
146 parameter are close, the parameter is well constrained.
147 If a single walker produces values with significant
148 deviation from the others, remove it from the data
149 set. NaN results in total erosion rate mean that the rate
150 exceeds values which are possible to constrain.</p>
151 </div>
152 <div class="card-action">
153 <a href="output/<?php
154 echo($_GET['results_id']); ?>_Walks.csv"
155 target="_blank">Link to CSV</a>
156 (right click to save, can be imported to Excel, Matlab, etc.)
157 </div>
158 </div>
159 </div>
160
161 <div class="row">
162 <!--<div class="col s12 m8 offset-m2">-->
163 <div class="col s12">
164 <div class="card">
165 <div class="card-image">
166 <img src="output/<?php
167 echo($_GET['results_id']); ?>_Walks-6.png">
168 <!--<span class="card-title blue-text text-darken-2">
169 Generalized model parameter values</span>-->
170 </div>
171 <div class="card-content">
172 <h5 class="blue-text">
173 Generalized model parameter values</h5>
174 <p>The histograms show the distribution of (a)
175 interglacial erosion rate, (b) glacial erosion rate, (c)
176 timing of last deglaciation, and (d)
177 d<sup>18</sup>O<sub>threshold</sub> levels that provide
178 the best fit to the supplied TCN concentrations.
179 The vertical axis indicates the number of
180 simulations included in each bin out of the 10,000
181 simulations that followed the MCMC burn-in phase from each
182 MCMC walker. The solid magenta lines denote the median
183 values (second quartile), while the dashed magenta lines
184 denote the lower and upper quartiles (25th and 75th
185 percentiles, respectively). A parameter is well
186 constrained if the histogram has a single, distinct peak,
187 and relatively close median, lower and upper quartile
188 values. Flat histograms denote that the parameters are not
189 well constrained.</p>
190 </div>
191 <div class="card-action">
192 <a href="output/<?php
193 echo($_GET['results_id']); ?>_Walks-6.png"
194 target="_blank">Link to PNG</a>
195 <a href="output/<?php
196 echo($_GET['results_id']); ?>_Walks-6.pdf"
197 target="_blank">Link to PDF</a>
198 <a href="output/<?php
199 echo($_GET['results_id']); ?>_Walks-6.fig"
200 target="_blank">Link to FIG</a>
201 <br>
202 <a href="output/<?php
203 echo($_GET['results_id']); ?>_Walks-eps_int.txt"
204 target="_blank">ε<sub>int</sub> data</a>
205 <a href="output/<?php
206 echo($_GET['results_id']); ?>_Walks-eps_gla.txt"
207 target="_blank">ε<sub>gla</sub> data</a>
208 <a href="output/<?php
209 echo($_GET['results_id']); ?>_Walks-t_degla.txt"
210 target="_blank"><i>t</i><sub>degla</sub> data</a>
211 <a href="output/<?php
212 echo($_GET['results_id']); ?>_Walks-d18O_threshold.txt"
213 target="_blank">δ<sup>18</sup>O<sub>threshold</sub> data</a>
214 </div>
215 </div>
216 </div>
217 </div>
218
219
220 <div class="row">
221 <!--<div class="col s12 m8 offset-m2">-->
222 <div class="col s12">
223 <div class="card">
224 <div class="card-image">
225 <img src="output/<?php
226 echo($_GET['results_id']); ?>_Walks-5.png">
227 <!--
228 <span class="card-title blue-text text-darken-2">
229 Model parameter values per inversion walker</span>
230 -->
231 </div>
232 <div class="card-content">
233 <h5 class="blue-text">
234 Model parameter values per inversion walker</h5>
235 <p>The histograms show the distribution of (a)
236 interglacial erosion rate, (b) glacial erosion rate, (c)
237 timing of last deglaciation, and (d)
238 d<sup>18</sup>O<sub>threshold</sub> levels that provide
239 the best fit to the supplied TCN concentrations. There is
240 one histogram per model parameter for each MCMC walker.
241 The <!--fraction indicates the number of simulations
242 included in--> vertical axis indicates the number of
243 simulations included in each bin out of the 10,000
244 simulations that followed the MCMC burn-in phase.</p>
245 </div>
246 <div class="card-action">
247 <a href="output/<?php
248 echo($_GET['results_id']); ?>_Walks-5.png"
249 target="_blank">Link to PNG</a>
250 <a href="output/<?php
251 echo($_GET['results_id']); ?>_Walks-5.pdf"
252 target="_blank">Link to PDF</a>
253 <a href="output/<?php
254 echo($_GET['results_id']); ?>_Walks-5.fig"
255 target="_blank">Link to FIG</a>
256 <br>
257 <?php include('output/' . $_GET['results_id'] . '_Walks-walker-data.html'); ?>
258 </div>
259 </div>
260 </div>
261 </div>
262
263 <div class="row">
264 <!--<div class="col s12 m8 offset-m2">-->
265 <div class="col s12">
266 <div class="card">
267 <div class="card-image">
268 <img src="output/<?php
269 echo($_GET['results_id']); ?>_Walks-7.png">
270 <!--
271 <span class="card-title blue-text text-darken-2">
272 Erosion history</span>-->
273 </div>
274 <div class="card-content">
275 <h5 class="blue-text">
276 Median-based model of sample history</h5>
277 <p>
278 (a) Two-stage glacial-interglacial model based on the
279 selected climate record and the median
280 δ<sup>18</sup>O<sub>threshold</sub> value from the
281 first figure above. Timing and duration of glacial and
282 interglacial periods are defined by the threshold value
283 that is applied to the climate record.
284
285 (b) Binary exposure history between glaciations
286 characterized by total exposure and interglacials without
287 any exposure.
288
289 (c) Erosion rate through time which alternates between
290 interglacial and glacial erosion rate magnitude, based on
291 median values presented above.
292
293 In all three figures the vertical dashed lines denotes the
294 median age of the last deglaciation.
295
296 </p>
297 </div>
298 <div class="card-action">
299 <a href="output/<?php
300 echo($_GET['results_id']); ?>_Walks-7.png"
301 target="_blank">Link to PNG</a>
302 <a href="output/<?php
303 echo($_GET['results_id']); ?>_Walks-7.pdf"
304 target="_blank">Link to PDF</a>
305 <a href="output/<?php
306 echo($_GET['results_id']); ?>_Walks-7.fig"
307 target="_blank">Link to FIG</a>
308 </div>
309 </div>
310 </div>
311 </div>
312
313 <div class="row">
314 <!--<div class="col s12 m8 offset-m2">-->
315 <div class="col s12">
316 <div class="card">
317 <div class="card-image">
318 <img src="output/<?php
319 echo($_GET['results_id']); ?>_Walks-8.png">
320 <!--
321 <span class="card-title blue-text text-darken-2">
322 Erosion history</span>-->
323 </div>
324 <div class="card-content">
325 <h5 class="blue-text">
326 Exhumation history</h5>
327 <p>
328 Mean (black) and 25 and 75 percentiles (red) of sample
329 exhumation history. There is one subplot per MCMC walker.
330 </p>
331 </div>
332 <div class="card-action">
333 <a href="output/<?php
334 echo($_GET['results_id']); ?>_Walks-8.png"
335 target="_blank">Link to PNG</a>
336 <a href="output/<?php
337 echo($_GET['results_id']); ?>_Walks-8.pdf"
338 target="_blank">Link to PDF</a>
339 <a href="output/<?php
340 echo($_GET['results_id']); ?>_Walks-8.fig"
341 target="_blank">Link to FIG</a>
342 </div>
343 </div>
344 </div>
345 </div>
346
347 <div class="row">
348 <div class="col s12">
349 <div class="card">
350 <div class="card-image">
351 <?php
352 include('output/' . $_GET['results_id'] . '_Walks-input.html');
353 ?>
354 </div>
355 <div class="card-content">
356 <h5 class="blue-text">
357 Input parameters</h5>
358 <p>This table summarizes the supplied input parameter
359 values.</p>
360
361 </div>
362 </div>
363 </div>
364 </div>
365
366
367 <?php
368 } else {
369 ?>
370 <div ng-view>
371 <!-- content is injected here -->
372 </div>
373 <?php } ?>
374
375 </main>
376
377 <?php include('foot.html'); ?>
378
379