from experiment import *

Process('freq', None,
	'''
	sgcreate nx=603 vectors=lpwd
	  lpwd.type=cfloat lpwd.ns=201 lpwd.ds=0.005 lpwd.s0=-0.5 
	| sgfieldmath ig:i="ix/201" index="ix%201" theta:i="20+30*ig" 
	  w2:f="-0.5+0.005*index" slope:f="2*PI*tan(PI*theta/180)" 
	  p1:f="2*PI*sin(PI*theta/180)" p2:f="2*PI*cos(PI*theta/180)" 
	  lpwd="1-exp(-I*2*PI*w2)*exp(-I*slope*lpwd.time)"
	  opwd:X="1-exp(-I*lpwd.time*p1)*exp(-I*p2*w2)" 
	| sgsort key=group,theta,w2 
	''')

Figure('./freq.png',
	'sgplotps left.label=w1')

