0001 function ray_proc = proc_ray_jd(ray)
0002
0003
0004
0005 if isfield(ray,'stau') && ~isfield(ray,'stau_lin'),
0006 ray.stau_lin = ray.stau;
0007 ray = rmfield(ray,'stau');
0008 end
0009
0010 if isfield(ray,'sP_2piRp') && ~isfield(ray,'sP_2piRp_lin'),
0011 ray.sP_2piRp_lin = ray.sP_2piRp;
0012 ray = rmfield(ray,'sP_2piRp');
0013 end
0014
0015 if isfield(ray,'sdP_2piRp_ds') && ~isfield(ray,'sdP_2piRp_ds_lin'),
0016 ray.sdP_2piRp_ds_lin = ray.sdP_2piRp_ds;
0017 ray = rmfield(ray,'sdP_2piRp_ds');
0018 end
0019
0020
0021
0022 ray_proc.c3po = proc_peak_jd(ray,ray.sP_2piRp_lin);
0023
0024
0025
0026 if isfield(ray,'sP_2piRp'),
0027
0028 for itn = 1:length(ray.sP_2piRp),
0029 ray_proc.luke{itn} = proc_peak_jd(ray,ray.sP_2piRp{itn});
0030 end
0031
0032 end
0033
0034 end
0035
0036
0037
0038 function [ray_proc] = proc_peak_jd(ray,sP_2piRp)
0039
0040 sP_2piRp_h = [sP_2piRp(1),(sP_2piRp(1:end-1) + sP_2piRp(2:end))/2,sP_2piRp(end)];
0041 sdP_2piRp = -diff(sP_2piRp_h);
0042
0043 ns = length(sdP_2piRp);
0044
0045 fnames = fieldnames(ray);
0046
0047 for ifield = 1:length(fnames),
0048
0049 fname = fnames{ifield};
0050
0051 if isnumeric(ray.(fname)) && length(size(ray.(fname))) <= 2 && size(ray.(fname),2) == ns,
0052
0053 ray_proc.(fname) = sum(ray.(fname).*repmat(sdP_2piRp,[size(ray.(fname),1),1]),2)/sum(sdP_2piRp);
0054
0055 elseif iscell(ray.(fname)),
0056
0057 for ic = 1:length(ray.(fname)),
0058
0059 if isnumeric(ray.(fname){ic}) && length(size(ray.(fname){ic})) <= 2 && size(ray.(fname){ic},2) == ns,
0060 ray_proc.(fname){ic} = sum(ray.(fname){ic}.*repmat(sdP_2piRp,[size(ray.(fname){ic},1),1]),2)/sum(sdP_2piRp);
0061 end
0062
0063 end
0064
0065 else
0066
0067 ray_proc.(fname) = ray.(fname);
0068
0069 end
0070
0071 end
0072
0073 end
0074