This notebook was put together by [Jake Vanderplas](http://www.vanderplas.com) for UW's [Astro 599](http://www.astro.washington.edu/users/vanderplas/Astr599_2014/) course. Source and license info is on [GitHub](https://github.com/jakevdp/2014_fall_ASTR599/).
In [1]:
%run talktools.py
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.
**Interpreted** | No need for a compiling stage |
**Object-oriented** | Objects: complex data structures with attributes and methods |
**High-level** | Abstraction from the way the machine actually executes |
**Dynamic** | Variables can change meaning on-the-fly |
**Built-in** | Fewer external requirements |
**Data structures** | Ways of storing/manipulating data |
**Script/Glue** | Code that controls other programs |
**Typing** | The kind of variable (int, string, float) |
**Syntax** | Grammar which defines the language |
**Library** | reusable collection of code |
"...in December 1989, I was looking for a 'hobby' programming project that would keep me occupied during the week around Christmas. My office ... would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus)."
In [2]:
from IPython.display import YouTubeVideo
YouTubeVideo("i9SSOWORzw4")
Out[2]:
In [3]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
In [4]:
N = 200
r = 2 * np.random.rand(N)
theta = 2 * np.pi * np.random.rand(N)
area = 200 * r ** 2 * np.random.rand(N)
ax = plt.subplot(111, polar=True)
plt.scatter(theta, r, c=theta, s=area, alpha=0.75);
In [5]:
from IPython.display import YouTubeVideo
YouTubeVideo('tlontoyWX70', start=30)
Out[5]:
In [6]:
!curl -O http://matplotlib.org/mpl_examples/pylab_examples/demo_agg_filter.py
%run demo_agg_filter.py
In [7]:
from IPython.display import HTML
HTML("""<video width='700' height='500' preload='none' controls poster='http://jakevdp.github.io/downloads/videos/double_pendulum_frame.png'><source src='http://jakevdp.github.io/downloads/videos/double_pendulum.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'></video>""")
Out[7]:
The best option is one which includes code highlighting