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


n1=220

aaa='o1=%d o2=%d n1=%d n2=%d'%(-n1,-n1,2*n1+1,2*n1+1)


Flow('real',None,
        'math  output="-atan(x2/x1)" '+aaa)
Flow('circle', None, 'circle f=0.02 df=0.0005 a=0.01 '+aaa)


Flow('odip', 'circle',
        '''
        odip liter=50 rect1=0 rect2=0 interp=maxflat slope=y
        m=1 n=1 verb=y dip0=%g eta=0.5 niter=20
        '''%(math.pi/4))



Flow('ldip', 'circle',
        '''
        dip verb=n liter=50 rect1=0 rect2=0
        | math output="atan(input)" 
        ''')


wavplt='''
        grey color=j screenratio=1 wanttitle=n
        scalebar=y barlabel="Amplitude" minval=-1.1 maxval=1.1
        '''
dipplt='''
        grey color=w screenratio=1 wanttitle=n
        scalebar=y barlabel="Dip Angle" barunit="rad"
        '''

Result('circle',  wavplt)

Result('real', dipplt)

for i1 in ('l','o'):
        Flow(i1+'err', i1+'dip real',
                'math ref=${SOURCES[1]} output="atan(tan(abs(input-ref)))" ')
        Result(i1+'dip', dipplt)
        Result(i1+'err',
                '''
                grey color=j screenratio=1 wanttitle=n
                scalebar=y barlabel="Dip Angle" barunit="rad"
                allpos=y minval=0 maxval=0.03 clip=0.03
                ''')



End()

sfmath
sfcircle
sfodip
sfdip
sfgrey