Testing matplotlib on IPython trunk

Hello,

The thread switches will be gone by the release of the new IPython. I am assuming that some extra work needs to be done on both sides in preparation to the new release. See the following test cases:

This one locks the IPython unless the figure window is killed. If you do an additional plt.show() without a figure is up then you get a complete lock-up of the shell.

I[1]: import matplotlib.pyplot as plt

I[2]: %gui qt

I[3]: plt.plot(range(10))
O[3]: [<matplotlib.lines.Line2D object at 0xab2686c>]

I[4]: plt.show()

The following cannot resolve that issue

I[5]: %gui #disable event loops

I[6]: %gui -a qt
O[6]: <PyQt4.QtGui.QApplication object at 0xaa477ac>

I[7]: plt.plot(range(10))
O[7]: [<matplotlib.lines.Line2D object at 0xaf237ac>]

I[8]: plt.show()

In a new IPython, these lines work --no locking after plt.show() “-a” makes the difference.

I[1]: import matplotlib.pyplot as plt

I[2]: %gui -a qt
O[2]: <PyQt4.QtGui.QApplication object at 0x8fdceac>

I[3]: plt.plot(range(10))
O[3]: [<matplotlib.lines.Line2D object at 0x9a2c84c>]

I[4]: plt.show()

···

================================================================================
Platform : Linux-2.6.29.6-217.2.3.fc11.i686.PAE-i686-with-fedora-11-Leonidas
Python : (‘CPython’, ‘tags/r26’, ‘66714’)
IPython : 0.11.bzr.r1205
NumPy : 1.4.0.dev
Matplotlib : 1.0.svn


Gökhan

Hey Gokhan,

thanks for the summary.

### In a new IPython, these lines work --no locking after plt.show() "-a"
makes the difference.

I[1]: import matplotlib.pyplot as plt

I[2]: %gui -a qt
O[2]: <PyQt4.QtGui.QApplication object at 0x8fdceac>

I[3]: plt.plot(range(10))
O[3]: [<matplotlib.lines.Line2D object at 0x9a2c84c>]

I[4]: plt.show()

If you do

plt.ion()

right after you import it, then you don't need to do 'show'
explicitely anymore. Basically what today's '-pylab' does is:

- a bunch of imports
- the equivalent of %gui, but uglier and at startup
- do plt.ion() for you
- patch %run a little so it does ioff() before starting up and ion() at the end.

As you can see, even now with trunk in the state of upheaval it is,
you can get almost all of this back with this snippet. This is pretty
much what we'll make available built-in when the dust settles (with
the 'import *' being optional, as they are today):

%gui -a qt

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
import matplotlib.mlab as mlab

from numpy import *
from matplotlib.pyplot import *

plt.ion()

### END CODE

Cheers,

f

···

On Tue, Sep 8, 2009 at 12:45 PM, Gökhan Sever <gokhansever@...149...> wrote:

You also may need to do:

plt.interactive(True)

Cheers,

Brian

···

On Tue, Sep 8, 2009 at 12:45 PM, Gökhan Sever <gokhansever@…149…> wrote:

Hello,

The thread switches will be gone by the release of the new IPython. I am assuming that some extra work needs to be done on both sides in preparation to the new release. See the following test cases:

This one locks the IPython unless the figure window is killed. If you do an additional plt.show() without a figure is up then you get a complete lock-up of the shell.

I[1]: import matplotlib.pyplot as plt

I[2]: %gui qt

I[3]: plt.plot(range(10))
O[3]: [<matplotlib.lines.Line2D object at 0xab2686c>]

I[4]: plt.show()

The following cannot resolve that issue

I[5]: %gui #disable event loops

I[6]: %gui -a qt
O[6]: <PyQt4.QtGui.QApplication object at 0xaa477ac>

I[7]: plt.plot(range(10))
O[7]: [<matplotlib.lines.Line2D object at 0xaf237ac>]

I[8]: plt.show()

In a new IPython, these lines work --no locking after plt.show() “-a” makes the difference.

I[1]: import matplotlib.pyplot as plt

I[2]: %gui -a qt
O[2]: <PyQt4.QtGui.QApplication object at 0x8fdceac>

I[3]: plt.plot(range(10))
O[3]: [<matplotlib.lines.Line2D object at 0x9a2c84c>]

I[4]: plt.show()

================================================================================
Platform : Linux-2.6.29.6-217.2.3.fc11.i686.PAE-i686-with-fedora-11-Leonidas
Python : (‘CPython’, ‘tags/r26’, ‘66714’)

IPython : 0.11.bzr.r1205
NumPy : 1.4.0.dev
Matplotlib : 1.0.svn


Gökhan


IPython-dev mailing list

IPython-dev@…336…

http://mail.scipy.org/mailman/listinfo/ipython-dev

Hey Gokhan,

thanks for the summary.

In a new IPython, these lines work --no locking after plt.show() “-a”

makes the difference.

I[1]: import matplotlib.pyplot as plt

I[2]: %gui -a qt

O[2]: <PyQt4.QtGui.QApplication object at 0x8fdceac>

I[3]: plt.plot(range(10))

O[3]: [<matplotlib.lines.Line2D object at 0x9a2c84c>]

I[4]: plt.show()

If you do

plt.ion()

right after you import it, then you don’t need to do ‘show’

explicitely anymore. Basically what today’s ‘-pylab’ does is:

  • a bunch of imports

  • the equivalent of %gui, but uglier and at startup

  • do plt.ion() for you

  • patch %run a little so it does ioff() before starting up and ion() at the end.

As you can see, even now with trunk in the state of upheaval it is,

you can get almost all of this back with this snippet. This is pretty

much what we’ll make available built-in when the dust settles (with

the ‘import *’ being optional, as they are today):

It’s a very late reply but I am wondering how to make these appear in the Ipy dev loaded into the session but not visible to a whos listing?

Thanks.

···

On Tue, Sep 8, 2009 at 3:45 PM, Fernando Perez <fperez.net@gmail.com> wrote:

On Tue, Sep 8, 2009 at 12:45 PM, Gökhan Sever <gokhansever@…149…> wrote:

%gui -a qt

import numpy as np
import matplotlib.pyplot as plt

import matplotlib.pylab as pylab

import matplotlib.mlab as mlab

from numpy import *

from matplotlib.pyplot import *

plt.ion()

END CODE

Cheers,

f


Gökhan

2009/9/21 Gökhan Sever <gokhansever@...149...>:

It's a very late reply but I am wondering how to make these appear in the Ipy dev loaded into the session but not visible to a whos listing?

I don't think that's supported quite right now. IPython does one
special thing to support a clean %whos listing: right before opening
up the user mainloop, it checks all keys in the user namespace, and
later on when %whos is run, those variables that were initially
present are not displayed. So for now if you do this interactively,
you will unfortunately pollute %whos.

This is one thing we'll need to make sure works nicely again when the
dust settles.

Cheers,

f

Thanks Fernando for the quick response.

Today this is the 3rd time I am hitting an unsupported feature in the Python lands.

1-) No attribute docstrings

2-) Look this question: http://stackoverflow.com/questions/1458203/reading-a-float-from-string

and 3rd is this.

However I think I influenced to guys in our campus to take a look Python. One using Matlab-Simulink and C on collision-detection system design, the latter uses C to design a small scale embedded acquisition system for UAV platforms. He uses an ARM Cortex A8 processor powered Gumstix board. Xubuntu 9.04 runs on it. I saw Python 2.6.2 installed, however not sure how easy would that be to bring rest of the scipy stack into that machine.

Besides, tomorrow there is going to be a Matlab seminar here http://www.mathworks.com/company/events/seminars/seminar39323.html
It is about a SciPy advanced tutorial long.

Many similar subjects I see there:

Speeding Up MATLAB Applications:Tips and Tricks for Writing Efficient CodeTopics include:
• Understanding preallocation and vectorization
• Addressing bottlenecks
• Efficient indexing and manipulations
• JIT
• Interpreter
• Mex

Brief Introduction to Parallel Computing with MATLAB• Task parallel applications for faster processing
• Data parallel applications for handling large data sets
• Scheduling your programs to run

I hope I will not kick out from the session by keep commenting oh that is possible in Python, oh this is too :slight_smile:

···

On Tue, Sep 22, 2009 at 12:18 AM, Fernando Perez <fperez.net@gmail.com> wrote:

2009/9/21 Gökhan Sever <gokhansever@…761…>:

It’s a very late reply but I am wondering how to make these appear in the Ipy dev loaded into the session but not visible to a whos listing?

I don’t think that’s supported quite right now. IPython does one

special thing to support a clean %whos listing: right before opening

up the user mainloop, it checks all keys in the user namespace, and

later on when %whos is run, those variables that were initially

present are not displayed. So for now if you do this interactively,

you will unfortunately pollute %whos.

This is one thing we’ll need to make sure works nicely again when the

dust settles.

Cheers,

f


Gökhan