# HG changeset patch # User Santosh G. Vattam # Date 1257924170 -19800 # Node ID 26f5e864a135e05e63dbd39568a3d488c6248b44 # Parent 49bdffe4dca565fed8f7e8ee3899bde0fa2a6b60 Updated session 1 of day 1. diff -r 49bdffe4dca5 -r 26f5e864a135 day1/session1.tex --- a/day1/session1.tex Wed Nov 11 12:26:07 2009 +0530 +++ b/day1/session1.tex Wed Nov 11 12:52: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.