up [pdf]
from rsf.proj import *

# Download signal
Fetch('piece-regular.HH','wavelet')
Flow('pr','piece-regular.HH','dd form=native')
Plot('pr','graph title=Signal')

# Wavelet transform type
type = ARGUMENTS.get('type','b')

# Wavelet transform
Flow('dwt','pr','dwt type=%s' % type)
Plot('dwt','graph title="Discrete Wavelet Transform (type=%s)" ' % type)

# Thresholding percentile
pclip = int(ARGUMENTS.get('pclip',50))

# Thresholding and inverse transform
Flow('inv','dwt',
     'threshold pclip=%d | dwt type=b adj=y inv=y' % pclip)
Plot('inv','graph title="Approximation (pclip=%d)" ' % pclip)

Result('wavelet','pr dwt inv','OverUnderAniso')

End()

sfdd
sfgraph
sfdwt
sfthreshold

data/wavelet/piece-regular.HH