For interactive sessions, start with this:
%pylab inline
The %pylab
portion is basically a bunch of "from X import *
" commands and sets up the global environment with a bunch of handy stuff.
sin()
and pi
, from numpynp
plot()
and pie()
plt
The inline
keyword tells it to show graphs in the notebook instead of opening them in a new window.
%pylab inline
months = np.linspace(1, 36)
temps = 30 * sin(months * 2*pi/12) + 50
#plot(months, temps)
plot(months, temps * 0.8, 'go-', label="temps")
# style it a bit
ylim([0, 100])
xlim([1,36])
ylabel('Temp')
title('Seasonal Variation')
xlabel('Months')
#step(months, temps, 'y', label='steps')
bar(months, temps, color='#aaffaa', label='bars')
# add a legend
legend(loc=3)
None
N = 200
%timeit np.random.uniform(0,1, [N, N]).dot(np.random.uniform(0,1, [N, N]))
%timeit linalg.inv( np.random.uniform(0,1, [N, N]) )
import requests
response = requests.get('http://oranlooney.com/static/images/interface-diagram.png')
response
response.headers
from IPython.display import display, Image
display(Image(response.content))
Why scipy is awesome: http://www.talyarkoni.org/blog/category/statistics/
A really good series of lectures/tutorials on scipy: https://github.com/jrjohansson/scientific-python-lectures
Moving from matlab to numpy: http://sebastianraschka.com/Articles/2014_matlab_vs_numpy.html