twrite new fields to file, update file scanner script - 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 602c4a22e826a9710597c6518d86d7d833a328d5
 (DIR) parent e4c6c0f9e05263dd00dd469ac5080a2c37249daf
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Tue, 17 Nov 2015 16:18:35 +0100
       
       write new fields to file, update file scanner script
       
       Diffstat:
         M matlab/file_scanner_mcmc_starter.m  |      14 +++++++++-----
         M matlab/import_php_file.m            |      31 ++++++++++++++++++++++---------
         M uploadhistory.php                   |      19 ++++++++++++-------
       
       3 files changed, 43 insertions(+), 21 deletions(-)
       ---
 (DIR) diff --git a/matlab/file_scanner_mcmc_starter.m b/matlab/file_scanner_mcmc_starter.m
       t@@ -80,13 +80,15 @@ while 1
                    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, ...
       +            be_prod_muons, al_prod_muons, c_prod_muons, ne_prod_muons, ...
       +            be_prod_spall, al_prod_spall, c_prod_spall, ne_prod_spall, ...
                    rock_density, ...
                    epsilon_gla_min, epsilon_gla_max, ...
                    epsilon_int_min, epsilon_int_max, ...
       -            t_degla, t_degla_uncer, ...
       +            t_degla_min, t_degla_max, ...
                    record, ...
       -            record_threshold_min, record_threshold_max] ...
       +            record_threshold_min, record_threshold_max, ...
       +            nwalkers] ...
                    = import_php_file(infile, 1, 1); % only read first line
                
                % run inversion
       t@@ -95,13 +97,15 @@ while 1
                    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, ...
       +            be_prod_muons, al_prod_muons, c_prod_muons, ne_prod_muons, ...
       +            be_prod_spall, al_prod_spall, c_prod_spall, ne_prod_spall, ...
                    rock_density, ...
                    epsilon_gla_min, epsilon_gla_max, ...
                    epsilon_int_min, epsilon_int_max, ...
       -            t_degla, t_degla_uncer, ...
       +            t_degla_min, t_degla_max, ...
                    record, ...
                    record_threshold_min, record_threshold_max, ...
       +            nwalkers, ...
                    statusfile, id);
                
                fid = fopen(statusfile, 'w');
 (DIR) diff --git a/matlab/import_php_file.m b/matlab/import_php_file.m
       t@@ -1,4 +1,17 @@
       -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,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] = import_php_file(filename, startRow, endRow)
       +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, ...
       +    be_prod_muon, al_prod_muon, c_prod_muon, ne_prod_muon, ...
       +    be_prod_spall, al_prod_spall, c_prod_spall, ne_prod_spall, ...
       +    rock_density, ...
       +    epsilon_gla_min, epsilon_gla_max, ...
       +    epsilon_int_min, epsilon_int_max, ...
       +    t_degla_min, t_degla_max, ...
       +    record, record_threshold_min, record_threshold_max, ...
       +    nwalkers] = ...
       +    import_php_file(filename, startRow, endRow)
        
        %% import_php_file.m
        % Automatically generated using the `uiimport` tool in Matlab.
       t@@ -34,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%[^\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]';
        
        %% Open the text file.
        fileID = fopen(filename,'r');
       t@@ -65,7 +78,7 @@ 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:28, 30:31]
       +for col=[6:32, 34:36]
            % Converts strings in the input cell array to numbers. Replaced non-numeric
            % strings with NaN.
            rawData = dataArray{col};
       t@@ -128,17 +141,17 @@ 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              = cell2mat(rawNumericColumns(:, 13)); % 18
       -al_prod              = cell2mat(rawNumericColumns(:, 14)); % 19
       -c_prod               = cell2mat(rawNumericColumns(:, 15)); % 20
       -ne_prod              = cell2mat(rawNumericColumns(:, 16)); % 21
       +be_prod_muon              = cell2mat(rawNumericColumns(:, 13)); % 18
       +al_prod_muon              = cell2mat(rawNumericColumns(:, 14)); % 19
       +c_prod_muon               = cell2mat(rawNumericColumns(:, 15)); % 20
       +ne_prod_muon              = cell2mat(rawNumericColumns(:, 16)); % 21
        rock_density         = cell2mat(rawNumericColumns(:, 17)); % 22
        epsilon_gla_min      = cell2mat(rawNumericColumns(:, 18)); % 23
        epsilon_gla_max      = cell2mat(rawNumericColumns(:, 19)); % 24
        epsilon_int_min      = cell2mat(rawNumericColumns(:, 20)); % 25
        epsilon_int_max      = cell2mat(rawNumericColumns(:, 21)); % 26
       -t_degla              = cell2mat(rawNumericColumns(:, 22)); % 27
       -t_degla_uncer        = cell2mat(rawNumericColumns(:, 23)); % 28
       +t_degla_min              = cell2mat(rawNumericColumns(:, 22)); % 27
       +t_degla_max        = cell2mat(rawNumericColumns(:, 23)); % 28
        record               = rawCellColumns(:, 6);               % 29
        record_threshold_min = cell2mat(rawNumericColumns(:, 24)); % 30
        record_threshold_max = cell2mat(rawNumericColumns(:, 25)); % 31
 (DIR) diff --git a/uploadhistory.php b/uploadhistory.php
       t@@ -189,20 +189,25 @@ $fieldnames = array(
            'al_zobs',
            'c_zobs',
            'ne_zobs',
       -    'be_prod',
       -    'al_prod',
       -    'c_prod',
       -    'ne_prod',
       +    'be_prod_muons',
       +    'al_prod_muons',
       +    'c_prod_muons',
       +    'ne_prod_muons',
       +    'be_prod_spall',
       +    'al_prod_spall',
       +    'c_prod_spall',
       +    'ne_prod_spall',
            'rock_density',
            'epsilon_gla_min',
            'epsilon_gla_max',
            'epsilon_int_min',
            'epsilon_int_max',
       -    't_degla',
       -    't_degla_uncer',
       +    't_degla_min',
       +    't_degla_max',
            'record', // check if set missing
            'record_threshold_min',
       -    'record_threshold_max');
       +    'record_threshold_max',
       +    'nwalkers');
        
        // Generate unique output file name
        //$outputfile = tempnam('/tmp', 'cosmo_');