1 import matplotlib
as mpl
2 import matplotlib
.mlab
as mlab
3 import matplotlib
.pyplot
as plt
4 import matplotlib
.axes
as axe
5 import matplotlib
.collections
as collections
9 from matplotlib
.pyplot
import *
11 ANGLE
= "../rk_defangle.dat"
12 VELO
= "../rk_bif_avg_velo.dat"
13 FOUT
= "../defangle.png"
16 ylabel
= r
'$\delta y$'
18 ######################################################################
20 angle
= mlab
.csv2rec(ANGLE
, delimiter
='\t', comments
='#')
21 velo
= mlab
.csv2rec(VELO
, delimiter
='\t', comments
='#')
29 def mean_angle(param
,angle
):
30 unique_param
= unique(param
)
31 list_angles
= [ [] for DUMMYVAR
in range(len(unique_param
)) ]
33 for i
in range(len(unique_param
)):
34 for j
in range(len(angle
)):
35 if (param
[j
] == unique_param
[i
]):
36 list_angles
[i
].append(angle
[j
])
37 print len(list_angles
[i
])
38 ret_avg
.append(float(sum(list_angles
[i
])) / len(list_angles
[i
]))
45 ax1
= fig
.add_subplot(211)
46 ax2
= fig
.add_subplot(212)
48 avg_angles
= mean_angle(r
,psi
)
51 ax1
.plot(unique_r
, avg_angles
, marker
=',', ms
=0.1, ls
='')
52 ax2
.plot(r
, vx
, marker
=',', ms
=0.1, ls
='')
54 ax1
.set_xlim(r
.min(),r
.max())
55 ax1
.set_ylim(psi
.min(),psi
.max())