From: <jd...@us...> - 2007-10-25 18:16:06
|
Revision: 4003 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4003&view=rev Author: jdh2358 Date: 2007-10-25 11:16:03 -0700 (Thu, 25 Oct 2007) Log Message: ----------- added convolution example Modified Paths: -------------- trunk/py4science/examples/fft_imdenoise.py trunk/py4science/examples/skel/glass_dots1_skel.py trunk/py4science/examples/stock_records.py trunk/py4science/workbook/files_etc.tex trunk/py4science/workbook/main.tex Modified: trunk/py4science/examples/fft_imdenoise.py =================================================================== --- trunk/py4science/examples/fft_imdenoise.py 2007-10-25 16:24:28 UTC (rev 4002) +++ trunk/py4science/examples/fft_imdenoise.py 2007-10-25 18:16:03 UTC (rev 4003) @@ -14,16 +14,18 @@ def plot_spectrum(F, amplify=1000): """Normalise, amplify and plot an amplitude spectrum.""" - M = mag_phase(F)[0] + M, Phase = mag_phase(F) M *= amplify/M.max() M[M > 1] = 1 - + + print M.shape, M.dtype P.imshow(M, P.cm.Blues) try: # Read in original image, convert to floating point for further - # manipulation - im = S.misc.pilutil.imread('data/moonlanding.jpg').astype(float) + # manipulation; imread returns a MxNx4 RGBA image. Since the + # image is grayscale, just extrac the 1st channel + im = P.imread('data/moonlanding.png').astype(float)[:,:,0] except: print "Could not open image." sys.exit(-1) Modified: trunk/py4science/examples/skel/glass_dots1_skel.py =================================================================== --- trunk/py4science/examples/skel/glass_dots1_skel.py 2007-10-25 16:24:28 UTC (rev 4002) +++ trunk/py4science/examples/skel/glass_dots1_skel.py 2007-10-25 18:16:03 UTC (rev 4003) @@ -11,24 +11,19 @@ from pylab import figure, show def csqrt(x): - """ - sqrt func that handles returns sqrt(x)j for x<0 - """ + 'sqrt func that handles returns sqrt(x)j for x<0' XXX 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) - + + Return value is lambda1, lambda2 """ XXX - return lambda1, lambda2 # 2000 random x,y points in the interval[-0.5 ... 0.5] X1 = XXX @@ -39,10 +34,7 @@ #name = 'center' #sx, sy, angle = XXX -#name = 'stable focus' # spiral -#sx, sy, angle = XXX - -name= 'spiral' +name = 'spiral' #stable focus sx, sy, angle = XXX theta = angle * pi/180. # the rotation in radians @@ -62,16 +54,14 @@ M = XXX # compute the eigenvalues using numpy linear algebra -vals, vecs = XXX -print 'numpy eigenvalues', vals +print 'numpy eigenvalues', XXX # compare with the analytic values from myeig -avals = myeig(M) -print 'analytic eigenvalues', avals +print 'analytic eigenvalues', myeig(M) # transform X1 by the matrix M X2 = XXX -# plot the original x,y as green dots and the transformed x, y as red +# plot the original X1 as green dots and the transformed X2 as red # dots -show() +XXX Modified: trunk/py4science/examples/stock_records.py =================================================================== --- trunk/py4science/examples/stock_records.py 2007-10-25 16:24:28 UTC (rev 4002) +++ trunk/py4science/examples/stock_records.py 2007-10-25 18:16:03 UTC (rev 4003) @@ -67,6 +67,6 @@ print '%s: %1.1f%%'%(ticker, 100*g) -p.savefig('fig/stock_records.png', dpi=100) -p.savefig('fig/stock_records.eps') +p.savefig('stock_records.png', dpi=100) +p.savefig('stock_records.eps') p.show() Modified: trunk/py4science/workbook/files_etc.tex =================================================================== --- trunk/py4science/workbook/files_etc.tex 2007-10-25 16:24:28 UTC (rev 4002) +++ trunk/py4science/workbook/files_etc.tex 2007-10-25 18:16:03 UTC (rev 4003) @@ -204,7 +204,7 @@ \par\end{center} -\subsection{Loading and saving binary data} +\section{Loading and saving binary data} \label{sec:binary_data} ASCII is bloated and slow for working with large arrays, and so binary Modified: trunk/py4science/workbook/main.tex =================================================================== --- trunk/py4science/workbook/main.tex 2007-10-25 16:24:28 UTC (rev 4002) +++ trunk/py4science/workbook/main.tex 2007-10-25 18:16:03 UTC (rev 4003) @@ -57,4 +57,11 @@ \input{trapezoid.tex} \input{quad_newton.tex} + +\chapter{Linear algebra} +\input{intro_linalg.tex} +\input{glass_dots.tex} + + + \end{document} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |