up [pdf]
from rsf.proj import *

Fetch('seismic.segy','viking')

# Convert to RSF
Flow('seismic tseismic','seismic.segy',
     'segyread tfile=${TARGETS[1]}')

# Select a shot gather
Flow('mask200','tseismic','window n1=1 f1=4 | mask min=200 max=200')
Flow('shot200','seismic mask200','headerwindow mask=${SOURCES[1]}')
Plot('shot200','wiggle transp=y yreverse=y pclip=99 title="Shot at ep=200" ')
Plot('shot200g','shot200','grey title="Shot at ep=200" ')

# gain by t^2
Plot('tpow','shot200',
     '''
     tpow tpow=2 | 
     wiggle transp=y yreverse=y pclip=99 title="Shot at ep=200, tpow=2" 
     ''')
Result('tpow','shot200 tpow','SideBySideAniso')

# Claerbout's gain
Plot('gain','shot200','tpow tpow=2 | grey gpow=0.5 pclip=95 title=Gained')
Result('gain','shot200g gain','SideBySideAniso')

End()

sfsegyread
sfwindow
sfmask
sfheaderwindow
sfwiggle
sfgrey
sftpow