load parameters_pairwisem4_8_7_6_5.txt
p=parameters_pairwisem4_8_7_6_5;

v50=loadframe(50);
v70=loadframe(70);
v90=loadframe(90);
v100=loadframe(100);
v120=loadframe(120);

P=pintegrate(p,120); % first cement 70 to 120 or maybe try looking at 50 and 120

d50=cement(P,50,50,1,50,120);    % v50 dechirped and inserted into large canvas
d70=cement(P,70,70,1,50,120);    % v50 dechirped and inserted into large canvas
d90=cement(P,90,90,1,50,120);    % v50 dechirped and inserted into large canvas
d100=cement(P,100,100,1,50,120); %v120 dechirped and inserted into large canvas
d120=cement(P,120,120,1,50,120); %v120 dechirped and inserted into large canvas

figure(1);tvl(d50);title('d50 = v50 after pad and dechirp')
figure(2);tvl(d70);title('d70 = v70 after pad and dechirp')
figure(3);tvl(d90);title('d90 = v90 after pad and dechirp')
figure(4);tvl(d100);title('d100 = v100 after pad and dechirp')
figure(5);tvl(d120);title('d120 = v120 after pad and dechirp')

c50=certainty(d50);
c70=certainty(d70);
c90=certainty(d90);
c100=certainty(d100);
c120=certainty(d120);

figure(6);tvl(c50);title('c50')
figure(7);tvl(c120);title('c120')

w50 =lightdarkgamma(d50,4);
w70 =lightdarkgamma(d70,4);
w90 =lightdarkgamma(d90,1);
w100=lightdarkgamma(d100,1/2);
w120=lightdarkgamma(d120,1/4);

total=(c50.*w50 + c120.*w120)./(c50 + c120);
total=(c50.*w50+c70.*w70+c90.*w90+c100.*w100+c120.*w120)./(c50+c70+c90+c100+c120);

% for 2 images
total=meannans(c50.*w50,c120.*w120)./meannans(c50,c120);

% cement 3 images together
top=meannans(c50.*w50,c90.*w90,c120.*w120);
bot=meannans(c50,c90,c120);
total=top./bot;

% cement 5 images together:
top=meannans(c50.*w50,c70.*w70,c90.*w90,c100.*w100,c120.*w120);
bot=meannans(c50,c70,c90,c100,c120);
total=top./bot;

