% gen_csf2d.m - generates 2D csf from 1D sections along 
% constant SF and TF (from csf_tf and csf_sf, respectively)
% 
% assumes csf_tf, csf_sf, TF, and SF have been loaded

constSF = [0.25 1.0 4.0 16]; % cpd
constTF = [0.1 0.48 1.91 7.63 30.52]; % Hz

nTF=length(TF);
csf_tf_skip=csf_tf(2:2:nTF,:);
TFskip=TF(2:2:nTF);
nTF=length(TFskip);

nSF=length(SF);

xy_points = [];
for i=1:length(constSF)    
    xy_points = [xy_points; [TFskip ones(nTF,1)*constSF(i)]];   
end
for i=1:length(constTF)    
    xy_points = [xy_points; [ones(nSF,1)*constTF(i) SF]];   
end

log10_f=-1:0.05:1.4;
log10_rho=[-0.6:0.05:1.4]';
S=griddata(log10(xy_points(:,1)),log10(xy_points(:,2)),...
    log10([csf_tf_skip(:); csf_sf(:)]),log10_f,log10_rho,...
    'linear');
S=S-max(S(:));

imagesc(log10_f,log10_rho,S), axis xy, colorbar
% contour(log10_f,log10_rho,S)

