%install_ext https://raw.github.com/ebellm/ipython-idlmagic/master/idlmagic.py %load_ext idlmagic %idl print, findgen(5) %%idl x = findgen(5) y = x^2. ; comments are supported print, $ ; as are line continuations mean(y) msg = ' padded string ' import numpy as np arr = np.arange(5) %idl_push msg arr %%idl print, strcompress(msg,/REMOVE_ALL) print, reverse(arr) %idl arr += 1 %idl_pull arr arr Z = np.array([1, 4, 5, 10]) %idl -i Z -o W W = sqrt(Z) W %%idl -s 400,400 plot,findgen(10),xtitle='X',ytitle='Y'