SF.net SVN: matplotlib: [3627] trunk/py4science/examples/schrodinger/ schrod_fdtd.py

2007-07-29 Thread fer_perez
Revision: 3627
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3627&view=rev
Author:   fer_perez
Date: 2007-07-29 01:03:12 -0700 (Sun, 29 Jul 2007)

Log Message:
---
Small optimization.

Modified Paths:
--
trunk/py4science/examples/schrodinger/schrod_fdtd.py

Modified: trunk/py4science/examples/schrodinger/schrod_fdtd.py
===
--- trunk/py4science/examples/schrodinger/schrod_fdtd.py2007-07-29 
06:50:34 UTC (rev 3626)
+++ trunk/py4science/examples/schrodinger/schrod_fdtd.py2007-07-29 
08:03:12 UTC (rev 3627)
@@ -237,22 +237,26 @@
 IDX2 = range(2,N)  #  psi [ k + 1 ]
 IDX3 = range(0,N-2)#  psi [ k - 1 ]
 
-for t in range(0,T+1):
+for t in range(T+1):
+# Precompute a couple of indexing constants, this speeds up the computation
+psi_rPR = psi_r[PR]
+psi_iPR = psi_i[PR]
+
 #  Apply the update equations.
 psi_i[FU,IDX1] = psi_i[PA,IDX1] + \
-  c1*(psi_r[PR,IDX2] - 2*psi_r[PR,IDX1] +
-  psi_r[PR,IDX3])
-psi_i[FU]= psi_i[FU] - c2V*psi_r[PR]
+  c1*(psi_rPR[IDX2] - 2*psi_rPR[IDX1] +
+  psi_rPR[IDX3])
+psi_i[FU] -= c2V*psi_r[PR]
 
 psi_r[FU,IDX1] = psi_r[PA,IDX1] - \
-  c1*(psi_i[PR,IDX2] - 2*psi_i[PR,IDX1] +
-  psi_i[PR,IDX3])
-psi_r[FU]= psi_r[FU] + c2V*psi_i[PR]
+  c1*(psi_iPR[IDX2] - 2*psi_iPR[IDX1] +
+  psi_iPR[IDX3])
+psi_r[FU] += c2V*psi_i[PR]
 
 #  Increment the time steps.  PR -> PA and FU -> PR
-psi_r[PA] = psi_r[PR]
+psi_r[PA] = psi_rPR
 psi_r[PR] = psi_r[FU]
-psi_i[PA] = psi_i[PR]
+psi_i[PA] = psi_iPR
 psi_i[PR] = psi_i[FU]
 
 #  Only plot after a few iterations to make the simulation run faster.


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [3628] trunk/matplotlib

2007-07-29 Thread efiring
Revision: 3628
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3628&view=rev
Author:   efiring
Date: 2007-07-29 19:04:46 -0700 (Sun, 29 Jul 2007)

Log Message:
---
changed pcolor default to shading='flat'; related cleanups

Modified Paths:
--
trunk/matplotlib/API_CHANGES
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pcolor_demo.py
trunk/matplotlib/examples/pcolor_log.py
trunk/matplotlib/examples/pcolor_small.py
trunk/matplotlib/lib/matplotlib/artist.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/collections.py

Modified: trunk/matplotlib/API_CHANGES
===
--- trunk/matplotlib/API_CHANGES2007-07-29 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/API_CHANGES2007-07-30 02:04:46 UTC (rev 3628)
@@ -1,3 +1,6 @@
+Changed pcolor default to shading='flat'; but as noted now in the
+docstring, it is preferable to simply use the edgecolor kwarg.
+
 The mathtext font commands (\cal, \rm, \it, \tt) now behave as TeX
 does: they are in effect until the next font change command or the
 end of the grouping.  Therefore uses of $\cal{R}$ should be

Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG  2007-07-29 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/CHANGELOG  2007-07-30 02:04:46 UTC (rev 3628)
@@ -1,54 +1,58 @@
+2007-07-29 Changed default pcolor shading to flat; added aliases
+   to make collection kwargs agree with setter names, so
+   updating works; related minor cleanups.
+
 2007-07-26 Major rewrite of mathtext.py, using the TeX box layout model.
 
-  There is one (known) backward incompatible change.  The
-  font commands (\cal, \rm, \it, \tt) now behave as TeX does:
-  they are in effect until the next font change command or
-  the end of the grouping.  Therefore uses of $\cal{R}$
-  should be changed to ${\cal R}$.  Alternatively, you may
-  use the new LaTeX-style font commands (\mathcal, \mathrm,
-  \mathit, \mathtt) which do affect the following group,
-  eg. $\mathcal{R}$.
+   There is one (known) backward incompatible change.  The
+   font commands (\cal, \rm, \it, \tt) now behave as TeX does:
+   they are in effect until the next font change command or
+   the end of the grouping.  Therefore uses of $\cal{R}$
+   should be changed to ${\cal R}$.  Alternatively, you may
+   use the new LaTeX-style font commands (\mathcal, \mathrm,
+   \mathit, \mathtt) which do affect the following group,
+   eg. $\mathcal{R}$.
 
-  Other new features include:
+   Other new features include:
 
-  - Math may be interspersed with non-math text.  Any text
+   - Math may be interspersed with non-math text.  Any text
  with an even number of $'s (non-escaped) will be sent to
-the mathtext parser for layout.
+ the mathtext parser for layout.
 
-  - Sub/superscripts are less likely to accidentally overlap.
+   - Sub/superscripts are less likely to accidentally overlap.
 
-  - Support for sub/superscripts in either order, eg. $x^i_j$
+   - Support for sub/superscripts in either order, eg. $x^i_j$
  and $x_j^i$ are equivalent.
 
-  - Double sub/superscripts (eg. $x_i_j$) are considered
+   - Double sub/superscripts (eg. $x_i_j$) are considered
  ambiguous and raise an exception.  Use braces to disambiguate.
 
-  - $\frac{x}{y}$ can be used for displaying fractions.
+   - $\frac{x}{y}$ can be used for displaying fractions.
 
-  - $\sqrt[3]{x}$ can be used to display the radical symbol
+   - $\sqrt[3]{x}$ can be used to display the radical symbol
  with a root number and body.
 
-  - $\left(\frac{x}{y}\right)$ may be used to create
+   - $\left(\frac{x}{y}\right)$ may be used to create
  parentheses and other delimiters that automatically
  resize to the height of their contents.
 
-  - Spacing around operators etc. is now generally more like
+   - Spacing around operators etc. is now generally more like
  TeX.
 
-  - Added support (and fonts) for boldface (\bf) and
+   - Added support (and fonts) for boldface (\bf) and
  sans-serif (\sf) symbols.
 
-  - Log-like function name shortcuts are supported.  For
+   - Log-like function name shortcuts are supported.  For
  example, $\sin(x)$ may be used instead of ${\rm sin}(x)$
 
-  - Limited use of kerning for the easy case (same font)
+   - Limited use of kerning for the easy case (same font)
 
-  Behind the scenes, the pyparsing.py module 

SF.net SVN: matplotlib: [3629] trunk/py4science/examples/schrodinger/ schrod_fdtd.py

2007-07-29 Thread fer_perez
Revision: 3629
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3629&view=rev
Author:   fer_perez
Date: 2007-07-29 23:04:41 -0700 (Sun, 29 Jul 2007)

Log Message:
---
cleaner fill implementation

Modified Paths:
--
trunk/py4science/examples/schrodinger/schrod_fdtd.py

Modified: trunk/py4science/examples/schrodinger/schrod_fdtd.py
===
--- trunk/py4science/examples/schrodinger/schrod_fdtd.py2007-07-30 
02:04:46 UTC (rev 3628)
+++ trunk/py4science/examples/schrodinger/schrod_fdtd.py2007-07-30 
06:04:41 UTC (rev 3629)
@@ -80,6 +80,16 @@
 v[npts/2:npts/2+thickness] = v0
 return v
 
+def fillax(x,y,*args,**kw):
+"""Fill the space between an array of y values and the x axis.
+
+All args/kwargs are passed to the pylab.fill function.
+Returns the value of the pylab.fill() call.
+"""
+xx = np.concatenate((x,np.array([x[-1],x[0]],x.dtype)))
+yy = np.concatenate((y,np.zeros(2,y.dtype)))
+return pylab.fill(xx, yy, *args,**kw)
+
 #=
 #
 #  Simulation Constants.  Be sure to include decimal points on appropriate
@@ -213,14 +223,12 @@
 # in light red, as well as drawing a green line at the wavepacket's total
 # energy, in the same units the potential is being plotted.
 if Vmax !=0 :
+# Scaling factor for energies, so they fit in the same plot as the
+# wavefunctions
 Efac = ymax/2.0/Vmax
 V_plot = V*Efac
 pylab.plot(X,V_plot,':k',zorder=0)   #  Potential line.
-# reverse x and y2 so the polygon fills in order
-y1 = free(N)  # lower boundary for polygon drawing
-x = np.concatenate( (X,X[::-1]) )
-y = np.concatenate( (y1,V_plot[::-1]) )
-pylab.fill(x, y, facecolor='y', alpha=0.2,zorder=0)
+fillax(X,V_plot, facecolor='y', alpha=0.2,zorder=0)
 # Plot the wavefunction energy, in the same scale as the potential
 pylab.axhline(E*Efac,color='g',label='Energy',zorder=1)
 pylab.legend(loc='lower right')


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins