timprove documentation, add commented cmd moving file to archive - 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 60cf52dcd04452bc76615897018f71f46809ec5e
 (DIR) parent 51b398a9432c3f4a229108676e8435e00600dcfe
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Mon, 24 Aug 2015 16:02:55 +0200
       
       improve documentation, add commented cmd moving file to archive
       
       Diffstat:
         M matlab/file_scanner_mcmc_starter.m  |      36 ++++++++++++++++++++++++++------
         M matlab/import_php_file.m            |       2 +-
       
       2 files changed, 31 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/matlab/file_scanner_mcmc_starter.m b/matlab/file_scanner_mcmc_starter.m
       t@@ -1,16 +1,28 @@
       -%  file_scanner_mcmc_starter.m
       +%%  file_scanner_mcmc_starter.m
        %  This file is started by run.sh.
        %  The script watches an input folder (infolder) for input files generated
        %  by the web interface. The content of the input files is used to start
        %  calls to the MCMC functions.
        %
        
       -% folder of input files
       -%infolder = '~/src/cosmo/matlab';
       +%% folder and file configuration
       +
       +% folder containing input files from web interface ("uploadhistory.php")
        infolder = '/tmp';
       +
       +% uniquely identifying file name prefix for input files
        prefix = 'cosmo_';
        
       -% infinite loop
       +% folder where completed input files are archived. This folder should be
       +% outside of the webserver document root so others cannot acces this
       +% information
       +archivefolder = '/Users/ad/tmp/cosmo-archive';
       +
       +
       +%% general settings
       +debug = true; % show debugging output to matlab console
       +
       +%% main loop
        while 1
            
            % detect all files in infolder starting with prefix
       t@@ -22,8 +34,15 @@ while 1
            
            % process files sequentially
            for i = 1:length(infiles);
       +        
       +        % read full file name and path
                infile = strcat(infolder, '/', infiles(i).name);
       -        disp(infile)
       +        
       +        if debug
       +            disp(infile);
       +        end
       +        
       +        % read file and save data to local scope
                [sampleid, name, email, lat, long, ...
                    be_conc,  al_conc,  c_conc,  ne_conc, ...
                    be_uncer, al_uncer, c_uncer, ne_uncer, ...
       t@@ -35,7 +54,12 @@ while 1
                    record, ...
                    record_threshold_min, record_threshold_max] ...
                    = import_php_file(infile, 1, 1);
       -%        delete(infile)
       +        
       +        % delete or archive the file so it is not processed again
       +        %delete(infile)
       +        %movefile(infile, archivefolder);
       +
       +
            end
        
        
 (DIR) diff --git a/matlab/import_php_file.m b/matlab/import_php_file.m
       t@@ -1,6 +1,6 @@
        function [sampleid,name,email,lat,long,be_conc,al_conc,c_conc,ne_conc,be_uncer,al_uncer,c_uncer,ne_uncer,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)
        
       -% import_php_file.m
       +%% import_php_file.m
        % Automatically generated using the `uiimport` tool in Matlab.
        % If the output format in "uploadhistory.php" is changed, update this file
        % accordingly.