Monday, April 26, 2010

ipython from a script

calling ipython from the shebang doesn't execute the script; it just starts an interactive shell. i found a way to access ipython magic from vanilla python, however: from IPython.Shell import IPShellEmbed ipshell = IPShellEmbed() _ip = ipshell.IP then i can time things, just like with %timeit, like this. print _ip.magic_timeit(locals+"import convolve3w;convolve3w.naive_convolve(f, g)")

No comments: