Updated day1 session1.
authorPuneeth Chaganti <punchagan@fossee.in>
Sat, 31 Oct 2009 01:23:23 +0530
changeset 264 c3a1de5b8216
parent 260 1f5fea506927
child 265 ac31e2f3754e
Updated day1 session1.
day1/cheatsheet1.tex
day1/data/annotate.png
day1/session1.tex
--- a/day1/cheatsheet1.tex	Fri Oct 30 15:49:51 2009 +0530
+++ b/day1/cheatsheet1.tex	Sat Oct 31 01:23:23 2009 +0530
@@ -2,54 +2,43 @@
 \title{Interactive Plotting}
 \author{FOSSEE}
 \begin{document}
-\maketitle
+\date{}
+\vspace{-1in}
+\begin{center}
+\LARGE{Interactive Plotting}\\
+\large{FOSSEE}
+\end{center}
+\section{Starting up...}
 
-\section{Starting up...}
 \begin{verbatim}
   $ ipython -pylab  
 \end{verbatim}
-Exiting Ipython
+Exiting 
 \begin{verbatim}     
-  In [1]: print "Hello, World!"
-  In [2]: ^D
-  Do you really want to exit ([y]/n)? y
+In [2]: (Ctrl-D)^D
+Do you really want to exit ([y]/n)? y
 \end{verbatim}
 Breaking out of loops
 \begin{verbatim}     
-  In [1]: while True:
-    ...:     print "Hello, World!"
-    ...:     
-  Hello, World!
-  Hello, World!^C
-\end{verbatim}
-
-\section{First Plot}
-\begin{verbatim}
-  In [2]: x=linspace(0, 2*pi, 50)
-
-  In [3]: plot(x,sin(x))
-  Out[3]: [<matplotlib.lines.Line2D object at 0xb6e5874c>]
+In [1]: while True:
+   ...:     print "Hello, World!"
+   ...:     
+Hello, World!
+Hello, World!(Ctrl-C)^C
 \end{verbatim}
 
-\section{Labeling}
-\begin{verbatim}
-  In [4]: xlabel('x')
-
-  In [5]: ylabel('sin(x)')
-\end{verbatim}
-
-\section{Another example}
+\section{Plotting}
 \begin{verbatim}
-In [6]: clf()
-
-In [7]: y = linspace(0,10,101)
-
-In [8]: plot(y, exp(-y))
-
-In [9]: xlabel('y')
-
-In [10]: ylabel(r'$e^{-y}$')
+In [1]: x = linspace(0, 2*pi, 50)
+In [2]: plot(x,sin(x))
+In [3]: xlabel('x')
+In [4]: ylabel('sin(x)')
+In [5]: legend(['x', '-x', 'sin(x)', 'xsin(x)'])
+In [6]: annotate('origin', xy=(0, 0), xytext=(0, -7),
+                 arrowprops=dict(shrink=0.05))
+In [7]: xlim(5*pi, 5*pi)
+In [8]: ylim(5*pi, 5*pi)
+In [9]: clf() #Clears the Plot area
 \end{verbatim}
-
 \end{document}
 
Binary file day1/data/annotate.png has changed
--- a/day1/session1.tex	Fri Oct 30 15:49:51 2009 +0530
+++ b/day1/session1.tex	Sat Oct 31 01:23:23 2009 +0530
@@ -49,7 +49,7 @@
 }
 \newcounter{time}
 \setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
+\newcommand{%\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
 
 \newcommand{\typ}[1]{\lstinline{#1}}
 
@@ -77,7 +77,7 @@
 \author[FOSSEE] {FOSSEE}
 
 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {31, October 2009\\Day 1, Session 1}
+\date[] {31 October, 2009\\Day 1, Session 1}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -106,7 +106,7 @@
 % the following command: 
 %\beamerdefaultoverlayspecification{<+->}
 
-%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
+%%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % DOCUMENT STARTS
@@ -129,10 +129,10 @@
 	\item[Session 2] Sat 10:05--11:05
 	\item[Session 3] Sat 11:20--12:20
 	\item[Session 4] Sat 12:25--13:25
-        \item[Quiz -1]   Sat 14:25--14:40
+        \item[Quiz 1] Sat 14:25--14:40
         \item[Session 5] Sat 14:40--15:40
         \item[Session 6] Sat 15:55--16:55
-        \item[Quiz -2]   Sat 17:00--17:15
+        \item[Quiz 2] Sat 17:00--17:15
   \end{description}
 \end{frame}
 
@@ -143,10 +143,10 @@
 	\item[Session 2] Sun 10:05--11:05
 	\item[Session 3] Sun 11:20--12:20
 	\item[Session 4] Sun 12:25--13:25
-        \item[Quiz -1]   Sun 14:25--14:40
+        \item[Quiz 1] Sun 14:25--14:40
         \item[Session 5] Sun 14:40--15:40
         \item[Session 6] Sun 15:55--16:55
-        \item[Quiz -2]   Sun 17:00--17:15
+        \item[Quiz 2] Sun 17:00--17:15
   \end{description}
 \end{frame}
 
@@ -161,9 +161,9 @@
 
   \begin{block}{Goal: Successful participants will be able to}
     \begin{itemize}
-      \item Use Python as plotting, computational toolkit
-      \item Understand how Python can be used as scripting and problem solving language.
-      \item Train the students to use Python for the same
+      \item Use Python as plotting, computational tool
+      \item Understand how Python can be used as a scripting and problem solving language.
+      \item Train students for the same
     \end{itemize}
   \end{block}
 \end{frame}
@@ -172,14 +172,20 @@
 \begin{frame}
 \frametitle{Checklist}
   \begin{enumerate}
-    \item IPython: Type ipython at the command line. Is it available?
+    \item IPython
     \item Editor: We recommend scite.
-    \item Data files: Make sure you have all data files.
+    \item Data files: 
+      \begin{itemize}
+      \item \typ{sslc1.txt}
+      \item \typ{pendulum.txt}
+      \item \typ{points.txt}
+      \item \typ{pos.txt}
+      \end{itemize}
   \end{enumerate}
 \end{frame}
 
 \begin{frame}[fragile]
-\frametitle{Starting up...}
+\frametitle{Starting up \ldots}
 \begin{block}{}
 \begin{verbatim}
   $ ipython -pylab  
@@ -196,20 +202,20 @@
 \end{lstlisting}
 \end{frame}
 
-\begin{frame}[fragile]
-\frametitle{Loops}
-Breaking out of loops
-\begin{lstlisting}     
-  In []: while True:
-    ...:     print "Hello, World!"
-    ...:     
-  Hello, World!
-  Hello, World!^C(Ctrl-C)
-  ------------------------------------
-  KeyboardInterrupt                   
+%% \begin{frame}[fragile]
+%% \frametitle{Loops}
+%% Breaking out of loops
+%% \begin{lstlisting}     
+%%   In []: while True:
+%%     ...:     print "Hello, World!"
+%%     ...:     
+%%   Hello, World!
+%%   Hello, World!^C(Ctrl-C)
+%%   ------------------------------------
+%%   KeyboardInterrupt                   
 
-\end{lstlisting}
-\end{frame}
+%% \end{lstlisting}
+%% \end{frame}
 
 \section{Plotting}
 
@@ -224,7 +230,7 @@
     \begin{block}{}
     \begin{small}
 \begin{lstlisting}
-In []: x = linspace(0, 2*pi, 51)
+In []: x = linspace(0, 2*pi, 50)
 In []: plot(x, sin(x))
 \end{lstlisting}
     \end{small}
@@ -246,6 +252,7 @@
 \begin{block}{\typ{plot(x, y)}}
 plots \typ{x} and \typ{y} using default line style and color
 \end{block}
+%\inctime{10}
 \end{frame}
 
 \subsection{Decoration}
@@ -279,12 +286,11 @@
   \begin{lstlisting}
 In []: clf()
 #Clears the plot area.
-In []: y = linspace(0, 2*pi, 51)
+In []: y = linspace(0, 2*pi, 50)
 In []: plot(y, sin(2*y))
 In []: xlabel('y')
 In []: ylabel('sin(2y)')
   \end{lstlisting}
-\emphbar{By default plots would be overlaid!}
 \end{frame}
 
 \subsection{More decoration}
@@ -308,11 +314,10 @@
 
 \begin{frame}[fragile]
 \frametitle{Legend Placement}
-
 \begin{block}{}
     \small
 \begin{lstlisting}
-In []: legend(['sin(2y)'], loc='center')
+In []: legend(['sin(2y)'], loc = 'center')
 \end{lstlisting}
 \end{block}
 
@@ -348,6 +353,7 @@
 \begin{center}
   \includegraphics[height=2in, interpolate=true]{data/loc}  
 \end{center}
+%\inctime{10}
 \end{frame}
 
 \begin{frame}[fragile]
@@ -361,8 +367,22 @@
 
 \section{Multiple plots}
 \begin{frame}[fragile]
+\frametitle{Overlaid Plots}
+\begin{lstlisting}
+In []: clf()
+In []: plot(y, sin(y))
+In []: plot(y, cos(y))
+In []: xlabel('y')
+In []: ylabel('f(y)')
+In []: legend(['sin(y)', 'cos(y)']) 
+\end{lstlisting}
+\emphbar{By default plots would be overlaid!}
+\end{frame}
+
+\begin{frame}[fragile]
 \frametitle{Plotting separate figures}
 \begin{lstlisting}
+In []: clf()
 In []: figure(1)
 In []: plot(y, sin(y))
 In []: figure(2)
@@ -381,23 +401,20 @@
 In []: plot(y, sin(y), 'g')
 
 In []: clf()
-In []: plot(y, sin(y), linewidth=2)
+In []: plot(y, sin(y), 'g', linewidth=2)
 \end{lstlisting}
 \vspace*{-0.2in}
 \begin{center}
   \includegraphics[height=2.2in, interpolate=true]{data/green}  
 \end{center}
+%\inctime{10}
 \end{frame}
 
 \begin{frame}[fragile]
 \frametitle{Annotating}
 \vspace*{-0.15in}
 \begin{lstlisting}
-In []: annotate('local max', 
-       xy=(1.5, 1), 
-       xytext=(2.5, .8),
-       arrowprops=dict(
-       shrink=0.05),)
+In []: annotate('local max', xy=(1.5, 1))
 \end{lstlisting}
 \vspace*{-0.2in}
 \begin{center}
@@ -415,7 +432,7 @@
 In []: xmax = 2*pi
 #Set the axes limits
 In []: xlim(xmin, xmax) 
-In []: ylim(ymin, ymax) 
+In []: ylim(ymin-0.2, ymax+0.2) 
   \end{lstlisting}
 \end{frame}
 
@@ -428,34 +445,29 @@
 \item Set axis limits to the range of x
 \end{enumerate}
 \begin{lstlisting}
-In []: x=linspace(-5*pi, 5*pi, 501)
+In []: x=linspace(-5*pi, 5*pi, 500)
 In []: plot(x, x, 'b')
 In []: plot(x, -x, 'b')
 \end{lstlisting}
 $\vdots$
 \end{frame}
 
-\section{Exercises}
 \begin{frame}[fragile]
 \frametitle{Review Problem \ldots}
-\small{
 \begin{lstlisting}
 In []: plot(x, sin(x), 'g', linewidth=2)
-In []: plot(x, x*sin(x), 'r', linewidth=3)
+In []: plot(x, x*sin(x), 'r', 
+            linewidth=3)
 \end{lstlisting}
-
 \begin{lstlisting}
-In []: legend(['x', '-x', 'sin(x)', 'xsin(x)'])
-In []: annotate('origin', 
-                 xy=(0, 0), 
-                 xytext=(0, -7),
-                 arrowprops=dict(
-                 shrink=0.05))
-In []: xlim(5*pi, 5*pi)
-In []: ylim(5*pi, 5*pi)
+In []: legend(['x', '-x', 'sin(x)', 
+               'xsin(x)'])
+In []: annotate('origin', xy = (0, 0))
+In []: xlim(-5*pi, 5*pi)
+In []: ylim(-5*pi, 5*pi)
 \end{lstlisting}
-}
 \end{frame}
+
 \begin{frame}
   \frametitle{What did we learn?}
   \begin{itemize}
@@ -467,6 +479,7 @@
   \begin{block}{Note}
     \centerline{\alert{Don't Close \typ{IPython}}}
   \end{block}
+%%\inctime{10}
 \end{frame}
 
 \end{document}