```from rsf.proj import * import math Flow('time',None, 'math n1=200 d1=1 o1=1 output="(x1-1)*0.4" ') Flow('head','time',"window n1=41 | math output='exp(0.25*input)+11'") Flow('ideal','time',"math output='sin(input)*0.5'") Flow('alias','head',"math output='sin(input)*0.5' | put head=\$SOURCE") doty = ''' dots dots=0 connect=0 gaineach=0 constsep=1 strings=0 clip=1.2 label1=Sample ''' Flow('data','alias','bin1 nx=200 dx=0.4 x0=0') Plot('data',doty + ' strings=1 d1=1 o1=1') Plot('ideal',doty + ' connect=1') Plot('both','data ideal','Overlay') Result('data','both data','SideBySideAniso') doty2 = doty + ' label1=" " ' Result('data2','data',doty2 + ' strings=1 d1=1 o1=1') Plot('data2','data',doty2 + ' strings=1 d1=1 o1=1') Plot('ideal2','ideal',doty2 + ' connect=1') Result('both2','data2 ideal2','Overlay') doty = doty + ' yreverse=y connect=1 d1=1 o1=1' name = 'ifsz' title = ['Regularization','Preconditioning','Shaping 1','Shaping 2'] for prec in range(4): iters = [] res = name[prec] + 'm' labels = '' for niter in [1,3,5,7,300]: iter = res + str(niter) iters.append(iter) if prec > 1: Flow(iter,'alias', ''' shapebin1 nx=200 dx=0.4 x0=0 filter=5 pef=%d gauss=1 niter=%d pad=400 ''' % (prec-2,niter)) else: Flow(iter,'alias', 'invbin1 nx=200 dx=0.4 x0=0 filter=1 prec=%d niter=%d' % (prec,niter)) labels = labels + 'iter=%d:' % niter Plot(res,iters, ''' cat axis=2 \${SOURCES[1:%d]} | %s connect=1 overlap=2 title="%s" labels=%s labelsz=10 label1='Sample' ''' % (len(iters),doty,title[prec],labels)) Result('if',['im','fm'],'SideBySideAniso') Result('sz',['sm','zm'],'SideBySideAniso') Flow('sm','sm300','put d1=1') Flow('spec','sm','spectra') Flow('spec1','spec','math output="exp(-%g*x1*x1)" ' % (8*math.pi*math.pi)) Flow('spec2','spec','monof ma=/dev/null | scale axis=1') for case in (1,2): spec = 'spec%d' % case Plot(spec,['spec',spec], ''' cat axis=2 \${SOURCES[1]} | graph title="Spectrum Shaping %d" label1="Frequency (cycle)" max1=0.3 dash=0,1 label2="Relative Magnitude" ''' % case) Result('spec','spec2','Overlay') Result('spec1','sm spec1','SideBySideAniso') Result('spec2','zm spec2','SideBySideAniso') Flow('ss','alias', 'shapebin1 nx=200 dx=0.4 x0=0 filter=5 pef=1 gauss=1 niter=20 pad=400') Plot('ss',doty) Result('ss',['data','ss'],'Overlay') ########################################################################### End()```