velocity output in standard mode
[quplot.git] / periodadding.py
blob42ac0b2fc4633ee0ca1d1314eeafb2a4d07ca580
1 #!/usr/bin/python
2 # -*- coding: iso-8859-1 -*-
4 import matplotlib as mpl
5 mpl.rc('text', usetex = True)
6 import pylab
7 import numpy as np
8 import matplotlib.cm as cm
9 import matplotlib.mlab as mlab
10 import matplotlib.pyplot as plt
11 import matplotlib.patches as patch
12 import matplotlib.colors as col
14 FOUT = "../latex/images/periodadding.png"
15 FIN = []
16 FIN.append("../rk_out0.dat")
17 #FIN.append("../rk_out1.dat")
18 #FIN.append("../rk_out175.dat")
19 FIN.append("../rk_out2.dat")
20 #FIN.append("../rk_out225.dat")
21 #FIN.append("../rk_out23.dat")
22 FIN.append("../rk_out25.dat")
23 #FIN.append("../rk_out26.dat")
24 #FIN.append("../rk_out27.dat")
25 #FIN.append("../rk_out35.dat")
26 #FIN.append("../rk_out4.dat")
27 FIN.append("../rk_out5.dat")
28 FIN.append("../rk_out6.dat")
30 L = 2*np.pi
31 tau = 2*np.pi/0.1
32 fromt = 80
33 tot = 90
34 fs_label = 12
35 res = (1024/80,768/80)
37 #######################################################################
39 plots = range(len(FIN))
40 nCols = 3
41 nRows = len(plots)
42 nPlots = nCols*len(plots)
44 print plots
46 data = []
48 for i in plots:
49 data.append(mlab.csv2rec(FIN[i], delimiter='\t', comments='#'))
51 t = []
52 x = []
53 y = []
54 phi = []
56 for i in plots:
57 t.append(data[i].r)
58 x.append(data[i].x)
59 y.append(data[i].y)
60 phi.append(data[i].phi)
62 tstep = t[0][1] - t[0][0]
63 len_t = len(t[0])
64 print tstep
65 print len_t
67 fromt_eff = fromt/tstep
68 tot_eff = tot/tstep
69 tau_eff = tau*tstep
71 trunc_t = []
72 trunc_x = []
73 trunc_y = []
74 trunc_phi = []
76 for i in plots:
77 tmpt = t[i]
78 tmpx = x[i]
79 tmpy = y[i]
80 tmpphi = phi[i]
81 trunc_t.append(tmpt[fromt*tau/tstep:tot*tau/tstep])
82 trunc_x.append(tmpx[fromt*tau/tstep:tot*tau/tstep])
83 trunc_y.append(tmpy[fromt*tau/tstep:tot*tau/tstep])
84 trunc_phi.append(tmpphi[fromt*tau/tstep:tot*tau/tstep])
86 fig = plt.figure(figsize=res)
88 ax = [ [] for DUMMYVAR in range(nPlots) ]
91 for i in range(nPlots):
92 ax[i] = fig.add_subplot(nRows,nCols,i+1)
94 tticks = np.arange(0*tau,100*tau,2*tau)
95 tticks_eff = []
96 xticks_eff = []
97 yticks_eff = []
98 for i in range(len(tticks)):
99 tticks_eff.append(int(tticks[i]))
100 xticks = np.arange(-100*L,100*L,2*L)
101 yticks = np.arange(0,10*L,L)
102 for i in range(len(xticks)):
103 xticks_eff.append(int(xticks[i]))
104 for i in range(len(yticks)):
105 yticks_eff.append(int(yticks[i]))
106 phiticks = np.arange(0,360+1,360/4)
108 eta_label = [
109 r"$\eta_1 = 1.0$",
110 r"$\eta_1 = 1.2$",
111 #r"$\eta_1 = 1.23$",
112 r"$\eta_1 = 1.25$",
113 #r"$\eta_1 = 1.27$",
114 r"$\eta_1 = 1.5$",
115 r"$\eta_1 = 1.6$"
118 i = 0
119 j = 0
120 while j < nPlots:
121 ax[j].plot(t[i],x[i], color='black')
122 ax[j+1].plot(x[i],y[i], color='black')
123 ax[j+2].plot(t[i],phi[i], color='black')
124 i = i+1
125 j = j+nCols
127 j = 0
128 l = 0
129 while j < nPlots:
130 ax[j].set_xticks(tticks_eff)
131 if (j == 0):
132 ax[j].set_yticks(yticks_eff)
133 else:
134 ax[j].set_yticks(xticks_eff)
135 ax[j].set_ylabel(r'$x$')
136 if (j == nPlots-3):
137 ax[j].set_xlabel(r'$t$')
138 ax[j].set_xlim(fromt*tau-1,tot*tau+1)
139 ax[j].set_ylim(min(trunc_x[l])-1,max(trunc_x[l])+1)
140 l = l+1
141 j = j+nCols
143 j = 1
144 l = 0
145 while j <= nPlots:
146 if (j == 1):
147 ax[j].set_xticks(yticks_eff)
148 else:
149 ax[j].set_xticks(xticks_eff)
150 ax[j].set_yticks(yticks_eff)
151 if (j == nPlots-2):
152 ax[j].set_xlabel(r'$x$')
153 ax[j].set_ylabel(r'$y$')
154 ax[j].set_xlim(min(trunc_x[l])-1,max(trunc_x[l])+1)
155 ax[j].set_ylim(min(trunc_y[l])-1,max(trunc_y[l])+1)
156 l = l+1
157 j = j+nCols
159 j = 2
160 l = 0
161 while j <= nPlots:
162 ax[j].set_xticks(tticks_eff)
163 ax[j].set_yticks(phiticks)
164 ax[j].set_xlim(min(trunc_t[l])-1,max(trunc_t[l])+1)
165 ax[j].set_ylim(135,315)
166 if (j == nPlots-1):
167 ax[j].set_xlabel(r'$t$')
168 ax[j].set_ylabel(r'$\varphi$')
169 l = l+1
170 j = j+nCols
172 for i in range(nPlots/nCols):
173 fig.text(0.01,1-0.18-i*0.17,eta_label[i], fontsize=fs_label)
175 #plt.draw()
176 #plt.show()
177 plt.savefig(FOUT)