up [pdf]
from rsf.proj import *
import math

pi=math.pi
dat='''
        math type=complex
        n1=201 o1=-0.5 d1=0.005
        n2=201 o2=-0.5 d2=0.005 
        '''


def FPlot(target=None):
        for id in (20,50,80):
                name='%s%d'%(target,id)
                Result(name, target,
                        '''
                        window min3=%f max3=%f 
                        | math output="abs(input)" 
                        | put label1='w1' label2='w2'  
                        | real  
                        | window min1=-0.5 max1=0.5 min2=-0.5 max2=0.5 
                        | grey wanttitle=n gridfat=1 screenratio=1 color=i
                          n1tic=3 d1num=0.4 o1num=-0.4
                          n2tic=3 d2num=0.4 o2num=-0.4
                          grid1=y g1num=0.2 g1num0=-0.4
                          grid2=y g2num=0.2 g2num0=0.4 
                        '''%(id,id))

#idl

for theta in (20,50,80):
        p=math.tan(theta/180*pi)
        p1=math.sin(theta/180*pi)
        p2=math.cos(theta/180*pi)
        Flow('lidl%d'%theta, None,
                dat+'''
                output="1-exp(I*8*atan(1)*%f*x1)*exp(I*8*atan(1)*x2)"
                | math output="abs(input)" 
                | put label1='w1' label2='w2'  
                | real
                | window min1=-0.5 max1=0.5 min2=-0.5 max2=0.5
                '''%p)
        Flow('oidl%d'%theta, None,
                dat+'''
                output="1-exp(I*8*atan(1)*%f*x1)*exp(I*8*atan(1)*%f*x2)"
                | math output="abs(input)" 
                | put label1='w1' label2='w2'  
                | real
                | window min1=-0.5 max1=0.5 min2=-0.5 max2=0.5
                '''%(p1,p2))
        for mtd in ('l','o'):
                Result(mtd+'idl%d'%(theta),
                        '''
                        grey wanttitle=n screenratio=1 gridfat=1 color=i
                        n1tic=3 d1num=0.4 o1num=-0.4
                        n2tic=3 d2num=0.4 o2num=-0.4
                        grid1=y g1num=0.2 g1num0=-0.4
                        grid2=y g2num=0.2 g2num0=0.4 
                        ''')


Flow('liir', None,'''
        pwdfreq o3=20 d3=30 n3=3 order=2 iir=y opwd=n n1=400
        ''')
Flow('lfir', None,'''
        pwdfreq o3=20 d3=30 n3=3 order=2 iir=n opwd=n n1=400
        ''')
Flow('oiir', None,'''
        pwdfreq o3=20 d3=30 n3=3 order=2 iir=y opwd=y n1=400 radius=1
        ''')
Flow('ofir', None,'''
        pwdfreq o3=20 d3=30 n3=3 order=2 iir=n opwd=y n1=400 radius=1
        ''')

FPlot('liir')
FPlot('lfir')
FPlot('oiir')
FPlot('ofir')

End()

sfmath
sfput
sfreal
sfwindow
sfgrey
sfpwdfreq