In [1]:
from IPython.display import display, Image, HTML
from talktools import website, nbviewer
All computations in scientific computing and data science involve data at some level. Here are some important questions about the human experience of working with data.
The number of steps required for each of these activities is determined by the software tool.
These are attributes of software tools designed to work with data.
Here are some examples:
We are trying make IPython as close to the data as possible.
Data exploration is an iterative process that involves quick, repeated passes at visualization, interaction and computation.
In [2]:
Image('images/VizInteractCompute.png')
Out[2]:
Right now this cycle is still really painful. For most users, the time scale for this cycle is typically minutes or even hours. We are working to bring it down to seconds for all users.
Viewing raw data in a textual format is a difficult way to explore data.
In [3]:
%pylab inline
In [4]:
a = np.random.rand(25); a
Out[4]:
To really see the data, you need richer representations.
In [5]:
hist(a)
Out[5]:
This might be a plot, but could also be a static image, HTML, audio sample, etc.
Since 2011, IPython has had a rich display system. This rich display system allows Python objects to declare non-textual representations that can be displayed in the Notebook. These rich representations include:
These rich representaions are displayed using IPython's display function:
In [6]:
from IPython.display import display, Audio, Latex
Throughout this talk I have been using the Image and HTML representations of objects. Here is an example of a Python object with an HTML5 audio representation:
In [7]:
a = Audio('data/Bach Cello Suite #3.wav')
In [8]:
display(a)
And a LaTeX representation of Maxwell's equations:
In [9]:
Latex(r"""\begin{eqnarray}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{eqnarray}""")
Out[9]:
But this rich display system only covers part of the iterative cycle of data exploration. Most importantly, we need to interact with the data.
For IPython 2.0 (release in January 2014) we have developed a layered architecture for building interactivity into the Notebook. This architecture allows Python and JavaScript code to communicate seamlessly and in real time.
In [10]:
Image('images/WidgetArch.png')
Out[10]:
Let's go play!
In [11]:
%load_ext load_style
In [12]:
%load_style talk.css