up [pdf]
from rsf.proj import *

data = 'data-BP2.HH'
Fetch(data,'bp')

Flow('data',data,'dd form=native')

Flow('datt','data','window min2=0 n1=1209 | pow pow1=1 | byte pclip=98')

# Fourier transform data
Flow('fourdat','data',
     '''
     pad beg2=650 n2out=2048 n1out=4096 |
     rtoc | fft3 axis=1 pad=1 | fft3 pad=1 inv=y
     ''')


for fig in (0,1):
    case = ('convolution','correlation')[fig]
    Flow(case,'fourdat',
         '''
         math output="%s" |
         fft3 pad=1 | fft3 inv=y axis=1 pad=1 | real
         ''' % ('input*input','input*conj(input)')[fig])

    brad = 'brad'+str(fig+1)
    Flow(brad,case,
         'window f2=650 max2=0 min1=0 n1=1209 | pow pow1=1 | byte pclip=95')
    Result(brad,[brad,'datt'],
           '''
           merge axis=2 nspace=5 ${SOURCES[1]} |
           grey title=auto-%s label1=time unit1=s
           wantaxis2=n crowd=0.87
           ''' % case)

End()

sfdd
sfwindow
sfpow
sfbyte
sfpad
sfrtoc
sffft3
sfmath
sfreal
sfmerge
sfgrey

data/bp/data-BP2.HH