• R/O
  • SSH

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂9a26d5e27da004230d63e908404f3333827546e2 (tree)
時間2010-10-28 21:15:35
作者lorenzo
Commiterlorenzo

Log Message

I updated the code and it now produces what should be the final version of
the two plots.

Change Summary

差異

diff -r 086a0761c1ef -r 9a26d5e27da0 Python-codes/plot_polar_clip.py
--- a/Python-codes/plot_polar_clip.py Wed Oct 27 16:25:41 2010 +0000
+++ b/Python-codes/plot_polar_clip.py Thu Oct 28 12:15:35 2010 +0000
@@ -25,7 +25,17 @@
2525 return abs(cos(y))
2626
2727
28-theta=0.8*pi/2.
28+theta=0.5*pi/2.
29+
30+theta_1=0.
31+
32+theta_2=-theta
33+
34+
35+theta_4=-pi/2
36+
37+theta_5=pi/2
38+
2939
3040 # make these smaller to increase the resolution
3141 dx, dy = 0.0025, 0.0025
@@ -42,6 +52,31 @@
4252 xy_end=(pi/1.5*cos(theta), pi/1.5*sin(theta))
4353
4454
55+xy_surf_1=(pi/2.*cos(theta_1), pi/2.*sin(theta_1))
56+
57+xy_end_1=(pi/1.5*cos(theta_1), pi/1.5*sin(theta_1))
58+
59+
60+xy_surf_2=(pi/2.*cos(theta_2), pi/2.*sin(theta_2))
61+
62+xy_end_2=(pi/1.5*cos(theta_2), pi/1.5*sin(theta_2))
63+
64+
65+xy_end_3=(0.,0.)
66+
67+xy_surf_3=((pi/1.5-pi/2.),0.)
68+
69+
70+xy_surf_4=(pi/2.*cos(theta_4), pi/2.*sin(theta_4))
71+
72+xy_end_4=(pi/1.5*cos(theta_4), pi/1.5*sin(theta_4))
73+
74+xy_surf_5=(pi/2.*cos(theta_5), pi/2.*sin(theta_5))
75+
76+xy_end_5=(pi/1.5*cos(theta_4), pi/1.5*sin(theta_5))
77+
78+
79+
4580 print("x is, " )
4681
4782 print (x)
@@ -59,8 +94,6 @@
5994
6095 ax = fig.add_subplot(111)
6196
62-figtext(.63, .65,r'$-{\bfJ}_1^\perp$', fontdict=None,fontsize=20
63- )
6497
6598
6699
@@ -69,13 +102,14 @@
69102
70103 im.set_clip_path(Circle((0,0),pi/2., transform=ax.transData))
71104
72-annotate("", xy=(0., ini+1.), xytext=(0, -ini), arrowprops=dict(fc="black"))
105+annotate("", xy=(0., ini+1.), xytext=(0, -ini), arrowprops=dict(fc="black",
106+ arrowstyle="-"))
73107
74-for y in np.arange(-1.4, 1.5, 0.2):
75- annotate("", xy=(pi/2., y), xytext=(ini, y), arrowprops=dict(fc="g"))
108+# for y in np.arange(-1.4, 1.5, 0.2):
109+# annotate("", xy=(pi/2., y), xytext=(ini, y), arrowprops=dict(fc="g"))
76110
77-ax.annotate('', xy=(-.3, 2.4), xycoords='data',
78- xytext=(-.4, 2.2), # textcoords='offset points',
111+ax.annotate('', xy=(-.3, 2.6), xycoords='data',
112+ xytext=(-.4, 2.4), # textcoords='offset points',
79113 arrowprops=dict(arrowstyle="->",
80114 connectionstyle="angle3,angleA=0,angleB=-10"),
81115 )
@@ -83,8 +117,50 @@
83117 annotate("", xy=xy_surf,
84118 xytext=xy_end, arrowprops=dict(fc="g"))
85119
120+annotate("", xy=xy_surf_1,
121+ xytext=xy_end_1, arrowprops=dict(fc="g"))
86122
87-figtext(.5, 0.7,r'$\hat{\bf s}$', fontdict=None,fontsize=20
123+annotate("", xy=xy_surf_2,
124+ xytext=xy_end_2, arrowprops=dict(fc="g"))
125+
126+annotate("", xy=xy_surf_3,
127+ xytext=xy_end_3, arrowprops=dict(fc="g"))
128+
129+
130+annotate("", xy=xy_surf_4,
131+ xytext=xy_end_4, arrowprops=dict(fc="g"))
132+
133+annotate("", xy=xy_surf_5,
134+ xytext=xy_end_5, arrowprops=dict(fc="g"))
135+
136+
137+
138+
139+# figtext(.5, 0.7,r'$\hat{\bf J}_1$', fontdict=None,fontsize=20
140+# )
141+
142+
143+
144+figtext(.73, .66,r'${\bf J}_1$', fontdict=None,fontsize=20
145+ )
146+
147+figtext(.73, 0.22,r'${\bf J}_1$', fontdict=None,fontsize=20
148+ )
149+
150+figtext(.79, 0.43,r'${\bf J}_1$', fontdict=None,fontsize=20
151+ )
152+
153+
154+figtext(.53, 0.43,r'$\hat{\bf s}_{\perp}$', fontdict=None,fontsize=20
155+ )
156+
157+
158+
159+figtext(.53, .1,r'${\bf J}_1$', fontdict=None,fontsize=20
160+ )
161+
162+
163+figtext(.53, .7,r'${\bf J}_1$', fontdict=None,fontsize=20
88164 )
89165
90166
@@ -96,14 +172,17 @@
96172
97173 # colorbar(ticks=[] )
98174
99-# ax = plt.axes()
100-cb = plt.colorbar()
101-cb.ax.set_yticks((0.0, 1))
102-cb.ax.set_yticklabels(( r"$\min(-{\bf J}_1^{\perp}\cdot \hat{\bf s})$",
103- r"$\max(-{\bf J}_1^{\perp}\cdot \hat{\bf s})$"))
175+
176+# cb = plt.colorbar()
177+# cb.ax.set_yticks((0.0, 1))
178+# cb.ax.set_yticklabels(( r"$\min(-{\bf J}_1^{\perp}\cdot \hat{\bf s})$",
179+# r"$\max(-{\bf J}_1^{\perp}\cdot \hat{\bf s})$"))
104180
105181
106182 savefig("first-plot.pdf", bbox_inches='tight')
183+
184+
185+
107186
108187 clf()
109188
@@ -111,12 +190,13 @@
111190
112191
113192
114-theta=0.4*pi/2.
115193
116194
117-xy_surf=(pi/2.*cos(theta), pi/2.*sin(theta))
118195
119-xy_end=(pi/1.5*cos(theta), pi/1.5*sin(theta))
196+
197+xy_end_3=(0.,0.)
198+
199+xy_surf_3=(0.,(pi/1.5-pi/2.))
120200
121201
122202 Z = func5(X, Y)
@@ -127,47 +207,98 @@
127207
128208 ax = fig.add_subplot(111)
129209
130-figtext(.65, .67,r'$-{\bf J}_1^{\parallel}$', fontdict=None,fontsize=20)
210+
131211
132212 im = imshow(Z,cmap=cm.jet, extent=(-pi, pi, -pi, pi))
133213 im.set_interpolation('bilinear')
134214
135215 im.set_clip_path(Circle((0,0),pi/2., transform=ax.transData))
136216
137-for x in np.arange(-1.4, 1.5, 0.2):
138- if (abs(x)>1e-4):
139- annotate("", xy=(x,-pi/2.), xytext=(x, -ini), arrowprops=dict(fc="g"))
217+# for x in np.arange(-1.4, 1.5, 0.2):
218+# if (abs(x)>1e-4):
219+# annotate("", xy=(x,-pi/2.), xytext=(x, -ini), arrowprops=dict(fc="g"))
140220
141-for x in np.arange(-1.4, 1.5, 0.2):
142- if (abs(x)>=1e-4):
143- annotate("", xy=(x,pi/2.), xytext=(x, ini), arrowprops=dict(fc="g"))
221+# for x in np.arange(-1.4, 1.5, 0.2):
222+# if (abs(x)>=1e-4):
223+# annotate("", xy=(x,pi/2.), xytext=(x, ini), arrowprops=dict(fc="g"))
144224
145-annotate("", xy=(0., ini+1.), xytext=(0, -ini), arrowprops=dict(fc="black"))
225+annotate("", xy=(0., ini+1.), xytext=(0, -ini), arrowprops=dict(fc="black",
226+ arrowstyle="-"))
146227
147-ax.annotate('', xy=(-.3, 2.4), xycoords='data',
148- xytext=(-.4, 2.2), # textcoords='offset points',
228+ax.annotate('', xy=(-.3, 2.6), xycoords='data',
229+ xytext=(-.4, 2.4), # textcoords='offset points',
149230 arrowprops=dict(arrowstyle="->",
150231 connectionstyle="angle3,angleA=0,angleB=-10"),
151232 )
152233
234+
153235 annotate("", xy=xy_surf,
154236 xytext=xy_end, arrowprops=dict(fc="g"))
155237
238+annotate("", xy=xy_surf_1,
239+ xytext=xy_end_1, arrowprops=dict(fc="g"))
156240
157-figtext(.65, 0.61,r'$\hat{\bf s}$', fontdict=None,fontsize=20
241+annotate("", xy=xy_surf_2,
242+ xytext=xy_end_2, arrowprops=dict(fc="g"))
243+
244+annotate("", xy=xy_surf_3,
245+ xytext=xy_end_3, arrowprops=dict(fc="g"))
246+
247+
248+annotate("", xy=xy_surf_4,
249+ xytext=xy_end_4, arrowprops=dict(fc="g"))
250+
251+
252+annotate("", xy=xy_surf_5,
253+ xytext=xy_end_5, arrowprops=dict(fc="g"))
254+
255+
256+figtext(.73, .66,r'${\bf J}_1$', fontdict=None,fontsize=20
158257 )
159258
259+figtext(.73, 0.22,r'${\bf J}_1$', fontdict=None,fontsize=20
260+ )
261+
262+figtext(.77, 0.43,r'${\bf J}_1$', fontdict=None,fontsize=20
263+ )
264+
265+
266+
267+
268+
269+figtext(.53, .1,r'${\bf J}_1$', fontdict=None,fontsize=20
270+ )
271+
272+
273+figtext(.53, .7,r'${\bf J}_1$', fontdict=None,fontsize=20
274+ )
275+
276+
277+
278+
279+
160280
161281 ax.set_xlim(-ini, ini)
162282 ax.set_ylim(-ini, ini+1)
163283 ax.set_xticks([]) # this is needed for bbox_inches
164284 ax.set_yticks([])
165285
166-cb = plt.colorbar()
167-cb.ax.set_yticks((0.0, 1))
168-cb.ax.set_yticklabels(( "min","max"))
169-cb.ax.set_yticklabels(( r"$\min(-{\bf J}_1^{\parallel}\cdot \hat{\bf s})$",
170- r"$\max(-{\bf J}_1^{\parallel}\cdot \hat{\bf s})$"))
286+# cb = plt.colorbar()
287+# cb.ax.set_yticks((0.0, 1))
288+# cb.ax.set_yticklabels(( "min","max"))
289+# cb.ax.set_yticklabels(( r"$\min(-{\bf J}_1^{\parallel}\cdot \hat{\bf s})$",
290+# r"$\max(-{\bf J}_1^{\parallel}\cdot \hat{\bf s})$"))
291+
292+
293+
294+
295+
296+
297+
298+figtext(.52, 0.43,r'$\hat{\bf s}_{\parallel}$', fontdict=None,fontsize=20
299+ )
300+
301+
171302
172303
173304 savefig("second-plot.pdf", bbox_inches='tight')