Go to the list of seismic processes.      Go to SIOSEIS introduction.

# ********   MATLAB  6.0 - September 2000
#! /bin/csh -f
if( $#argv < 4 ) then
    echo "vpick: pick velocities from gathers and create sioseis vtp file."
    echo "Usage: vpick display input-file output-file start_rpnum [ rpnum_inc end_rpnum]"
    exit 1
endif

set DISPLAY = $1
set FILE = $2
set MATFILE = vpick.mat      # must terminate with .mat for Matlab
set VPICKFILE = $3
set START_RPNUM = $4
setenv DISPLAY=$DISPLAY

if( $#argv < 5 ) then
    set RPNUM_INC = 1
else
    set RPNUM_INC = $5
endif

if( $#argv < 6 ) then
    set END_RPNUM = $START_RPNUM
else
    set END_RPNUM = $6
endif

set rpnum = $START_RPNUM
while ( $rpnum <= $END_RPNUM )
sioseis << eof
noecho procs diskin filter agc plot velan prout END
diskin
 secs 6 fno $rpnum lno $rpnum allno no
   forgat 1
 ipath $FILE END END

filter pass 10 80 dbdrop 48 ftype 0 end end
agc
   winlen .5 END END

prout
    fno 0 lno 99999 ftr 0 ltr 99999 END
END

 velan
    vels 1400 10 2000 nrp 1 type spec winlen .048 opath $MATFILE
    END
 END

plot
   nibs 75 stime 0 nsecs 6 scalar -1 trpin 5 vscale 2.5 def 0.1
   srpath sunfil ftag 1 taginc 1000 ann fanno fanno $rpnum END
 END

 END
eof

xloadimage -r 90 sunfil &

#  Use Matlab Version 5.0 (September 2000)
#  Matlab does not honor the shell DISPLAY variable - it must be given
#       on the command line if you'r display is not the console.

matlab  -nosplash -display $DISPLAY<< eof1
fid = fopen( '$VPICKFILE', 'a' );
load $MATFILE;
n = size(vel);nt = n(1);
nv = n(2);
rpno = vel(1,1);
st = vel(2,1);
dt = vel(3,1);
sv = vel(4,1);
dv = vel(5,1);
vel(1,1) = 0;vel(2,1) = 0;vel(3,1) = 0;vel(4,1) = 0;vel(5,1) = 0;
x = sv:dv:sv+nv*dv-dv;
y = -st:-dt:-(st+nt*dt-dt);
contour(x,y,vel,10)
title 'rp $rpnum';
hold on;
xx=[];
yy=[];
n = 0;
but = 1;
while but == 1
   [xi,yi,button] = ginput(1);
   if button == 3;
      n = n + 1;
      xx(n,1) = xi;
      yy(n,1) = yi;
      plot(xx,yy,'k-')
   end
   if button == 2;
      plot(xx,yy,'w-')
      xx(n,1) = xx(n-1,1);
      yy(n,1) = yy(n-1,1);
      n = n - 1;
      plot(xx,yy,'k-')
   end
   if button == 1;
      but = 0;
   end
end
pause
n = size(xx);
fprintf(fid,'  fno %.0f vtp ',$rpnum);
for i = 1:n(1);
   fprintf(fid,'%.0f %.3f ',xx(i),-yy(i));
end;
fprintf(fid,'end\n');
status = fclose(fid);
quit
eof1

@ rpnum = $rpnum + $RPNUM_INC
end

#rm $MATFILE



    OLDER Matlab versions:

#   *******    MATLAB  5.3

#! /bin/csh -f
setenv DISPLAY heezen:0.0    # CHANGE THIS FOR YOUR MACHINE!
if( $#argv < 2 ) then
    echo "Usage: vpick filename start_rpnum [ rpnum_inc end_rpnum]"
    exit 1
endif
 
set FILE = $1
set MATFILE = vpick.mat      # must terminate with .mat for Matlab
set VPICKFILE = $FILE.vpick
set START_RPNUM = $2
 
if( $#argv < 3 ) then
    set RPNUM_INC = 1
else
    set RPNUM_INC = $3
endif
 
if( $#argv < 4 ) then
    set END_RPNUM = $START_RPNUM
else
    set END_RPNUM = $4
endif
 
set rpnum = $START_RPNUM
while ( $rpnum <= $END_RPNUM )
sioseis << eof
noecho procs diskin filter agc plot velan prout END
 
diskin
 secs 4 fno $rpnum lno $rpnum 
   forgat 1
 ipath $FILE END END
 
filter pass 40 160 dbdrop 48 minpha no end end
agc
   winlen 2 END END
 
prout
    fno 0 lno 99999 ftr 0 ltr 99999 END
END
 
 velan
    vels 1400 10 2000 nrp 1 type spec winlen .048 opath $MATFILE
    END
 END

plot
   nibs 75 stime 3.5 nsecs 2 scalar -1 trpin 10 vscale 5. def 0.06
   srpath sunfil ftag 1 taginc 1000 ann fanno fanno $rpnum END
 END
 
 END
eof
 
xloadimage -r 90 sunfil &
 
#  Use Matlab Version 4.2c (Nov 23 1994) or newer or else change
#  getline to ginput, which does not have a line connecting the picks.

matlab << eof1
load $MATFILE;
n = size(vel);nt = n(1);
nv = n(2);
rpno = vel(1,1);
st = vel(2,1);
dt = vel(3,1);
sv = vel(4,1);
dv = vel(5,1);
vel(1,1) = 0;vel(2,1) = 0;vel(3,1) = 0;vel(4,1) = 0;vel(5,1) = 0;
x = sv:dv:sv+nv*dv-dv;
y = -st:-dt:-(st+nt*dt-dt);
contour(x,y,vel,10)
title 'rp $rpnum';
xx=[];
yy=[];
n = 0;
but = 1;
while but == 1
   [xi,yi,button] = ginput(1);
   n = n + 1;
   xx(n,1) = xi;
   yy(n,1) = yi;
   if button > 1
      but = 0;
   end
end
pause
n = size(xx);
fprintf('$VPICKFILE','  fno %.0f vtp ',$rpnum)
for i = 1:n(1)
   fprintf('$VPICKFILE','%.0f %.3f ',xx(i),-yy(i))
end
fprintf('$VPICKFILE','end\n')
quit
eof1
 
@ rpnum = $rpnum + $RPNUM_INC
end
 
#rm $MATFILE





#    ******    PRE MATLAB 5.3
setenv DISPLAY sioseis:0.0    # CHANGE THIS FOR YOUR MACHINE!
if( $#argv < 2 ) then
    echo "Usage: vpick filename start_rpnum [ rpnum_inc end_rpnum]"
    exit 1
endif

set FILE = $1
set MATFILE = vpick.mat      # must terminate with .mat
set VPICKFILE = $FILE.vpick
set START_RPNUM = $2

if( $#argv < 3 ) then
    set RPNUM_INC = 1
else
    set RPNUM_INC = $3
endif

if( $#argv < 4 ) then
    set END_RPNUM = $START_RPNUM
else
    set END_RPNUM = $4
endif

set rpnum = $START_RPNUM
while ( $rpnum <= $END_RPNUM )
sioseis << eof
noecho procs diskin filter agc plot velan prout END

diskin
 secs 4 fno $rpnum lno $rpnum forgat 1   # make shot num = rp num
 ipath $FILE END END

filter
    pass 20 100 END END

agc
   winlen .5 END END

prout
    fno 0 lno 99999 ftr 0 ltr 99999 END
END

 velan
    vels 1400 20 3000 nrp 1 type spec winlen .048 opath $MATFILE
    END
 END

plot
   nibs 75 nsecs 4 scalar -1 trpin 10 vscale 2.5 def 0.06
   srpath sunfil ftag 1 taginc 1000 ann fanno fanno $rpnum END
 END

 END
eof

xloadimage -r 90 sunfil &

#  Use Matlab Version 4.2c (Nov 23 1994) or newer or else change 
#  getline to ginput, which does not have a line connecting the picks.
matlab << eof1
load vpick;
n = size(vel);nt = n(1);nv = n(2);
rpno = vel(1,1);st = vel(2,1);dt = vel(3,1);sv = vel(4,1);dv = vel(5,1);
vel(1,1) = 0;vel(2,1) = 0;vel(3,1) = 0;vel(4,1) = 0;vel(5,1) = 0;
x = sv:dv:sv+nv*dv-dv;
y = -st:-dt:-(st+nt*dt-dt);
contour(x,y,vel,10)
title 'rp $rpnum';
[x,y] = getline;
pause
plot(x,y);
n = size(x);
fprintf('$VPICKFILE','  fno %.0f vtp ',rpno)
for i = 1:n(1)
   fprintf('$VPICKFILE','%.0f %.3f ',x(i),-y(i))
end
fprintf('$VPICKFILE','end\n')
quit
eof1

@ rpnum = $rpnum + $RPNUM_INC
end

rm $MATFILE




The following matlab script prints the picked contour plot:
matlab << eof1
load vpick;
n = size(vel);nt = n(1);nv = n(2);
rpno = vel(1,1);st = vel(2,1);dt = vel(3,1);sv = vel(4,1);dv = vel(5,1);
vel(1,1) = 0;vel(2,1) = 0;vel(3,1) = 0;vel(4,1) = 0;vel(5,1) = 0;
x = sv:dv:sv+nv*dv-dv;
y = -st:-dt:-(st+nt*dt-dt);
contour(x,y,vel,10)
hold on;
title 'rp $rpnum';
[x,y] = getline;
pause
plot(x,y);
print mypost;
n = size(x);
fprintf('$VPICKFILE','  fno %.0f vtp ',$rpnum)
for i = 1:n(1)
   fprintf('$VPICKFILE','%.0f %.3f ',x(i),-y(i))
end
fprintf('$VPICKFILE','end\n')
quit
eof1
lpr -Pprinter mypost.ps   # change printer to your printer name

@ rpnum = $rpnum + $RPNUM_INC
end

rm $MATFILE