clear all;
NO=200;
NI=[1 5 10 ];
NT=[ 2 ];
AT=[1];
RP=[1 2];
PT=[3];
LS=[1 2 3 4 5 6];

%sampler_01sep(50,1,2,1,1,1,1)
%keyboard;


T=0
T_re=1;
%                         fname=[ 'NO_',num2str(NO),...
%                             '-NI_',num2str(ni),...
%                             '-NT_',num2str(nt),...
%                             '-AT_',num2str(at),...
%                             '-LS_',num2str(ls),...
%                             '-PT_',num2str(pt),...
%                             '-EC_',num2str(ec)];
%                             disp([num2str(T), ' working on ', fname]);
%                             if(T>=T_re)
%                             %sampler_01sep(NO,ni,nt,at,ls,pt,ec)
%                             disp('breaking')
%                             break
%                             else
%                               c=load([fname,'\',fname,'.chi_sq' ]);   
%                               chi(:,ni,nt,at,ls,pt,ec+1)=c;    

for nt=NT
    for ni=NI
        for ls=LS
            for at=AT
                for pt=PT
                    for rp=RP
                            fname=[ 'NO_',num2str(NO),...
                            '-NI_',num2str(ni),...
                            '-NT_',num2str(nt),...
                            '-AT_',num2str(at),...
                            '-LS_',num2str(ls),...
                            '-PT_',num2str(pt),...
                            '-RP_',num2str(rp)];
                            disp([num2str(T), ' working on ', fname]);
                            if(T>=T_re)
                             c=load([fname,'\',fname,'.chi_sq' ]);
                             chi(:,ni,nt,at,ls,pt,rp)=c;  
                            end
                            T=T+1;
                     end
                end
            end
        end
    end
end

%% plotting  chi_xy

NI=[1 5 10 ];
IR=1:3
cm=hsv(length(IR));
LS_type{1}='SB \Gamma=0.2';
LS_type{2}='OB \Gamma=1';
LS_type{3}='OB \Gamma=0.2';
LS_type{4}='AB \Gamma=1';
LS_type{5}='AB2 \Gamma=1';
LS_type{6}='MB \Gamma=3';

figure(1)
clf;
%chi(:,ni,nt,at,ls,pt,rp)=c;  
at=1;
IR=1:3
for i=1

  str{1} =      'Typical (true) Reverse';
  str{2}=     'Concurrent Reverse';
  
 % chi(:,ni,nt,at,ls,pt,ec+1)=c;    
  for ls=1:6
   hold on
   subplot(2,3,ls)
   plot(NI, chi(3,NI,2 ,at, ls ,3,  1),'-x','Color',cm(1,:),'LineWidth',2,  ...
       'MarkerSize',10) ;
   hold on
   plot(NI, chi(3,NI,2 ,at, ls ,3,  2),'-o','Color',cm(1,:),'LineWidth',2, ...
       'MarkerSize',10) ;
  end     
end

for ls=1:6
subplot(2,3,ls)
 title([num2str(ls), ' ', LS_type{ls}]);
legend(str)
legend off
Ym=max(max(chi(3,NI,2,:,ls,pt,1)));
Ym=max(Ym);
axis([0 10 0 Ym])
xlabel('N_I');
ylabel('\chi^2_x_y');
end
subplot(2,3,1)
legend(str)

grid off