##// END OF EJS Templates
use wrap_exception in controller, fix clear on kernel
use wrap_exception in controller, fix clear on kernel

File last commit:

r1338:72652d65
r3560:89abd301
Show More
parallel_pylab.ipy
46 lines | 1.1 KiB | text/plain | TextLexer
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337 """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 *
Brian E Granger
Fixed most of the examples. A few still don't work, but this is a start.
r1338 from IPython.kernel import client
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337
# 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')