from IPython.core.display import Image Image(filename='logo.png', width=600) def sum_of_squares(a): return np.sum(a**2) foo = np.array([1, 3, 5]) sum_of_squares(foo) print Out[3] + 4 # With the --pylab inline option, matplotlib plots are inline as cell output w = np.linspace(0, 4*pi, 1000) plt.plot(w, np.sin(w)) import scipy.signal scipy.signal.fi help(scipy.signal.firwin) # %timeit runs a single line a bunch of times and reports the average run time %timeit np.arange(1000) %timeit xrange(1000) %%prun # prun runs Python's profiler on the current cell N = 1e5 scipy.signal.fftconvolve(np.random.rand(N), np.random.rand(N)) # Not a magic, but IPython also allows for running shell commands !ls -lh # The Python-Matlab bridge can be used as a magic import pymatbridge as pymat ip = get_ipython() pymat.load_ipython_extension(ip) # Python variable - a filter cutoff Wn = .2 %%matlab -i Wn -o b b = fir1(30, Wn); import scipy.signal w, h = scipy.signal.freqz(b); plt.plot(w, np.abs(h))