summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--day1/data/position.pngbin0 -> 28574 bytes
-rw-r--r--day1/session1.tex46
-rw-r--r--day1/session3.tex29
-rw-r--r--day2/3Dplotting.tex204
-rw-r--r--day2/data/3832.jpgbin0 -> 2661 bytes
-rw-r--r--day2/data/hyperboloid.pngbin0 -> 26991 bytes
-rw-r--r--day2/data/torus.pngbin0 -> 26016 bytes
7 files changed, 177 insertions, 102 deletions
diff --git a/day1/data/position.png b/day1/data/position.png
new file mode 100644
index 0000000..f4108bc
--- /dev/null
+++ b/day1/data/position.png
Binary files differ
diff --git a/day1/session1.tex b/day1/session1.tex
index 3e12da9..8eb1226 100644
--- a/day1/session1.tex
+++ b/day1/session1.tex
@@ -215,11 +215,13 @@ In []: ylabel('sin(x)')
\frametitle{Another example}
\begin{lstlisting}
In []: clf()
+#Clears the plot area.
In []: y = linspace(0, 2*pi, 51)
In []: plot(y, sin(2*y))
In []: xlabel('y')
In []: ylabel('sin(2y)')
\end{lstlisting}
+\emphbar{By default plots would be overlayed!}
\end{frame}
\begin{frame}[fragile]
@@ -231,7 +233,6 @@ In []: ylabel('sin(2y)')
In []: title('Sinusoids')
#Sets the title of the figure
In []: legend(['sin(2y)'])
-# When no label, or to change
\end{lstlisting}
% \small
% \end{block}
@@ -243,30 +244,17 @@ In []: legend(['sin(2y)'])
\begin{frame}[fragile]
\frametitle{Changing Legend Placement}
-\vspace*{-0.1in}
-\begin{lstlisting}
-In []: legend(['sin(2y)'], loc=(.8,.1))
-#(x,y) is position of lower-left
-#corner of legend box.
-\end{lstlisting}
-%\vspace*{-0.2in}
-\begin{center}
- \includegraphics[height=2in, interpolate=true]{data/loc}
-\end{center}
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle{Changing Legend Placement}
\begin{columns}
\column{0.6\textwidth}
\begin{block}{}
\small
\begin{lstlisting}
In []: legend(['sin(2y)'],
- loc='right')
+ loc='center')
\end{lstlisting}
\small
\end{block}
+ \includegraphics[height=2in, interpolate=true]{data/position}
\column{0.45\textwidth}
\vspace{-0.2in}
\begin{lstlisting}
@@ -287,6 +275,19 @@ Location String
\end{columns}
\end{frame}
+\begin{frame}[fragile]
+\frametitle{For placing legend at $(x,y)$}
+\vspace*{-0.1in}
+\begin{lstlisting}
+In []: legend(['sin(2y)'], loc=(.8,.1))
+#(x,y) is position of lower-left
+#corner of legend box.
+\end{lstlisting}
+%\vspace*{-0.2in}
+\begin{center}
+ \includegraphics[height=2in, interpolate=true]{data/loc}
+\end{center}
+\end{frame}
\begin{frame}[fragile]
\frametitle{Saving \& Closing}
@@ -298,7 +299,7 @@ In []: close()
\end{frame}
\begin{frame}[fragile]
-\frametitle{Multiple Figures}
+\frametitle{Plotting seprate figures}
\begin{lstlisting}
In []: figure(1)
In []: plot(y, sin(y))
@@ -359,7 +360,7 @@ In []: ylim(ymin, ymax)
\begin{frame}[fragile]
\frametitle{Review Problem}
\begin{enumerate}
-\item Plot x, -x, sin(x), xsin(x) in the range $-5\pi$ to $5\pi$
+\item Plot x, -x, sin(x), xsin(x) in range $-5\pi$ to $5\pi$
\item Add a legend
\item Annotate the origin
\item Set axis limits to the range of x
@@ -392,7 +393,14 @@ In []: ylim(5*pi, 5*pi)
\end{lstlisting}
}
\end{frame}
-
+\begin{frame}
+ \frametitle{Things we have learned}
+ \begin{itemize}
+ \item Creating plots.
+ \item Handling labels and legends.
+ \item Changing properties of plot.
+ \end{itemize}
+\end{frame}
\begin{frame}[fragile]
\begin{center}
End of Session-1\\
diff --git a/day1/session3.tex b/day1/session3.tex
index 47921f1..997fea3 100644
--- a/day1/session3.tex
+++ b/day1/session3.tex
@@ -311,8 +311,8 @@ data = {} # is an empty dictionary
\item In this problem let the value of a \emph{key} be another dictionary.
\item This dictionary contains:
\begin{itemize}
- \item 'marks': A \emph{list} of NumPy arrays
- \item 'total': Total marks of each student
+ \item 'marks': A \emph{List} of \emph{Lists} containing all marks
+ \item 'total': A \emph{List} of total marks of each student
\item 'P': Number of passes
\item 'F': Number of failures
\item 'W': Number of withdrawls
@@ -362,11 +362,6 @@ total = 0 if score_str == 'AA'
or score_str == ''
else int(fields[8])
data[fields[0]]['total'].append(total)
-
-pfw_key = fields[9]
- or fields[10]
- or 'F'
-data[fields[0]][pfw_key] += 1
\end{lstlisting}
\end{frame}
@@ -381,13 +376,25 @@ data[fields[0]][pfw_key] += 1
\end{frame}
\begin{frame}[fragile]
+ \frametitle{NumPy arrays}
+ \centerline{\alert{But I lied!?!?!?}}
+\end{frame}
+
+\begin{frame}[fragile]
\frametitle{Calculations}
- \small
\begin{lstlisting}
for k in data:
- data[k]['marks'] = array(data[k]['marks'])
- data[k]['total'] = array(data[k]['total'])
+ data[k]['marks'] = array(
+ data[k]['marks'])
+ data[k]['total'] = array(
+ data[k]['total'])
+ \end{lstlisting}
+\end{frame}
+\begin{frame}[fragile]
+ \frametitle{Calculations}
+ \small
+ \begin{lstlisting}
data[k]['avg'] = average(
data[k]['total'])
marks = data[k]['marks']
@@ -408,7 +415,7 @@ for k in data:
\item New type of conditional
\item NumPy arrays
\item Slicing NumPy arrays
- \item NumPy array operations - square, average, sqrt
+ \item NumPy array functions - square, average, sqrt
\end{itemize}
\end{frame}
diff --git a/day2/3Dplotting.tex b/day2/3Dplotting.tex
index 0547608..16c0bd2 100644
--- a/day2/3Dplotting.tex
+++ b/day2/3Dplotting.tex
@@ -156,6 +156,24 @@
\end{center}
\end{frame}
+
+\begin{frame}
+ \frametitle{Is this new?}
+ \begin{center}
+ We have moved from:
+ \end{center}
+ \begin{columns}
+ \column{}
+ \hspace*{-1in}
+ \includegraphics[width=1.75in,height=1.75in, interpolate=true]{data/3832}
+ \column{}\hspace*{-0.25in}
+ To
+ \column{}
+ \hspace*{-1in}
+ \includegraphics[width=1.75in, height=1.75in, interpolate=true]{data/torus}
+ \end{columns}
+\end{frame}
+
\begin{frame}
\frametitle{3D visualization}
\Large
@@ -189,75 +207,7 @@
\inctime{10}
\end{frame}
-\section{Tools at your disposal}
-
-\subsection{Mayavi2}
-
-\begin{frame}
- \frametitle{Introduction to Mayavi}
- \begin{itemize}
- \item Most scientists not interested in details of visualization
- \item Visualization of data files with a nice UI
- \item Interactive visualization of data (think Matlab)
- \item Embedding visualizations in applications
- \item Customization
- \end{itemize}
- \pause
- \begin{block}{The Goal}
- Provide a \alert{flexible} library/app for every one of these needs!
- \end{block}
-\end{frame}
-
-\begin{frame}
- {Overview of features}
- \vspace*{-0.3in}
- \begin{center}
- \hspace*{-0.2in}\pgfimage[width=5in]{MEDIA/m2/m2_app3_3}
- \end{center}
-\end{frame}
-
-
-\begin{frame}
- \frametitle{Mayavi in applications}
- \vspace*{-0.3in}
- \begin{center}
- \hspace*{-0.2in}\pgfimage[width=4.5in]{MEDIA/m2/m2_envisage}
- \end{center}
-\end{frame}
-
-\begin{frame}
- \frametitle{Live in your dialogs}
- \vspace*{0.1in}
- \begin{center}
- \hspace*{-0.2in}\pgfimage[width=2.5in]{MEDIA/m2/mlab_tui}
- \end{center}
-\end{frame}
-
-\begin{frame}
- {Exploring the documentation}
- \begin{center}
- \pgfimage[width=4in]{MEDIA/m2/m2_ug_doc}
- \end{center}
-\end{frame}
-
-
-\begin{frame}
- \frametitle{Summary}
- \begin{itemize}
- \item \url{http://code.enthought.com/projects/mayavi}
- \item Uses VTK (\url{www.vtk.org})
- \item BSD license
- \item Linux, win32 and Mac OS X
- \item Highly scriptable
- \item Embed in Traits UIs (wxPython and PyQt4)
- \item Envisage Plugins
- \item Debian/Ubuntu/Fedora
- \item \alert{Pythonic}
- \end{itemize}
-
- \inctime{10}
-
-\end{frame}
+\section{Tools available}
\subsection{mlab}
@@ -320,10 +270,51 @@
\end{frame}
\begin{frame}[fragile]
+ \frametitle{plotting 3-D Surface: $x^2+y^2-z^2=1$}
+ \begin{lstlisting}
+u,v = mgrid[-2:2:100j, -pi:pi:100j]
+x=sqrt(u*u+1)*cos(v)
+y=sqrt(u*u+1)*sin(v)
+z=u
+mlab.mesh(x,y,z)
+ \end{lstlisting}
+\begin{figure}
+\includegraphics[width=1in, height=1in, interpolate=true]{data/hyperboloid}
+\end{figure}
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{mgrid}
+ \begin{itemize}
+ \item Creates a multidimensional ``meshgrid''
+
+ \item In this particular case, creates 2 2D arrays: u,v.
+ \end{itemize}
+ \begin{lstlisting}
+In []: mgrid[0:3,0:3]
+Out[]:
+array([[[0, 0, 0],
+ [1, 1, 1],
+ [2, 2, 2]],
+
+ [[0, 1, 2],
+ [0, 1, 2],
+ [0, 1, 2]]])
+ \end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{mesh}
+ \begin{itemize}
+ \item Plots a surface from data supplied as 2D arrays.
+ \end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]
\frametitle{\mlab\ plotting functions}
\begin{columns}
\column{0.25\textwidth}
- \myemph{\Large 0D data}
+ \myemph{Points in 3D space}
\column{0.5\textwidth}
\pgfimage[width=2in]{MEDIA/m2/mlab/points3d_ex}
\end{columns}
@@ -340,7 +331,7 @@
\begin{frame}
\begin{columns}
\column{0.25\textwidth}
- \myemph{\Large 1D data}
+ \myemph{Connected points in 3D space}
\column{0.5\textwidth}
\pgfimage[width=2.5in]{MEDIA/m2/mlab/plot3d_ex}
\end{columns}
@@ -358,7 +349,7 @@
\pgfimage[width=2in]{MEDIA/m2/mlab/surf_ex}
\end{columns}
\begin{lstlisting}
->>> x = mgrid[-3:3:100j,-3:3:100j]
+>>> x, y = mgrid[-3:3:100j,-3:3:100j]
>>> z = sin(x*x + y*y)
\end{lstlisting}
@@ -422,6 +413,75 @@
\inctime{20}
\end{frame}
+
+\subsection{Mayavi2}
+
+\begin{frame}
+ \frametitle{Introduction to Mayavi}
+ \begin{itemize}
+ \item Most scientists not interested in details of visualization
+ \item Visualization of data files with a nice UI
+ \item Interactive visualization of data (think Matlab)
+ \item Embedding visualizations in applications
+ \item Customization
+ \end{itemize}
+ \pause
+ \begin{block}{The Goal}
+ Provide a \alert{flexible} library/app for every one of these needs!
+ \end{block}
+\end{frame}
+
+\begin{frame}
+ {Overview of features}
+ \vspace*{-0.3in}
+ \begin{center}
+ \hspace*{-0.2in}\pgfimage[width=5in]{MEDIA/m2/m2_app3_3}
+ \end{center}
+\end{frame}
+
+
+\begin{frame}
+ \frametitle{Mayavi in applications}
+ \vspace*{-0.3in}
+ \begin{center}
+ \hspace*{-0.2in}\pgfimage[width=4.5in]{MEDIA/m2/m2_envisage}
+ \end{center}
+\end{frame}
+
+\begin{frame}
+ \frametitle{Live in your dialogs}
+ \vspace*{0.1in}
+ \begin{center}
+ \hspace*{-0.2in}\pgfimage[width=2.5in]{MEDIA/m2/mlab_tui}
+ \end{center}
+\end{frame}
+
+\begin{frame}
+ {Exploring the documentation}
+ \begin{center}
+ \pgfimage[width=4in]{MEDIA/m2/m2_ug_doc}
+ \end{center}
+\end{frame}
+
+
+\begin{frame}
+ \frametitle{Summary}
+ \begin{itemize}
+ \item \url{http://code.enthought.com/projects/mayavi}
+ \item Uses VTK (\url{www.vtk.org})
+ \item BSD license
+ \item Linux, win32 and Mac OS X
+ \item Highly scriptable
+ \item Embed in Traits UIs (wxPython and PyQt4)
+ \item Envisage Plugins
+ \item Debian/Ubuntu/Fedora
+ \item \alert{Pythonic}
+ \end{itemize}
+
+ \inctime{10}
+
+\end{frame}
+
\begin{frame}
{Getting hands dirty!}
diff --git a/day2/data/3832.jpg b/day2/data/3832.jpg
new file mode 100644
index 0000000..40fe1b9
--- /dev/null
+++ b/day2/data/3832.jpg
Binary files differ
diff --git a/day2/data/hyperboloid.png b/day2/data/hyperboloid.png
new file mode 100644
index 0000000..9fe49dc
--- /dev/null
+++ b/day2/data/hyperboloid.png
Binary files differ
diff --git a/day2/data/torus.png b/day2/data/torus.png
new file mode 100644
index 0000000..e3e121c
--- /dev/null
+++ b/day2/data/torus.png
Binary files differ