You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
(3) |
2
(3) |
3
|
4
(2) |
5
(9) |
6
(4) |
7
(9) |
8
(7) |
9
(2) |
10
(3) |
11
(2) |
12
|
13
(2) |
14
(10) |
15
(24) |
16
(17) |
17
(21) |
18
(3) |
19
(23) |
20
(6) |
21
(4) |
22
(14) |
23
(11) |
24
(15) |
25
(6) |
26
(1) |
27
(4) |
28
(3) |
29
(9) |
30
(6) |
31
(2) |
|
Revision: 6336 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6336&view=rev Author: jdh2358 Date: 2008年10月26日 14:33:36 +0000 (2008年10月26日) Log Message: ----------- added glass dots skel Modified Paths: -------------- trunk/py4science/examples/glass_dots1.py trunk/py4science/examples/glass_dots2.py Added Paths: ----------- trunk/py4science/examples/glass_dots1_skel.py Modified: trunk/py4science/examples/glass_dots1.py =================================================================== --- trunk/py4science/examples/glass_dots1.py 2008年10月25日 07:06:53 UTC (rev 6335) +++ trunk/py4science/examples/glass_dots1.py 2008年10月26日 14:33:36 UTC (rev 6336) @@ -6,10 +6,9 @@ See L. Glass. 'Moire effect from random dots' Nature 223, 578580 (1969). """ import cmath -from numpy import cos, sin, pi, matrix -import numpy as npy +import numpy as np import numpy.linalg as linalg -from pylab import figure, show +import matplotlib.pyplot as plt def myeig(M): @@ -18,10 +17,16 @@ Solve quadratic: - lamba^2 - tau*lambda + Delta = 0 + lamba^2 - tau*lambda +/- Delta = 0 where tau = trace(M) and Delta = Determinant(M) - + + if M = | a b | + | c d | + + the trace is a+d and the determinant is a*d-b*c + + Return value is lambda1, lambda2 """ a,b = M[0,0], M[0,1] @@ -32,31 +37,29 @@ lambda1 = (tau + cmath.sqrt(tau**2 - 4*delta))/2. lambda2 = (tau - cmath.sqrt(tau**2 - 4*delta))/2. return lambda1, lambda2 - + # 2000 random x,y points in the interval[-0.5 ... 0.5] -X1 = matrix(npy.random.rand(2,2000) - )-0.5 +X1 = np.random.rand(2,2000)-0.5 -name = 'saddle' -sx, sy, angle = 1.05, 0.95, 0. +#name = 'saddle' +#sx, sy, angle = 1.05, 0.95, 0. -#name = 'center' -#sx, sy, angle = 1., 1., 2.5 +name = 'center' +sx, sy, angle = 1., 1., 2.5 #name= 'stable focus' # spiral #sx, sy, angle = 0.95, 0.95, 2.5 -theta = angle * pi/180. +theta = angle * cmath.pi/180. +S = np.array([[sx, 0], + [0, sy]]) -S = matrix([[sx, 0], - [0, sy]]) +R = np.array([[np.cos(theta), -np.sin(theta)], + [np.sin(theta), np.cos(theta)],]) -R = matrix([[cos(theta), -sin(theta)], - [sin(theta), cos(theta)],]) +M = np.dot(S, R) # rotate then stretch -M = S*R # rotate then stretch - # compute the eigenvalues using numpy linear algebra vals, vecs = linalg.eig(M) print 'numpy eigenvalues', vals @@ -66,17 +69,17 @@ print 'analytic eigenvalues', avals # transform X1 by the matrix -X2 = M*X1 +X2 = np.dot(M, X1) # plot the original x,y as green dots and the transformed x, y as red # dots -fig = figure() +fig = plt.figure() ax = fig.add_subplot(111) -x1 = X1[0].flat -y1 = X1[1].flat -x2 = X2[0].flat -y2 = X2[1].flat +x1 = X1[0] +y1 = X1[1] +x2 = X2[0] +y2 = X2[1] ax = fig.add_subplot(111) line1, line2 = ax.plot(x1, y1, 'go', x2, y2, 'ro', markersize=2) @@ -85,4 +88,4 @@ fig.savefig('glass_dots1.png', dpi=100) fig.savefig('glass_dots1.eps', dpi=100) -show() +plt.show() Added: trunk/py4science/examples/glass_dots1_skel.py =================================================================== --- trunk/py4science/examples/glass_dots1_skel.py (rev 0) +++ trunk/py4science/examples/glass_dots1_skel.py 2008年10月26日 14:33:36 UTC (rev 6336) @@ -0,0 +1,80 @@ +""" +Moire patterns from random dot fields + +http://en.wikipedia.org/wiki/Moir%C3%A9_pattern + +See L. Glass. 'Moire effect from random dots' Nature 223, 578580 (1969). +""" +import cmath +import numpy as np +import numpy.linalg as linalg +import matplotlib.pyplot as plt + +# search for TODO to find the places you need to fix +TODO = None + +def myeig(M): + """ + compute eigen values and eigenvectors analytically + + Solve quadratic: + + lamba^2 - tau*lambda +/- Delta = 0 + + where tau = trace(M) and Delta = Determinant(M) + + if M = | a b | + | c d | + + the trace is a+d and the determinant is a*d-b*c + + Return value is lambda1, lambda2 + + Return value is lambda1, lambda2 + """ + # TODO : compute the real values here. 0, 1 is just a place holder + return 0, 1 + +# Generate and shape (2000,2) random x,y points in the +# interval [-0.5 ... 0.5] +X1 = TODO + +# these are the scaling factor sx, the scaling factor sy, and the +# rotation angle 0 +name = 'saddle' +sx, sy, angle = 1.05, 0.95, 0. + +# OPTIONAL: try and find other sx, sy, theta for other kinds of nodes: +# stable node, unstable node, center, spiral, saddle + +# convert theta to radians: theta = angle * pi/180 +theta = TODO + +# Create a 2D scaling array +# S = | sx 0 | +# | 0 sy | +S = TODO + +# create a 2D rotation array +# R = | cos(theta) -sin(theta) | +# | sin(theta) cos(theta) | +R = TODO + +# do a matrix multiply M = S x R where x is *matrix* multiplication +M = TODO + +# compute the eigenvalues using numpy linear algebra +vals, vecs = linalg.eig(M) +print 'numpy eigenvalues', vals + +# compare with the analytic values from myeig +avals = myeig(M) +print 'analytic eigenvalues', avals + +# transform X1 by the matrix +# X2 = M x X1 where x is *matrix* multiplication +X2 = np.dot(M, X1) + +# plot the original x,y as green dots and the transformed x, y as red +# dots +TODO Modified: trunk/py4science/examples/glass_dots2.py =================================================================== --- trunk/py4science/examples/glass_dots2.py 2008年10月25日 07:06:53 UTC (rev 6335) +++ trunk/py4science/examples/glass_dots2.py 2008年10月26日 14:33:36 UTC (rev 6336) @@ -1,4 +1,4 @@ -import numpy as npy +import numpy as np import numpy.linalg as linalg from pylab import figure, show @@ -12,15 +12,15 @@ self.axes = axes self.canvas = axes.figure.canvas self.canvas.mpl_connect('button_press_event', self.press) - self.canvas.mpl_connect('button_release_event', self.release) - self.canvas.mpl_connect('motion_notify_event', self.move) + self.canvas.mpl_connect('button_release_event', self.release) + self.canvas.mpl_connect('motion_notify_event', self.move) - X1 = self.X1 = npy.matrix(npy.random.rand(2,2000))-0.5 + X1 = self.X1 = np.random.rand(2,2000)-0.5 - x1 = X1[0].flat - y1 = X1[1].flat - x2 = X1[0].flat # no transformation yet - y2 = X1[1].flat + x1 = X1[0] + y1 = X1[1] + x2 = X1[0] # no transformation yet + y2 = X1[1] self.line1, self.line2 = ax.plot(x1, y1,'go', x2, y2, 'ro', markersize=2) self.xlast = None self.ylast = None @@ -37,37 +37,37 @@ self.xlast = None self.ylast = None self.draw() - + def draw(self): sx, sy, theta = self.sx, self.sy, self.theta - a = sx*npy.cos(theta) - b = -sx*npy.sin(theta) - c = sy*npy.sin(theta) - d = sy*npy.cos(theta) - M = npy.matrix([[a,b],[c,d]]) + a = sx*np.cos(theta) + b = -sx*np.sin(theta) + c = sy*np.sin(theta) + d = sy*np.cos(theta) + M = np.array([[a,b],[c,d]]) - X2 = M*self.X1 - x2 = X2[0].flat - y2 = X2[1].flat + X2 = np.dot(M, self.X1) + x2 = X2[0] + y2 = X2[1] self.line2.set_data(x2,y2) self.canvas.draw() - + def move(self, event): if not event.inaxes: return # not over axes if self.xlast is None: return # no initial data if not event.button: return # no button press - + dx = event.xdata - self.xlast - dy = event.ydata - self.ylast + dy = event.ydata - self.ylast if event.button==1: self.theta += dx elif event.button==3: self.sx += dx self.sy += dy - + self.title.set_text('sx=%1.2f, sy=%1.2f, theta=%1.2f'%(self.sx, self.sy, self.theta)) self.draw() self.xlast = event.xdata @@ -75,9 +75,9 @@ - -from pylab import subplot, show -fig = figure() + +import matplotlib.pyplot as plt +fig = plt.figure() ax = fig.add_subplot(111) t = Transformer(ax) -show() +plt.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.