tchange usage of sample depths to one field for all isotopes - 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
---
(DIR) commit afd613d6833aa6534f0739d58e684e1eff30fe69
(DIR) parent f2bb9d234b22b592855ac392e0c8e12f2d916b42
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Tue, 1 Dec 2015 11:27:57 +0100
change usage of sample depths to one field for all isotopes
Diffstat:
M matlab/file_scanner_mcmc_starter.m | 4 ++--
M matlab/import_php_file.m | 60 +++++++++++++++-----------------
M matlab/mcmc_inversion.m | 4 ++--
M pages/history.html | 42 +++++++++----------------------
M uploadhistory.php | 28 +++++-----------------------
5 files changed, 49 insertions(+), 89 deletions(-)
---
(DIR) diff --git a/matlab/file_scanner_mcmc_starter.m b/matlab/file_scanner_mcmc_starter.m
t@@ -81,7 +81,7 @@ while 1
[sample_id, name, email, lat, long, ...
be_conc, al_conc, c_conc, ne_conc, ...
be_uncer, al_uncer, c_uncer, ne_uncer, ...
- be_zobs, al_zobs, c_zobs, ne_zobs, ...
+ zobs, ...
be_prod_spall, al_prod_spall, c_prod_spall, ne_prod_spall, ...
be_prod_muons, al_prod_muons, c_prod_muons, ne_prod_muons, ...
rock_density, ...
t@@ -98,7 +98,7 @@ while 1
nwalkers, outfolder, ...
be_conc, al_conc, c_conc, ne_conc, ...
be_uncer, al_uncer, c_uncer, ne_uncer, ...
- be_zobs, al_zobs, c_zobs, ne_zobs, ...
+ zobs, ...
be_prod_spall, al_prod_spall, c_prod_spall, ne_prod_spall, ...
be_prod_muons, al_prod_muons, c_prod_muons, ne_prod_muons, ...
rock_density, ...
(DIR) diff --git a/matlab/import_php_file.m b/matlab/import_php_file.m
t@@ -2,7 +2,7 @@ function [sample_id, name, email, ...
lat, long, ...
be_conc, al_conc, c_conc, ne_conc, ...
be_uncer, al_uncer, c_uncer, ne_uncer, ...
- be_zobs, al_zobs, c_zobs, ne_zobs, ...
+ zobs, ...
be_prod_spall, al_prod_spall, c_prod_spall, ne_prod_spall, ...
be_prod_muon, al_prod_muon, c_prod_muon, ne_prod_muon, ...
rock_density, ...
t@@ -21,11 +21,11 @@ function [sample_id, name, email, ...
% by the col vector) are converted to numbers.
%IMPORTFILE Import numeric data from a text file as column vectors.
-% [SAMPLEID,NAME,EMAIL,LAT,LONG,BE_CONC,AL_CONC,C_CONC,NE_CONC,BE_UNCER,AL_UNCER,C_UNCER,NE_UNCER,BE_ZOBS,AL_ZOBS,C_ZOBS,NE_ZOBS,BE_PROD,AL_PROD,C_PROD,NE_PROD,ROCK_DENSITY,EPSILON_GLA_MIN,EPSILON_GLA_MAX,EPSILON_INT_MIN,EPSILON_INT_MAX,T_DEGLA,T_DEGLA_UNCER,RECORD,RECORD_THRESHOLD_MIN,RECORD_THRESHOLD_MAX]
+% [SAMPLEID,NAME,EMAIL,LAT,LONG,BE_CONC,AL_CONC,C_CONC,NE_CONC,BE_UNCER,AL_UNCER,C_UNCER,NE_UNCER,ZOBS,BE_PROD,AL_PROD,C_PROD,NE_PROD,ROCK_DENSITY,EPSILON_GLA_MIN,EPSILON_GLA_MAX,EPSILON_INT_MIN,EPSILON_INT_MAX,T_DEGLA,T_DEGLA_UNCER,RECORD,RECORD_THRESHOLD_MIN,RECORD_THRESHOLD_MAX]
% = IMPORTFILE(FILENAME) Reads data from text file FILENAME for the
% default selection.
%
-% [SAMPLEID,NAME,EMAIL,LAT,LONG,BE_CONC,AL_CONC,C_CONC,NE_CONC,BE_UNCER,AL_UNCER,C_UNCER,NE_UNCER,BE_ZOBS,AL_ZOBS,C_ZOBS,NE_ZOBS,BE_PROD,AL_PROD,C_PROD,NE_PROD,ROCK_DENSITY,EPSILON_GLA_MIN,EPSILON_GLA_MAX,EPSILON_INT_MIN,EPSILON_INT_MAX,T_DEGLA,T_DEGLA_UNCER,RECORD,RECORD_THRESHOLD_MIN,RECORD_THRESHOLD_MAX]
+% [SAMPLEID,NAME,EMAIL,LAT,LONG,BE_CONC,AL_CONC,C_CONC,NE_CONC,BE_UNCER,AL_UNCER,C_UNCER,NE_UNCER,ZOBS,BE_PROD,AL_PROD,C_PROD,NE_PROD,ROCK_DENSITY,EPSILON_GLA_MIN,EPSILON_GLA_MAX,EPSILON_INT_MIN,EPSILON_INT_MAX,T_DEGLA,T_DEGLA_UNCER,RECORD,RECORD_THRESHOLD_MIN,RECORD_THRESHOLD_MAX]
% = IMPORTFILE(FILENAME, STARTROW, ENDROW) Reads data from rows STARTROW
% through ENDROW of text file FILENAME.
%
t@@ -47,7 +47,7 @@ end
%% Read columns of data as strings:
% For more information, see the TEXTSCAN documentation.
%formatSpec = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%[^\n\r]';
-formatSpec = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%[^\n\r]';
+formatSpec = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%[^\n\r]';
%% Open the text file.
fileID = fopen(filename,'r');
t@@ -76,9 +76,8 @@ for col=1:length(dataArray)-1
end
numericData = NaN(size(dataArray{1},1),size(dataArray,2));
-% the columns in col are numeric
-%for col=[6,7,8,9,10,11,12,13,18,19,20,21,22,23,24,26,27]
-for col=[6:32, 34:36]
+% the columns in col are numeric]
+for col=[6:29, 31:33]
% Converts strings in the input cell array to numbers. Replaced non-numeric
% strings with NaN.
rawData = dataArray{col};
t@@ -115,10 +114,10 @@ end
% rows with numbers, check that range matches values in for loop l. 68 and
% the list below
-rawNumericColumns = raw(:, [6:32, 34:36]);
+rawNumericColumns = raw(:, [6:29, 31:33]);
% rows with strings
-rawCellColumns = raw(:, [1:5, 33]);
+rawCellColumns = raw(:, [1:5, 30]);
%% Allocate imported array to column variable names
t@@ -137,29 +136,26 @@ be_uncer = cell2mat(rawNumericColumns(:, 5)); % 10
al_uncer = cell2mat(rawNumericColumns(:, 6)); % 11
c_uncer = cell2mat(rawNumericColumns(:, 7)); % 12
ne_uncer = cell2mat(rawNumericColumns(:, 8)); % 13
-be_zobs = cell2mat(rawNumericColumns(:, 9)); % 14
-al_zobs = cell2mat(rawNumericColumns(:, 10)); % 15
-c_zobs = cell2mat(rawNumericColumns(:, 11)); % 16
-ne_zobs = cell2mat(rawNumericColumns(:, 12)); % 17
-be_prod_spall = cell2mat(rawNumericColumns(:, 13)); % 18
-al_prod_spall = cell2mat(rawNumericColumns(:, 14)); % 19
-c_prod_spall = cell2mat(rawNumericColumns(:, 15)); % 20
-ne_prod_spall = cell2mat(rawNumericColumns(:, 16)); % 21
-be_prod_muon = cell2mat(rawNumericColumns(:, 17)); % 22
-al_prod_muon = cell2mat(rawNumericColumns(:, 18)); % 23
-c_prod_muon = cell2mat(rawNumericColumns(:, 19)); % 24
-ne_prod_muon = cell2mat(rawNumericColumns(:, 20)); % 25
-rock_density = cell2mat(rawNumericColumns(:, 21)); % 26
-epsilon_gla_min = cell2mat(rawNumericColumns(:, 22)); % 27
-epsilon_gla_max = cell2mat(rawNumericColumns(:, 23)); % 28
-epsilon_int_min = cell2mat(rawNumericColumns(:, 24)); % 29
-epsilon_int_max = cell2mat(rawNumericColumns(:, 25)); % 30
-t_degla_min = cell2mat(rawNumericColumns(:, 26)); % 31
-t_degla_max = cell2mat(rawNumericColumns(:, 27)); % 32
-record = rawCellColumns(:, 6); % 33
-record_threshold_min = cell2mat(rawNumericColumns(:, 28)); % 34
-record_threshold_max = cell2mat(rawNumericColumns(:, 29)); % 35
-nwalkers = cell2mat(rawNumericColumns(:, 30)); % 36
+zobs = cell2mat(rawNumericColumns(:, 9)); % 14
+be_prod_spall = cell2mat(rawNumericColumns(:, 13)); % 15
+al_prod_spall = cell2mat(rawNumericColumns(:, 14)); % 16
+c_prod_spall = cell2mat(rawNumericColumns(:, 15)); % 17
+ne_prod_spall = cell2mat(rawNumericColumns(:, 16)); % 18
+be_prod_muon = cell2mat(rawNumericColumns(:, 17)); % 19
+al_prod_muon = cell2mat(rawNumericColumns(:, 18)); % 20
+c_prod_muon = cell2mat(rawNumericColumns(:, 19)); % 21
+ne_prod_muon = cell2mat(rawNumericColumns(:, 20)); % 22
+rock_density = cell2mat(rawNumericColumns(:, 21)); % 23
+epsilon_gla_min = cell2mat(rawNumericColumns(:, 22)); % 24
+epsilon_gla_max = cell2mat(rawNumericColumns(:, 23)); % 25
+epsilon_int_min = cell2mat(rawNumericColumns(:, 24)); % 26
+epsilon_int_max = cell2mat(rawNumericColumns(:, 25)); % 27
+t_degla_min = cell2mat(rawNumericColumns(:, 26)); % 28
+t_degla_max = cell2mat(rawNumericColumns(:, 27)); % 29
+record = rawCellColumns(:, 6); % 30
+record_threshold_min = cell2mat(rawNumericColumns(:, 28)); % 31
+record_threshold_max = cell2mat(rawNumericColumns(:, 29)); % 32
+nwalkers = cell2mat(rawNumericColumns(:, 30)); % 33
%% Change units
(DIR) diff --git a/matlab/mcmc_inversion.m b/matlab/mcmc_inversion.m
t@@ -2,7 +2,7 @@ function [Ss, save_file] = mcmc_inversion(matlab_scripts_folder, debug, ...
n_walkers, outfolder, ...
be_conc, al_conc, c_conc, ne_conc, ...
be_uncer, al_uncer, c_uncer, ne_uncer, ...
- be_zobs, al_zobs, c_zobs, ne_zobs, ...
+ zobs, ...
be_prod_spall, al_prod_spall, c_prod_spall, ne_prod_spall, ...
be_prod_muons, al_prod_muons, c_prod_muons, ne_prod_muons, ...
rock_density, ...
t@@ -75,7 +75,7 @@ switch fs.g_case
% one depth per nuclide or not?
%fs.zobs = [0]; %Depths where nucleides are observed
- fs.zobs = [be_zobs, al_zobs, c_zobs, ne_zobs];
+ fs.zobs = zobs;
% fs.zobs = [0,0.3,1,3,10]; %Depths where nucleides are observed
if debug
(DIR) diff --git a/pages/history.html b/pages/history.html
t@@ -114,33 +114,16 @@
</div>
<div class="row">
- <b>TCN sample depth [m]</b><br>
- For each TCN concentration please specify
- the sample depth beneath terrain. Several values may be
- entered using comma separation.<br>
- <div class="input-field col s3">
- <input id="be_zobs" name="be_zobs" type="text"
- class="validate">
- <label for="be_zobs"
- class="active"><sup>10</sup>Be</label>
- </div>
- <div class="input-field col s3">
- <input id="al_zobs" name="al_zobs" type="text"
- class="validate">
- <label for="al_zobs"
- class="active"><sup>26</sup>Al</label>
- </div>
- <div class="input-field col s3">
- <input id="c_zobs" name="c_zobs" type="text"
- class="validate">
- <label for="c_zobs"
- class="active"><sup>14</sup>C</label>
- </div>
- <div class="input-field col s3">
- <input id="ne_zobs" name="ne_zobs" type="text"
+ <b>TCN sample depth(s) [m]</b><br>
+ Please specify the depth beneath terrain surface where the
+ samples are collected. It is assumed that the same
+ TCN concentrations have been determined at all specified
+ depths. Enter multiple depths using comma separation.<br>
+ <div class="input-field col s12">
+ <input id="zobs" name="zobs" type="text"
class="validate">
- <label for="ne_zobs"
- class="active"><sup>21</sup>Ne</label>
+ <label for="zobs"
+ class="active">Sample depth(s)</label>
</div>
</div>
t@@ -149,12 +132,11 @@
<b>Concentrations of terrestrial cosmogenic nuclides (TCNs)
[atoms g<sup>-1</sup>]</b> <br>
For each sample depth specified above, please specify the
- nuclide concentration.
+ nuclide concentration(s).
Fill in <b>at least one</b> field, leave unknown values
blank. Scientific notation (e.g. 5.67e5) is recommended. If
- several depths per isotope are entered above, enter the
- corresponding isotope concentrations with comma
- separation.<br>
+ several depths are entered above, enter the corresponding
+ isotope concentrations using comma separation.<br>
<div class="input-field col s3">
<input id="be_conc" name="be_conc" type="text"
class="validate">
(DIR) diff --git a/uploadhistory.php b/uploadhistory.php
t@@ -78,6 +78,10 @@ if (!isset($_POST['nwalkers']) || $_POST['nwalkers'] == ''){
array_push($missing_fields, 'Number of MCMC walkers');
}
+if (!isset($_POST['zobs']) || $_POST['zobs'] == ''){
+ array_push($missing_fields, 'One or more sample depths');
+}
+
// Check TCN concentrations, at least one value is needed
if ((!isset($_POST['be_conc']) || $_POST['be_conc'] == '') &&
(!isset($_POST['al_conc']) || $_POST['al_conc'] == '') &&
t@@ -91,7 +95,6 @@ if ((!isset($_POST['be_conc']) || $_POST['be_conc'] == '') &&
if ((isset($_POST['be_conc']) && $_POST['be_conc'] != '') &&
(!isset($_POST['be_prod_muons']) || $_POST['be_prod_muons'] == '' ||
!isset($_POST['be_prod_spall']) || $_POST['be_prod_spall'] == '' ||
- !isset($_POST['be_zobs']) || $_POST['be_zobs'] == '' ||
!isset($_POST['be_uncer']) || $_POST['be_uncer'] == '')) {
array_push($missing_fields,
'Production rate, sample depth, and/or uncertainty for ' .
t@@ -100,7 +103,6 @@ if ((isset($_POST['be_conc']) && $_POST['be_conc'] != '') &&
if ((isset($_POST['al_conc']) && $_POST['al_conc'] != '') &&
(!isset($_POST['al_prod_muons']) || $_POST['al_prod_muons'] == '' ||
!isset($_POST['al_prod_spall']) || $_POST['al_prod_spall'] == '' ||
- !isset($_POST['al_zobs']) || $_POST['al_zobs'] == '' ||
!isset($_POST['al_uncer']) || $_POST['al_uncer'] == '')) {
array_push($missing_fields,
'Production rate, sample depth, and/or uncertainty for ' .
t@@ -109,7 +111,6 @@ if ((isset($_POST['al_conc']) && $_POST['al_conc'] != '') &&
if ((isset($_POST['c_conc']) && $_POST['c_conc'] != '') &&
(!isset($_POST['c_prod_muons']) || $_POST['c_prod_muons'] == '' ||
!isset($_POST['c_prod_spall']) || $_POST['c_prod_spall'] == '' ||
- !isset($_POST['c_zobs']) || $_POST['c_zobs'] == '' ||
!isset($_POST['c_uncer']) || $_POST['c_uncer'] == '')) {
array_push($missing_fields,
'Production rate, sample depth, and/or uncertainty for ' .
t@@ -118,7 +119,6 @@ if ((isset($_POST['c_conc']) && $_POST['c_conc'] != '') &&
if ((isset($_POST['ne_conc']) && $_POST['ne_conc'] != '') &&
(!isset($_POST['ne_prod_muons']) || $_POST['ne_prod_muons'] == '' ||
!isset($_POST['ne_prod_spall']) || $_POST['ne_prod_spall'] == '' ||
- !isset($_POST['ne_zobs']) || $_POST['ne_zobs'] == '' ||
!isset($_POST['ne_uncer']) || $_POST['ne_uncer'] == '')) {
array_push($missing_fields,
'Production rate, sample depth, and/or uncertainty for ' .
t@@ -165,21 +165,6 @@ if (count($missing_fields) > 0) {
die();
}
-// The matlab scripts need all depths, even for unused isotopes. Use the value
-// 0.0 if the depth isn't set
-if (!isset($_POST['be_zobs']) || $_POST['be_zobs'] == '') {
- $_POST['be_zobs'] = 0.0;
-}
-if (!isset($_POST['al_zobs']) || $_POST['al_zobs'] == '') {
- $_POST['al_zobs'] = 0.0;
-}
-if (!isset($_POST['c_zobs']) || $_POST['c_zobs'] == '') {
- $_POST['c_zobs'] = 0.0;
-}
-if (!isset($_POST['ne_zobs']) || $_POST['ne_zobs'] == '') {
- $_POST['ne_zobs'] = 0.0;
-}
-
// If this is reached, input is ok and it is time to write the file for matlab
t@@ -200,10 +185,7 @@ $fieldnames = array(
'al_uncer',
'c_uncer',
'ne_uncer',
- 'be_zobs',
- 'al_zobs',
- 'c_zobs',
- 'ne_zobs',
+ 'zobs',
'be_prod_spall',
'al_prod_spall',
'c_prod_spall',