function visualize_tapes(base_name,ext)
% function visualize_tapes(base_name)
%
% base_name will be completed by good/bad
% see /home/cernocky/SPOTTING/STOOLKIT_HONZA/README_HONZA

% some settings for visu
REPLACE_FLT_MAX = 10; 
YAXIS_MIN = 0; YAXIS_MAX = 5; 

gname = [base_name '_good.' ext];
bname = [base_name '_bad.' ext];
hold off; 
fg = fopen(gname,'r'); fb = fopen(bname,'r'); 
% read the keywrd name
keywrd = fscanf(fg,'%s',[1 1]); keywrd = fscanf(fb,'%s',[1 1]);

% read and plot goods:
cntg = 0; 
while (cntg < 5) 
  [len,cnt] = fscanf(fg,'%d',[1 1]); 
  if cnt ~= 1 
    break
  end
  scores = fscanf (fg,'%f',[1 len]);
  lengths = fscanf (fg,'%d',[1 len]);
  % do something with too high scores (init at the beg):
  scores(find(scores > 1e38)) = REPLACE_FLT_MAX; plot (scores,'b'); hold on;
  [mm,ii] = min(scores); text (ii,mm,num2str(cntg),'Fontweight','bold');
%  [ii lengths(ii) ii*80-lengths(ii)*80 ii*80 ]
  cntg = cntg +1; 
end
title(keywrd)
%return

% read and plot bads:
cntb = 0; 
while (cntb < 5)   % for debug to stop it ... put 10 or 20 or so to see less
  [len,cnt] = fscanf(fb,'%d',[1 1]); 
  if cnt ~= 1 
    break
  end
  scores = fscanf (fb,'%f',[1 len]);
  lengths = fscanf (fb,'%d',[1 len]);
  % do something with too high scores (init at the beg):
  scores(find(scores > 1e38)) = REPLACE_FLT_MAX; plot (scores,'r'); hold on;
  cntb = cntb + 1; 
end
[cntg cntb]
fclose (fg); fclose (fb);

% setting y axis
%ax = axis; axis ([ax(1) ax(2) YAXIS_MIN YAXIS_MAX]);