##// END OF EJS Templates
Lots of work on exception handling, including tests for traceback printing....
Lots of work on exception handling, including tests for traceback printing. We finally have some tests for various exception mode printing, via doctests that exercise all three modes! Also changed handling of sys.exit(X) to only print the summary message, as SystemExit is most often a 'handled' exception. It can still be 100% silenced via '%run -e', but now it's much less intrusive. Added a new %tb magic to print the last available traceback with the current xmode. One can then re-print the last traceback with more detail if desired, without having to cause it again.

File last commit:

r1338:72652d65
r2440:0caaf43a
Show More
parallel_pylab.ipy
46 lines | 1.1 KiB | text/plain | TextLexer
"""Example of how to use pylab to plot parallel data.
The idea here is to run matplotlib is the same IPython session
as an ipython RemoteController client. That way matplotlib
can be used to plot parallel data that is gathered using
RemoteController.
To run this example, first start the IPython controller and 4
engines::
ipcluster -n 4
Then start ipython in pylab mode::
ipython -pylab
Then a simple "run parallel_pylab.ipy" in IPython will run the
example.
"""
import numpy as N
from pylab import *
from IPython.kernel import client
# Get an IPython1 client
rc = client.MultiEngineClient()
rc.get_ids()
rc.activate()
# Create random arrays on the engines
# This is to simulate arrays that you have calculated in parallel
# on the engines.
# Anymore that length 10000 arrays, matplotlib starts to be slow
%px import numpy as N
%px x = N.random.standard_normal(10000)
%px y = N.random.standard_normal(10000)
%px print x[0:10]
%px print y[0:10]
# Bring back the data
x_local = rc.gather('x')
y_local = rc.gather('y')
# Make a scatter plot of the gathered data
plot(x_local, y_local,'ro')