0001 function data_proc = fproc_data(datapath,load_id,opt)
0002
0003 if nargin < 3,
0004 opt.save = 0;
0005 opt.nr_dep = 0;
0006 opt.peak = 'n';
0007 opt.wave = 'y';
0008 opt.rho = 'p';
0009 end
0010
0011
0012
0013 if length(load_id) > 5 && strcmp(load_id(1:5),'PROC_'),
0014 load_id = load_id(6:end);
0015 end
0016 if length(load_id) > 13 && strcmp(load_id(1:13),'LUKE_RESULTS_'),
0017 load_id = load_id(14:end);
0018 end
0019 if length(load_id) > 10 && strcmp(load_id(1:10),'LUKE_DATA_'),
0020 load_id = load_id(11:end);
0021 end
0022
0023 datafile1 = ['LUKE_RESULTS_',load_id,'.mat'];
0024 datafile2 = ['LUKE_DATA_',load_id,'.mat'];
0025 proc_datafile1 = ['PROC_',datafile1];
0026 proc_datafile2 = ['PROC_',datafile2];
0027
0028 procdata = 0;
0029
0030 data_proc = '';
0031
0032 if exist([datapath,proc_datafile1],'file') && (gettime_jd(proc_datafile1,datapath) > gettime_jd(datafile1,datapath)),
0033
0034 load([datapath,proc_datafile1],'data_proc');
0035
0036 procdata = 1;
0037 opt.save = 0;
0038
0039 datafile = datafile1;
0040
0041 end
0042
0043 if procdata == 0 && exist([datapath,proc_datafile2],'file') && (gettime_jd(proc_datafile2,datapath) > gettime_jd(datafile2,datapath)),
0044
0045 load([datapath,proc_datafile2],'data_proc');
0046
0047 procdata = 1;
0048 opt.save = 0;
0049
0050 datafile = datafile2;
0051
0052 end
0053
0054 if procdata == 0 && exist([datapath,datafile1],'file'),
0055
0056 data = load([datapath,datafile1]);
0057
0058 data_proc = proc_luke_jd(data,-1,-1,0.1,NaN,'',opt);
0059
0060 procdata = 1;
0061
0062 datafile = datafile1;
0063
0064 end
0065
0066 if procdata == 0 && exist([datapath,datafile2],'file'),
0067
0068 data = load([datapath,datafile2]);
0069
0070 data_proc = proc_luke_jd(data.output,-1,-1,0.1,NaN,'',opt);
0071
0072 procdata = 1;
0073
0074 datafile = datafile2;
0075
0076 end
0077
0078 if procdata == 0,
0079 disp('Warning : No data found, aborted')
0080 return
0081 end
0082
0083 if opt.save,
0084
0085 save([datapath,'PROC_',datafile],'data_proc');
0086
0087 end
0088