1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| #定义临时处理Flow
def Temp(o,i,r):
Flow(o,i,r+ ' datapath=%s '%os.environ.get('TMPDATAPATH',os.environ.get('DATAPATH')))
#椭圆模块
def ellipse(cc,xcenter,zcenter,semiA,semiB,sampling,par):
Temp(cc+'_x',None,
'math n1=%d d1=%g o1=%g output="%g+%g*cos(%g*x1/180)"'
% (sampling,360./sampling,0.,xcenter,semiA,pi) )
Temp(cc+'_z',None,
'math n1=%d d1=%g o1=%g output="%g+%g*sin(%g*x1/180)"'
% (sampling,360./sampling,0.,zcenter,semiB,pi) )
Flow(cc,[cc+'_x',cc+'_z'],
'''
cat axis=2 space=n
${SOURCES[0]} ${SOURCES[1]} | transp |
put label1="" unit1="" label2="" unit2=""
''', stdin=0)
xcenter=(par['ox']+(par['nx']-1)*par['dx'])/2.0 # 坐标系中心x
zcenter=par['oz'] #坐标系中心z
ab=par['dx']*(361-150)# 计算焦距
semiA=(par['kt']-50)*par['dt']*1500 # 计算a
semiB=np.sqrt(semiA**2.0-(ab/2.0)**2.0) # 计算b
ellipse('ec',xcenter,zcenter,semiA,semiB,500,par) # 生成椭圆坐标
Plot( 'ec',fdmod.ssplot('plotfat=10 plotcol=2 symbol=.',par)) # 绘制椭圆
|