[SciPy-user] python/scipy as matlab, using ipython

Gael Varoquaux gael.varoquaux at normalesup.org
Fri Sep 15 03:49:03 CDT 2006


    Hello Lars,

I don't think there is an obvious way of doing this with ipython
(though you might get a different answer from a ipython wizard). I have
a suggestion. I haven't tested this thoroughly, but you can have a look.
Use SPE (Stany's Python Editor) as an editor. Spe has a python shell. To
use pylab in the python shell you should use the WXAgg backend (edit
your ~/.matplotlib/.matplotlibrc and set

backend      : WXAgg

Then in the shell you can use python interactively or you can run the
scripts you are editing in it. One big caveat: you create an display a
figure before plot to it:

You should do
from numpy import *
from pylab import *
t = arange(1,10)
figure() # Important: create the figure before attempting to plot to it
show() # Important: display the figure before attempting to plot to it
plot(t,cos(t))
show()

The python shell embedded in SPE isn't as nice as ipython (Robert, if
you are listening, didn't I hear you say that you were working on a
front-end independent ipython that could replace Wx's pyshell one day).
One big feature that you will miss is the interactivity of pylab that
you have in ipython (not have to enter the show() command, and the
ability to zoom. Maybe it is possible to get matplotlib to do this here
to, you can try asking on the matplotlib list.

Using SPE is just an idea an needs to be explored a bit more, but maybe
you can do something out of it.

Gaël

On Fri, Sep 15, 2006 at 09:33:59AM +0200, Lars Friedrich wrote:
> Hello scipy users,

> for a short time now, I am using python, numpy and scipy as a
> replacement for matlab. My setup at the moment is the "scite"-editor and
> the "ipython"-shell. I am happy using the "run -i" command to access the
> current workspace with my scripts written with scite.

> There is one feature that I know from matlab that I miss a little. Maybe
> its not crucial but it would be nice to have:

> When I made a change to my script in scite, I have to
> *save it
> *change scope to ipython
> *recall the "run -i myScript.py" command
> *press <enter>

> In matlab it is possible to hit <F5> to get the same effect. How can I
> achieve this with scite/ipython? I think, I need a way to tell ipython
> "from extern" to execute the "run"-command. I would put this to my
> scite-config-file to connect it with, say, the <F5> button and would be
> fine. Is this possible?

> Thanks for every comment

> Lars

> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user


More information about the SciPy-user mailing list