clear;
 % ------------------------------------------------------------------------- %
 %                                                                           %
 %                                                                           %
 %                 Script for constant velocity scans                        %
 %                                                                           %
 %                  M.D.Sacchi - for Geoph 326 - UofA                        %
 %                                                                           %
 % ------------------------------------------------------------------------- %


 % ------------------
 % 1 - INPUT DATA
 % ------------------

 % Read synthetic gather (gather is in ./codes/SeismicLab_data)

  [D,H] = readsegy('syn_cmp_mult.su');
  h = [H.offset];
  dt = H(1).dt/1000/1000;
  [nt,nh] = size(D);

 % ------------------------------------------------------------------------
 % 2 - Compute a velocity axis and apply constant v NMO for each velocity
 % ------------------------------------------------------------------------

  vmin = 1200;
  vmax = 3200;
  nv = 21;

  vnmo = linspace(vmin,vmax,nv);
  tnmo = [0];     % any number since this is constant velocity NMO
                  % same velocity is used for all the time axis 

  Max_Stretch = 40;

 % Save velocity scans in Scans

  Scans = [];

   for k = 1:nv
    temp = nmo(D,dt,h,tnmo,vnmo(k),Max_Stretch);
    Scans = [Scans, temp];
   end;


 % ----------------------------------------------------------
 % 3 - Display Scans
 % ----------------------------------------------------------


  taxis = [0:1:nt-1]*dt;
  figure(1); clf;
  plot_scans(vnmo,taxis,Scans);
  ylabel('t [s]');
  title('Constant Velocity Scans');