%GPO FEATURES:

load GPO
GPO=GPO(1:227);
load trueTypes
trueTypes=trueTypes(1:13);
%firstOcc=[5,122, 203, 159];
%bgrcmk
colorSymbCyc={'bo','go','ro','co','mo','ko','bx','gx','rx','cx','mx','kx','b*','g*'};

%addpath('/scr/em1/kappler/UXO/')
for i=1:numel(GPO)
    Features(1,i)=GPO{i}.INV.avgPolarindex;     %POLARINDEX
    Features(2,i)=norm(GPO{i}.INV.d23);         %D23
    Features(3,i)=norm(GPO{i}.INV.d12);         %D12
    if GPO{i}.INV.avgPolarindex~=1e-6
        Features(4,i)=norm(norm(GPO{i}.INV.Res));  %NOISE
    else
         Features(4,i)=NaN;
    end
    mtch=0;
    Features(5,i)=0;
    for type=1:numel(trueTypes)
        maatch=regexp(GPO{i}.INV.GT,trueTypes{type});
        if maatch
            mtch=1;
            if Features(5,i)~=0
                display 'error, cant decide on type of UXO'
            else
                Features(5,i)=type;
            end
        end
       
    end
     if mtch==0
            display 'couldn0t recognize type'
            break
        end
end
%%Now have created a "features Vector".  '
%there are 14 "true types"
% for each true type, find a gpo el't which is an examle of this typw
figure(4);
clf(4)
for typ=1:length(trueTypes)
    CLASS{typ}=find(squeeze(Features(5,:))==typ);
    plotCmd=['plot(log10(Features(1,CLASS{typ}(1))),Features(2,CLASS{typ}(1)),''',colorSymbCyc{typ},''')'];
     eval(plotCmd)
   hold on
end

%return

    
    for i=1:size(Features,2)
        
    plotCmd=['plot(log10(Features(1,i)),Features(2,i),''',colorSymbCyc{Features(5,i)},''')'];
    eval(plotCmd)
   % hold on
    xlabel('log_{10}(avg Polar Index)')
    ylabel('d23')
  
    end
% for i=1:numel(trueTypes)
%         trueTypes{i}=strrep(trueTypes{i},'"','in')
% end

    lgdCmd=['legend('];
    for i=1:numel(trueTypes)
        lgdCmd=[lgdCmd,'''',trueTypes{i},''','];
    end
    lgdCmd=[lgdCmd(1:end-1),')'];
    eval(lgdCmd)