index.php 15 KB
Newer Older
1
<?php
2 3 4 5 6

// reCAPTCHA setup
require_once('recaptchalib.php');

// your secret key
Anders Damsgaard's avatar
Anders Damsgaard committed
7
$secret = "";
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 
// empty response
$response = null;
 
// check secret key
$reCaptcha = new ReCaptcha($secret);

// if submitted check response
if ($_POST["g-recaptcha-response"]) {
    $response = $reCaptcha->verifyResponse(
        $_SERVER["REMOTE_ADDR"],
        $_POST["g-recaptcha-response"]
    );
}

// include top of html template
include('head.html');

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>
Anders Damsgaard's avatar
Anders Damsgaard committed
29
<?php
30

31
if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) {
32 33 34 35 36 37 38 39 40

    // read status file contents
    if (!$statusfile = fopen("/home/adc/cosmo/input/status_" . $_GET['wait_id'], "r")) {
        echo("Error! Sample data not found.");
    }

    $status = fgets($statusfile);
    fclose($statusfile);

41 42 43 44 45 46 47 48
    $show_percentage = false;
    if (strpos($status, '<!--') !== false) {
        $percentage = preg_replace('/.*<!--/', '', $status);
        $percentage = preg_replace('/-->/', '', $percentage);
        $percentage = preg_replace('/ /', '', $percentage);
        $show_percentage = true;
    }

49 50 51 52 53
    // redirect to results page if computations are complete
    if (strcmp($status, "Computations complete") == 0) {
        header("Location: /index.php?results_id=" . $_GET['wait_id']);
    }

54 55 56 57 58
    // refresh the page every 5 seconds while computations are running
?>
    <meta http-equiv="refresh" content="5" >
<?php
}
Anders Damsgaard's avatar
Anders Damsgaard committed
59

60 61
include('navigation.html');
?>
62
        <main>
Anders Damsgaard's avatar
Anders Damsgaard committed
63
<?php
64
if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) {
Anders Damsgaard's avatar
Anders Damsgaard committed
65
?>
66

Anders Damsgaard's avatar
Anders Damsgaard committed
67 68
    <div class="container">

69
        <br><br><br><br>
70
        <div class="row center">
71
            <h2 class="header col s12 orange-text">Please wait</h2>
72 73
        </div>

74
        <div class="row center">
75
            <h4 class="header col s12">
76
<?php
77
    echo $status;
78
?>
79
            </h4>
80 81
        </div>

82
        <div class="row progress center-align s12">
83 84 85 86 87 88
<?php
    if ($show_percentage) { ?>
            <div class="determinate"
                style="width: <?php echo($percentage); ?>%"></div>
<?php
    } else { ?>
Anders Damsgaard's avatar
Anders Damsgaard committed
89
            <div class="indeterminate"></div>
90
<?php } ?>
91
        </div>
Anders Damsgaard's avatar
Anders Damsgaard committed
92 93 94

        <div class="row center valign-wrapper">

95 96
        <p class="flow-text">
        Please wait while the inversion computations are taking place.
97 98 99
        These may make take several minutes to complete. For long waits you may
        bookmark this page and revisit it later. Please do not resubmit the
        sample.</p>
100
        </div>
Anders Damsgaard's avatar
Anders Damsgaard committed
101

Anders Damsgaard's avatar
Anders Damsgaard committed
102
        <div class="row center-align">
Anders Damsgaard's avatar
Anders Damsgaard committed
103
        <p class="center-align"> If the computations are queued for more than 24
104 105
        hours, please contact <a href="mailto:anders.damsgaard@geo.au.dk">Anders
            Damsgaard</a>.</p>
Anders Damsgaard's avatar
Anders Damsgaard committed
106
        </div>
107
        <br><br><br><br><br><br>
Anders Damsgaard's avatar
Anders Damsgaard committed
108

Anders Damsgaard's avatar
Anders Damsgaard committed
109 110
    </div>

111 112 113 114 115 116 117 118 119
<?php
} elseif (isset($_GET['results_id']) && !empty($_GET['results_id'])) {
    // show plots
?>

    <div class="section no-pad-bot" id="index-banner">
        <div class="container">
            <br><br>
            <!-- page header -->
120
            <h2 class="header center orange-text">MCMC inversion results</h2>
121

122
            <div class="row">
Anders Damsgaard's avatar
Anders Damsgaard committed
123
              <div class="col s12">
Anders Damsgaard's avatar
Anders Damsgaard committed
124 125 126 127 128 129 130 131 132
                <div class="card">
                  <div class="card-image">
                <?php 
                    include('output/' . $_GET['results_id'] . '_Walks.html');
                ?>
                  </div>
                  <div class="card-content">
                      <h5 class="blue-text">
                          Results</h5>
133 134 135 136 137
                      <p>The table shows the general statistical results of
                      interglacial erosion rate (&epsilon;<sub>int</sub>),
                      glacial erosion rate (&epsilon;<sub>gla</sub>), climate
                      record threshold value
                      (&delta;<sup>18</sup>O<sub>threshold</sub>), and total
138 139 140
                      erosion over the last 1 Myr (E), produced the Markov-Chain
                      Monte-Carlo inversion. Results are displayed per walker
                      and on average. The 50th percentiles (also called second
141 142 143 144 145
                      quartile) denote the median parameter value. The 25th
                      percentiles (first quartile) marks the value that splits
                      the lowest 25% percent of data from the highest 75%.
                      The 75th percentiles mark the limit to the upper 25% of
                      data. If the 25th, 50th, and 75th percentile values for a
146 147 148
                      parameter are close, the parameter is well constrained. 
                      If a single walker produces values with significant
                      deviation from the others, remove it from the data
149 150
                      set. NaN results in total erosion rate mean that the rate
                      exceeds values which are possible to constrain.</p>
Anders Damsgaard's avatar
Anders Damsgaard committed
151
                  </div>
152 153 154
                  <div class="card-action">
                  <a href="output/<?php
                        echo($_GET['results_id']); ?>_Walks.csv"
155 156
                     target="_blank">Link to CSV</a>
                  (right click to save, can be imported to Excel, Matlab, etc.)
Anders Damsgaard's avatar
Anders Damsgaard committed
157 158
                </div>
              </div>
Anders Damsgaard's avatar
Anders Damsgaard committed
159 160
            </div>

161
            <div class="row">
162 163
                <!--<div class="col s12 m8 offset-m2">-->
              <div class="col s12">
164 165 166
                <div class="card">
                  <div class="card-image">
                  <img src="output/<?php
Anders Damsgaard's avatar
Anders Damsgaard committed
167
                        echo($_GET['results_id']); ?>_Walks-6.png">
168 169
                        <!--<span class="card-title blue-text text-darken-2">
                            Generalized model parameter values</span>-->
170 171
                  </div>
                  <div class="card-content">
Anders Damsgaard's avatar
Anders Damsgaard committed
172 173
                      <h5 class="blue-text">
                          Generalized model parameter values</h5>
174 175 176 177 178 179 180 181 182 183 184
                      <p>The histograms show the distribution of (a)
                      interglacial erosion rate, (b) glacial erosion rate, (c)
                      timing of last deglaciation, and (d)
                      d<sup>18</sup>O<sub>threshold</sub> levels that provide
                      the best fit to the supplied TCN concentrations. 
                      The vertical axis indicates the number of
                      simulations included in each bin out of the 10,000
                      simulations that followed the MCMC burn-in phase from each
                      MCMC walker.  The solid magenta lines denote the median
                      values (second quartile), while the dashed magenta lines
                      denote the lower and upper quartiles (25th and 75th
185 186 187 188 189
                      percentiles, respectively). A parameter is well
                      constrained if the histogram has a single, distinct peak,
                      and relatively close median, lower and upper quartile
                      values. Flat histograms denote that the parameters are not
                      well constrained.</p>
190 191 192
                  </div>
                  <div class="card-action">
                  <a href="output/<?php
Anders Damsgaard's avatar
Anders Damsgaard committed
193
                        echo($_GET['results_id']); ?>_Walks-6.png"
194 195
                    target="_blank">Link to PNG</a>
                  <a href="output/<?php
Anders Damsgaard's avatar
Anders Damsgaard committed
196
                        echo($_GET['results_id']); ?>_Walks-6.pdf"
197 198
                    target="_blank">Link to PDF</a>
                  <a href="output/<?php
Anders Damsgaard's avatar
Anders Damsgaard committed
199
                        echo($_GET['results_id']); ?>_Walks-6.fig"
Anders Damsgaard's avatar
Anders Damsgaard committed
200 201 202 203 204 205 206 207 208 209 210 211 212 213
                     target="_blank">Link to FIG</a>
                  <br>
                  <a href="output/<?php
                        echo($_GET['results_id']); ?>_Walks-eps_int.txt"
                     target="_blank">&epsilon;<sub>int</sub> data</a>
                  <a href="output/<?php
                        echo($_GET['results_id']); ?>_Walks-eps_gla.txt"
                     target="_blank">&epsilon;<sub>gla</sub> data</a>
                  <a href="output/<?php
                        echo($_GET['results_id']); ?>_Walks-t_degla.txt"
                     target="_blank"><i>t</i><sub>degla</sub> data</a>
                  <a href="output/<?php
                        echo($_GET['results_id']); ?>_Walks-d18O_threshold.txt"
                     target="_blank">&delta;<sup>18</sup>O<sub>threshold</sub> data</a>
214 215 216 217 218 219
                  </div>
                </div>
              </div>
            </div>


220
            <div class="row">
221 222
                <!--<div class="col s12 m8 offset-m2">-->
              <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 230
                        Model parameter values per inversion walker</span>
                        -->
231 232
                  </div>
                  <div class="card-content">
Anders Damsgaard's avatar
Anders Damsgaard committed
233 234
                      <h5 class="blue-text">
                          Model parameter values per inversion walker</h5>
235 236 237 238
                      <p>The histograms show the distribution of (a)
                      interglacial erosion rate, (b) glacial erosion rate, (c)
                      timing of last deglaciation, and (d)
                      d<sup>18</sup>O<sub>threshold</sub> levels that provide
239 240 241 242 243 244
                      the best fit to the supplied TCN concentrations. There is
                      one histogram per model parameter for each MCMC walker.
                      The <!--fraction indicates the number of simulations
                      included in--> vertical axis indicates the number of
                      simulations included in each bin out of the 10,000
                      simulations that followed the MCMC burn-in phase.</p>
245 246 247
                  </div>
                  <div class="card-action">
                  <a href="output/<?php
248
                        echo($_GET['results_id']); ?>_Walks-5.png"
249 250
                    target="_blank">Link to PNG</a>
                  <a href="output/<?php
251
                        echo($_GET['results_id']); ?>_Walks-5.pdf"
252 253
                    target="_blank">Link to PDF</a>
                  <a href="output/<?php
254
                        echo($_GET['results_id']); ?>_Walks-5.fig"
255
                    target="_blank">Link to FIG</a>
256
                  <br>
Anders Damsgaard's avatar
Anders Damsgaard committed
257
                  <?php include('output/' . $_GET['results_id'] . '_Walks-walker-data.html'); ?>
258 259 260 261 262
                  </div>
                </div>
              </div>
            </div>

263
            <div class="row">
264 265
                <!--<div class="col s12 m8 offset-m2">-->
              <div class="col s12">
266
                <div class="card">
267
                  <div class="card-image">
268
                  <img src="output/<?php
Anders Damsgaard's avatar
Anders Damsgaard committed
269
                        echo($_GET['results_id']); ?>_Walks-7.png">
270
                        <!--
271
                        <span class="card-title blue-text text-darken-2">
272
                        Erosion history</span>-->
273 274
                  </div>
                  <div class="card-content">
Anders Damsgaard's avatar
Anders Damsgaard committed
275 276
                      <h5 class="blue-text">
                          Median-based model of sample history</h5>
277 278
                      <p>
                      (a) Two-stage glacial-interglacial model based on the
279
                      selected climate record and the median
Anders Damsgaard's avatar
Anders Damsgaard committed
280
                      &delta;<sup>18</sup>O<sub>threshold</sub> value from the
281 282
                      first figure above.  Timing and duration of glacial and
                      interglacial periods are defined by the threshold value
283
                      that is applied to the climate record. 
284 285 286 287 288 289 290 291

                      (b) Binary exposure history between glaciations
                      characterized by total exposure and interglacials without
                      any exposure.

                      (c) Erosion rate through time which alternates between
                      interglacial and glacial erosion rate magnitude, based on
                      median values presented above.
292 293 294

                      In all three figures the vertical dashed lines denotes the
                      median age of the last deglaciation.
295 296 297 298 299
                      
                      </p>
                  </div>
                  <div class="card-action">
                  <a href="output/<?php
Anders Damsgaard's avatar
Anders Damsgaard committed
300
                        echo($_GET['results_id']); ?>_Walks-7.png"
301 302
                    target="_blank">Link to PNG</a>
                  <a href="output/<?php
Anders Damsgaard's avatar
Anders Damsgaard committed
303
                        echo($_GET['results_id']); ?>_Walks-7.pdf"
304 305
                    target="_blank">Link to PDF</a>
                  <a href="output/<?php
Anders Damsgaard's avatar
Anders Damsgaard committed
306
                        echo($_GET['results_id']); ?>_Walks-7.fig"
307 308 309 310 311 312
                    target="_blank">Link to FIG</a>
                  </div>
                </div>
              </div>
            </div>

313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
            <div class="row">
                <!--<div class="col s12 m8 offset-m2">-->
              <div class="col s12">
                <div class="card">
                  <div class="card-image">
                  <img src="output/<?php
                        echo($_GET['results_id']); ?>_Walks-8.png">
                        <!--
                        <span class="card-title blue-text text-darken-2">
                        Erosion history</span>-->
                  </div>
                  <div class="card-content">
                      <h5 class="blue-text">
                          Exhumation history</h5>
                      <p>
328 329
                      Mean (black) and 25 and 75 percentiles (red) of sample
                      exhumation history. There is one subplot per MCMC walker.
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
                      </p>
                  </div>
                  <div class="card-action">
                  <a href="output/<?php
                        echo($_GET['results_id']); ?>_Walks-8.png"
                    target="_blank">Link to PNG</a>
                  <a href="output/<?php
                        echo($_GET['results_id']); ?>_Walks-8.pdf"
                    target="_blank">Link to PDF</a>
                  <a href="output/<?php
                        echo($_GET['results_id']); ?>_Walks-8.fig"
                    target="_blank">Link to FIG</a>
                  </div>
                </div>
              </div>
            </div>

347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
            <div class="row">
              <div class="col s12">
                <div class="card">
                  <div class="card-image">
                <?php 
                    include('output/' . $_GET['results_id'] . '_Walks-input.html');
                ?>
                  </div>
                  <div class="card-content">
                      <h5 class="blue-text">
                          Input parameters</h5>
                      <p>This table summarizes the supplied input parameter
                      values.</p>

                  </div>
                </div>
              </div>
            </div>


Anders Damsgaard's avatar
Anders Damsgaard committed
367 368 369
<?php
} else {
?>
370 371 372
        <div ng-view>
            <!-- content is injected here -->
        </div>
Anders Damsgaard's avatar
Anders Damsgaard committed
373 374
<?php } ?>

375
        </main>
Anders Damsgaard's avatar
Anders Damsgaard committed
376

377
<?php include('foot.html'); ?>
378 379