Branches merged.
authorSantosh G. Vattam <vattam.santosh@gmail.com>
Wed, 11 Nov 2009 15:38:50 +0530
changeset 305 43bfb88594c0
parent 304 c53251e506cc (diff)
parent 302 8ea4739a7f1f (current diff)
child 306 57291186d598
Branches merged.
--- a/day1/session1.tex	Wed Nov 11 12:30:18 2009 +0530
+++ b/day1/session1.tex	Wed Nov 11 15:38:50 2009 +0530
@@ -162,7 +162,7 @@
   \begin{block}{Goal: Successful participants will be able to}
     \begin{itemize}
       \item Use Python as plotting, computational tool
-      \item Understand how Python can be used as a scripting and problem solving language.
+      \item Understand how to use Python as a scripting and problem solving language.
       \item Train students for the same
     \end{itemize}
   \end{block}
@@ -186,6 +186,11 @@
       \item \typ{sslc_allreg.py}
       \item \typ{sslc_science.py}
       \end{itemize}
+    \item Images
+      \begin{itemize}
+      \item \typ{lena.png}
+      \item \typ{smoothing.gif}
+      \end{itemize}
   \end{enumerate}
 \end{frame}
 
@@ -290,7 +295,9 @@
 \frametitle{Another example}
   \begin{lstlisting}
 In []: clf()
-#Clears the plot area.
+  \end{lstlisting}
+\emphbar{Clears the plot area.}
+  \begin{lstlisting}
 In []: y = linspace(0, 2*pi, 50)
 In []: plot(y, sin(2*y))
 In []: xlabel('y')
@@ -306,7 +313,6 @@
 %  \small
 \begin{lstlisting}
 In []: title('Sinusoids')
-#Sets the title of the figure
 In []: legend(['sin(2y)'])
 \end{lstlisting}
 %  \small
@@ -352,8 +358,8 @@
 \vspace*{-0.1in}
 \begin{lstlisting}
 In []: legend(['sin(2y)'], loc=(.8,.1)) 
-# Specify south-east corner position
 \end{lstlisting}
+\emphbar{Specify south-east corner position}
 %\vspace*{-0.2in}
 \begin{center}
   \includegraphics[height=2in, interpolate=true]{data/loc}  
@@ -406,7 +412,7 @@
 In []: plot(y, sin(y), 'g')
 
 In []: clf()
-In []: plot(y, sin(y), 'g', linewidth=2)
+In []: plot(y, cos(y), 'r', linewidth=2)
 \end{lstlisting}
 \vspace*{-0.2in}
 \begin{center}
@@ -429,13 +435,14 @@
 
 \begin{frame}[fragile]
 \frametitle{Axes lengths}
+\emphbar{Get the axes limits}
   \begin{lstlisting}
-#Get the axes limits
 In []: xmin, xmax = xlim() 
 In []: ymin, ymax = ylim() 
-
+  \end{lstlisting}
+\emphbar{Set the axes limits}
+  \begin{lstlisting}
 In []: xmax = 2*pi
-#Set the axes limits
 In []: xlim(xmin, xmax) 
 In []: ylim(ymin-0.2, ymax+0.2) 
   \end{lstlisting}
@@ -447,7 +454,7 @@
 \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
+\item Set axes limits to the range of x
 \end{enumerate}
 \begin{lstlisting}
 In []: x=linspace(-5*pi, 5*pi, 500)
@@ -481,23 +488,28 @@
 \item Identify the required line numbers
 \item Then, use \typ{\%save} command of IPython
 \end{itemize}
-\begin{lstlisting}
-  In []: %hist
-  In []: %save four_plot.py 16 18-27
-\end{lstlisting}
+\typ{In []: \%hist}\\
+\typ{In []: \%save four_plot.py} \alert{\typ{16 18-27}} 
+\begin{block}{Careful about errors!}
+  \kwrd{\%hist} will contain the errors as well,\\
+  so be careful while selecting line numbers.
+\end{block}
 \end{frame}
 
 \begin{frame}
 \frametitle{Python Scripts\ldots}
  This is called a Python Script.
  \begin{itemize}
- \item run the script in IPython using \typ{\%run -i sine_plot.py}\\
+ \item run the script in IPython using \typ{\%run -i four_plot.py}\\
  \end{itemize}
 \end{frame}
 
-\begin{frame}
+\begin{frame}[fragile]
   \frametitle{What did we learn?}
   \begin{itemize}
+    \item \kwrd{\%hist}
+    \item Saving commands to a script
+    \item Running a script using \kwrd{\%run -i}
     \item Creating simple plots.
     \item Adding labels and legends.
     \item Annotating plots.
--- a/day1/session4.tex	Wed Nov 11 12:30:18 2009 +0530
+++ b/day1/session4.tex	Wed Nov 11 15:38:50 2009 +0530
@@ -503,9 +503,24 @@
 \end{frame}
 
 \begin{frame}[fragile]
+\frametitle{Getting $L$ and $T^2$}
+If you \alert{closed} IPython after session 2
+\begin{lstlisting}
+In []: l = []
+In []: t = []
+In []: for line in open('pendulum.txt'):
+  ....     point = line.split()
+  ....     l.append(float(point[0]))
+  ....     t.append(float(point[1]))
+  ....
+  ....
+\end{lstlisting}
+\end{frame}
+ 
+\begin{frame}[fragile]
 \frametitle{Generating $A$}
 \begin{lstlisting}
-In []: A = array([L, ones_like(L)])
+In []: A = array([l, ones_like(l)])
 In []: A = A.T
 \end{lstlisting}
 %% \begin{itemize}
@@ -533,13 +548,13 @@
 \frametitle{Least Square Fit Line \ldots}
 We get the points of the line from \typ{coef}
 \begin{lstlisting}
-In []: Tline = coef[0]*L + coef[1]
+In []: Tline = coef[0]*l + coef[1]
 \end{lstlisting}
 \begin{itemize}
-\item Now plot Tline vs. L, to get the Least squares fit line. 
+\item Now plot \typ{Tline} vs. \typ{l}, to get the Least squares fit line. 
 \end{itemize}
 \begin{lstlisting}
-In []: plot(L, Tline)
+In []: plot(l, Tline)
 \end{lstlisting}
 \end{frame}