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 FIN
= 'quplot/rk_variance.dat'
12 FOUT
= 'diffusion.png'
21 res
= (1440/80,900/80) # default dpi is 80
23 def get_trajectory(r
,x
):
24 print "---------------------------------------------------------"
26 ret_x
= [ [] for DUMMYVAR
in range(len(uniquer
)) ]
27 ret_y
= [ [] for DUMMYVAR
in range(len(uniquer
)) ]
28 for j
in range(len(uniquer
)):
30 for i
in range(len(x
)):
31 if (r
[i
] == uniquer
[j
]):
34 #ret_y[j].append(y[i])
35 print uniquer
[j
],":",len(ret_x
[j
]),k
36 print "---------------------------------------------------------"
37 #return (ret_x, ret_y)
40 data
= mlab
.csv2rec(FIN
, delimiter
='\t')
46 tra_x
= get_trajectory(r
,x
)
47 tra_y
= get_trajectory(r
,y
)
49 t
= range(len(tra_x
[0]))
54 fig
= plt
.figure(figsize
=res
)
55 ax1
= fig
.add_subplot(121)
56 ax2
= fig
.add_subplot(122)
59 #D =[ [] for DUMMYVAR in range(len(unique(r))) ]
63 #dmin = min(unique(D))
64 #dmax = max(unique(D))
68 for i
in range(len(unique(r
))):
69 for j
in range(len(tra_x
[i
])):
71 tmp
= (tra_x
[i
][j
] - tra_x
[i
][j
-1])/2
74 for i
in range(len(unique(r
))):
75 for j
in range(len(tra_y
[i
])):
77 tmp
= (tra_y
[i
][j
] - tra_y
[i
][j
-1])/2
83 for i
in range(len(unique(r
))):
86 ax2
.plot(unique(r
),D_x
)
87 ax2
.plot(unique(r
),D_y
)
89 ax1
.set_xlim(0,len(tra_x
[0]))
90 #ax1.set_ylim(x.min(),x.max())
91 ax1
.set_xlabel(xlabel1
)
92 ax1
.set_ylabel(ylabel1
)
93 ax2
.set_xlim(r
.min(),r
.max())
94 #ax2.set_ylim(D.min(),D.max())
95 ax2
.set_xlabel(xlabel2
)
96 ax2
.set_ylabel(ylabel2
)