function [mig]=migvsp(timer,isx,nx,nz,dt,gather)
[nx,t1]=size(gather);tmin=min(min(min(timer)));
if tmin==0;timer=timer+1;end;mig=zeros(nx,nz);
for igx=1:nx; %Loop over each trace of the shot gather at src isx.
   igx;
   ix=[1:nx];                % Loop over points at depth
   iz=[1:nx];
     t= timer(ix,iz,isx) + timer(ix,iz,igx);
     trace1=gather(igx,t);
     trace1=reshape(trace1,nx,nx);
     mig(ix,iz)=mig(ix,iz)+trace1;
end
