A request for code critique

Hello Roy,

“ipython splot.py 09_03_23_11_44_54.stats.tas”

works, but I can’t make it work with pylab switch. It executes my script, however whos list an empty namespace :frowning:

My aim of loading the variables and results into an interactive pylab enabled workspace is to be able to continue working on the same data and if necessary make some manipulations like adding titles, labels, legends, changing scales depends on a person’s need.

According to IPython documentation it is also possible to make IPython as the default python environment. (http://ipython.scipy.org/doc/nightly/html/interactive/reference.html#ipython-as-your-default-python-environment) And again no way of starting with pylab (“there is no way to pass IPython any
command-line options”)

Any other ideas?

Btw, I haven’t seen a blue star lately :slight_smile:

Gökhan

···

On Sun, May 17, 2009 at 7:07 AM, Roy Hyunjin Han <starsareblueandfaraway@…287…> wrote:

On Sat, May 16, 2009 at 4:34 PM, Gökhan SEVER <gokhansever@…287…> wrote:

However I still couldn’t figure out how to drop in ipython from the bash shell call

while all my variable context visible in the ipython namespace.

Gökhan,

Have you tried the following?

RHH

$ ipython splot.py 09_03_23_11_44_54.stats.tas

Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)

Type “copyright”, “credits” or “license” for more information.

IPython 0.8.4 – An enhanced Interactive Python.

? -> Introduction and overview of IPython’s features.

%quickref -> Quick reference.

help -> Python’s own help system.

object? -> Details about ‘object’. ?object also works, ?? prints more.

In [1]: skiprows

Out[1]: 30

Gökhan,

The "whos" command works for me.

Also, why can't you use "import pylab" and make your plots directly in ipython?
You can also use "from pylab import *" if you don't want to type pylab
every time.

In [1]: whos
Variable Type Data/Info

···

On Sun, May 17, 2009 at 2:17 PM, Gökhan SEVER <gokhansever@...287...> wrote:

Hello Roy,

"ipython splot.py 09_03_23_11_44_54.stats.tas"

works, but I can't make it work with pylab switch. It executes my script,
however whos list an empty namespace :frowning:

----------------------------------------------------
argv list ['splot.py',
'09_03_23_11_44_54.stats.tas']
argv_arr ndarray 12x13: 156 elems, type
`float64`, 1248 bytes
axes function <function axes at 0x92b6064>
axis function <function axis at 0x92b6294>
boxplot function <function boxplot at 0x92b6924>
d09_03_23_11_44_54_stats_tas ndarray 12x13: 156 elems, type
`float64`, 1248 bytes
data_len int 12
draw function <function draw at 0x9212dbc>
f file <closed file
'09_03_23_11<...>', mode 'r' at 0x88ef260>
i int 11
loadtxt function <function loadtxt at 0x8b65304>
mouse_hover_formatx function <function
mouse_hover_formatx at 0x88e84fc>
mouse_hover_formaty function <function
mouse_hover_formaty at 0x88e84c4>
plot function <function plot at 0x92b6cdc>
savefig function <function savefig at 0x9212df4>
show function <function show at 0x920f72c>
skiprows int 30

Hmm,

Is it working on your side from a bash shell as “ipython --pylab script argument”

I couldn’t make it work in this fashion. As I said whos list nothing :frowning:

I am on Fedora 10 x86, Python 2.5.2, IPython 0.10.bzr.r1173

Without the pylab switch I see the interactive space with variables. I also have plot imported from my script, however each time I have to call show() to see the figure to be re-drawn.

To me, it seems one need to compromise: either to start ipython --pylab first and call scripts using “run” magic command or like you suggested start ipython with the script loaded and call show() after each plot command.

Please comment me if I am wrong…

Gökhan

···

On Sun, May 17, 2009 at 3:19 PM, Roy Hyunjin Han <starsareblueandfaraway@…287…> wrote:

On Sun, May 17, 2009 at 2:17 PM, Gökhan SEVER <gokhansever@…287…> wrote:

Hello Roy,

“ipython splot.py 09_03_23_11_44_54.stats.tas”

works, but I can’t make it work with pylab switch. It executes my script,

however whos list an empty namespace :frowning:

Gökhan,

The “whos” command works for me.

Also, why can’t you use “import pylab” and make your plots directly in ipython?

You can also use “from pylab import *” if you don’t want to type pylab

every time.

In [1]: whos

Variable Type Data/Info


argv list [‘splot.py’,

‘09_03_23_11_44_54.stats.tas’]

argv_arr ndarray 12x13: 156 elems, type

float64, 1248 bytes

axes function <function axes at 0x92b6064>

axis function <function axis at 0x92b6294>

boxplot function <function boxplot at 0x92b6924>

d09_03_23_11_44_54_stats_tas ndarray 12x13: 156 elems, type

float64, 1248 bytes

data_len int 12

draw function <function draw at 0x9212dbc>

f file <closed file

‘09_03_23_11<…>’, mode ‘r’ at 0x88ef260>

i int 11

loadtxt function <function loadtxt at 0x8b65304>

mouse_hover_formatx function <function

mouse_hover_formatx at 0x88e84fc>

mouse_hover_formaty function <function

mouse_hover_formaty at 0x88e84c4>

plot function <function plot at 0x92b6cdc>

savefig function <function savefig at 0x9212df4>

show function <function show at 0x920f72c>

skiprows int 30