# HG changeset patch # User Puneeth Chaganti # Date 1265292377 -19800 # Node ID 701585ab7eca1b9b7f15242c0078e3edb0d7d101 # Parent 3c911c958bcf563b4a1815dca89ad81b6463a6d4# Parent ec4cb3ba7f09989b55dc93cdb56e2acd9f24e0bf Merged with Main line. diff -r 3c911c958bcf -r 701585ab7eca day1/session1.tex --- a/day1/session1.tex Mon Jan 25 12:06:18 2010 +0530 +++ b/day1/session1.tex Thu Feb 04 19:36:17 2010 +0530 @@ -77,7 +77,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {11 January, 2010\\Day 1, Session 1} +\date[] {28 January, 2010\\Day 1, Session 1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -123,34 +123,6 @@ %% \end{frame} \begin{frame} - \frametitle{Workshop Schedule: Day 1} - \begin{description} - \item[Session 1] Mon 09:00--10:00 - \item[Session 2] Mon 10:05--11:05 - \item[Session 3] Mon 11:20--12:20 - \item[Session 4] Mon 12:25--13:25 - \item[Quiz 1] Mon 14:25--14:40 - \item[Exercises] Mon 14:40--15:25 - \item[Session 5] Mon 15:40--16:40 - \item[Quiz 2] Mon 16:45--17:00 - \end{description} -\end{frame} - -\begin{frame} - \frametitle{Workshop Schedule: Day 2} - \begin{description} - \item[Session 1] Tue 09:00--10:00 - \item[Session 2] Tue 10:05--11:05 - \item[Session 3] Tue 11:20--12:20 - \item[Session 4] Tue 12:25--13:25 - \item[Quiz 1] Tue 14:25--14:40 - \item[Exercises] Tue 14:40--15:25 - \item[Session 5] Tue 15:40--16:40 - \item[Quiz 2] Tue 16:45--17:00 - \end{description} -\end{frame} - -\begin{frame} \frametitle{About the Workshop} \begin{block}{Intended Audience} \begin{itemize} @@ -168,68 +140,7 @@ \end{block} \end{frame} -\section{Getting started} -\begin{frame} -\frametitle{Checklist} - \begin{enumerate} - \item IPython - \item Editor: We recommend \alert{scite}. - \item Data files: - \begin{itemize} - \item \typ{sslc1.txt} - \item \typ{pendulum.txt} - \item \typ{points.txt} - \item \typ{pos.txt} - \item \typ{holmes.txt} - \end{itemize} - \item Python scripts: - \begin{itemize} - \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} - -\begin{frame}[fragile] -\frametitle{Starting up \ldots} -\begin{block}{} -\begin{lstlisting} - $ ipython -pylab -\end{lstlisting} %$ -\end{block} -\begin{lstlisting} - In []: print "Hello, World!" - Hello, World! -\end{lstlisting} -Exiting -\begin{lstlisting} - In []: ^D(Ctrl-D) - Do you really want to exit([y]/n)? y -\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 - -%% \end{lstlisting} -%% \end{frame} - \section{Plotting} - \subsection{Drawing plots} \begin{frame}[fragile] \frametitle{First Plot} @@ -249,7 +160,6 @@ \end{columns} \end{frame} - \begin{frame}[fragile] \frametitle{Walkthrough} \begin{block}{\typ{x = linspace(start, stop, num)} } @@ -488,9 +398,9 @@ \frametitle{Saving Commands} Save commands of review problem into file \begin{itemize} -\item Use \typ{\%hist} command of IPython +\item Use \typ{\%hist} command of IPython (Recall \%\typ{hist} from the previous session) \item Identify the required line numbers -\item Then, use \typ{\%save} command of IPython +\item Then, use \typ{\%save} command of IPython (Recall \%\typ{save} from the previous session) \end{itemize} \typ{In []: \%hist}\\ \typ{In []: \%save four_plot.py} \alert{\typ{16 18-27}} @@ -511,8 +421,6 @@ \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. diff -r 3c911c958bcf -r 701585ab7eca day1/session2.tex --- a/day1/session2.tex Mon Jan 25 12:06:18 2010 +0530 +++ b/day1/session2.tex Thu Feb 04 19:36:17 2010 +0530 @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {11 January, 2010\\Day 1, Session 2} +\date[] {28 January, 2010\\Day 1, Session 2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -179,10 +179,10 @@ \begin{frame}[fragile] \frametitle{Additional Plotting Attributes} \begin{itemize} - \item \typ{'o'} - Filled circles - \item \typ{'.'} - Small Dots - \item \typ{'-'} - Lines - \item \typ{'--'} - Dashed lines + \item \kwrd{'o'} - Filled circles + \item \kwrd{'.'} - Small Dots + \item \kwrd{'-'} - Lines + \item \kwrd{'- -'} - Dashed lines \end{itemize} \end{frame} @@ -190,7 +190,7 @@ \begin{frame}[fragile] \frametitle{Lists: Introduction} \begin{lstlisting} - In []: x = [4, 2, 1, 3] + In []: x = [0, 1, 2, 3] In []: y = [7, 11, 15, 19] @@ -208,17 +208,17 @@ \end{lstlisting} \emphbar{Empty List} \begin{lstlisting} -In []: a = [ 5, 2, 3, 1, 4] +In []: a = [ 1, 2, 3, 4, 5] In []: a[0]+a[1]+a[-1] -Out[]: 11 +Out[]: 8 \end{lstlisting} \end{frame} \begin{frame}[fragile] \frametitle{List: Slicing} \begin{block}{Remember\ldots} - \kwrd{In []: a = [ 5, 2, 3, 1, 4]} + \kwrd{In []: a = [ 1, 2, 3, 4, 5]} \end{block} \begin{lstlisting} In []: a[1:3] @@ -227,7 +227,7 @@ \emphbar{A slice} \begin{lstlisting} In []: a[1:-1] -Out[]: [2, 3, 1] +Out[]: [2, 3, 4] \end{lstlisting} \alert{\typ{list[initial:final]}} \end{frame} @@ -236,15 +236,15 @@ \begin{frame}[fragile] \frametitle{List operations} \begin{lstlisting} -In []: b = [ 8, 6, 9, 9] +In []: b = [ 6, 7, 8, 9] In []: c = a + b In []: c -Out[]: [5, 2, 3, 1, 4, 8, 6, 9, 9] +Out[]: [1, 2, 3, 4, 5, 6, 7, 8, 9] In []: a.append(6) In []: a -Out[]: [5, 2, 3, 1, 4, 6] +Out[]: [ 1, 2, 3, 4, 5, 6] \end{lstlisting} %\inctime{10} \end{frame} @@ -303,23 +303,29 @@ ....: tsq.append(time*time) ....: ....: + +In []: plot(l, tsq) +Out[]: [] \end{lstlisting} -Hit the ``ENTER'' key twice to come to the previous indentation level -\begin{lstlisting} -In []: print tsq -\end{lstlisting} -\kwrd{tsq} is the list of squares of \typ{t} values. +This gives \kwrd{tsq} which is the list of squares of \typ{t} values. \end{frame} \begin{frame}[fragile] -\frametitle{Plotting $L$ vs $T^2$ \ldots} -\begin{lstlisting} -In []: plot(l, tsq) -Out[]: [] -\end{lstlisting} -This gives the required plot. + \frametitle{How to come out of the \texttt{for} loop?} + Recall that hitting the ``ENTER'' key twice returns the cursor to the previous indentation level + \begin{lstlisting} + In []: for time in t: + ....: tsq.append(time*time) + ....: + ....: + + In []: print tsq + \end{lstlisting} +\end{frame} + +\begin{frame}[fragile] \begin{figure} -\includegraphics[width=2.2in]{data/L-TSq-limited.png} +\includegraphics[width=3.5in]{data/L-TSq-limited.png} \end{figure} \end{frame} @@ -353,7 +359,7 @@ \begin{frame}[fragile] \frametitle{Plotting from \typ{pendulum.txt}} -Type the following in an editor. Save as \typ{pend\_pl.py} +Open a new script and type the following: \begin{lstlisting} l = [] t = [] @@ -365,15 +371,14 @@ for time in t: tsq.append(time*time) plot(l, tsq, '.') -show() \end{lstlisting} \end{frame} \begin{frame} \frametitle{Save and run} \begin{itemize} - \item Save as \typ{pend\_pl.py} - \item Run using \kwrd{\%run -i pend\_pl.py} + \item Save as pendulum\_plot.py. + \item Run using \kwrd{\%run -i pendulum\_plot.py} \end{itemize} \end{frame} @@ -452,7 +457,6 @@ for time in t: tsq.append(time*time) plot(l, tsq, '.') -show() \end{lstlisting} \end{frame} diff -r 3c911c958bcf -r 701585ab7eca day1/session3.tex --- a/day1/session3.tex Mon Jan 25 12:06:18 2010 +0530 +++ b/day1/session3.tex Thu Feb 04 19:36:17 2010 +0530 @@ -79,7 +79,7 @@ \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {11 January, 2010\\Day 1, Session 3} +\date[] {28 January, 2010\\Day 1, Session 3} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff -r 3c911c958bcf -r 701585ab7eca day1/session4.tex --- a/day1/session4.tex Mon Jan 25 12:06:18 2010 +0530 +++ b/day1/session4.tex Thu Feb 04 19:36:17 2010 +0530 @@ -79,7 +79,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {11 January, 2010\\Day 1, Session 4} +\date[] {28 January, 2010\\Day 1, Session 4} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff -r 3c911c958bcf -r 701585ab7eca day1/session5.tex --- a/day1/session5.tex Mon Jan 25 12:06:18 2010 +0530 +++ b/day1/session5.tex Thu Feb 04 19:36:17 2010 +0530 @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {11 January, 2010\\Day 1, Session 5} +\date[] {28 January, 2010\\Day 1, Session 5} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -127,10 +127,7 @@ point = line.split() l.append(float(point[0])) t.append(float(point[1])) -tsq = [] -for time in t: - tsq.append(time*time) -plot(l, tsq, '.') +plot(l, t, '.') \end{lstlisting} \end{block} \end{columns} diff -r 3c911c958bcf -r 701585ab7eca day1/session6.tex --- a/day1/session6.tex Mon Jan 25 12:06:18 2010 +0530 +++ b/day1/session6.tex Thu Feb 04 19:36:17 2010 +0530 @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {11 January, 2010\\Day 1, Session 6} +\date[] {28 January, 2010\\Day 1, Session 6} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff -r 3c911c958bcf -r 701585ab7eca day1/tot.tex --- a/day1/tot.tex Mon Jan 25 12:06:18 2010 +0530 +++ b/day1/tot.tex Thu Feb 04 19:36:17 2010 +0530 @@ -77,7 +77,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {28 January, 2010\\Day 1, Introduction} +\date[] {28 January, 2010\\Day 1, Tricks of the Trade} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -125,28 +125,29 @@ \begin{frame} \frametitle{Workshop Schedule: Day 1} \begin{description} - \item[Session 1] Mon 09:00--10:00 - \item[Session 2] Mon 10:05--11:05 - \item[Session 3] Mon 11:20--12:20 - \item[Session 4] Mon 12:25--13:25 - \item[Quiz 1] Mon 14:25--14:40 - \item[Exercises] Mon 14:40--15:25 - \item[Session 5] Mon 15:40--16:40 - \item[Quiz 2] Mon 16:45--17:00 + \item[Tricks of the trade] Thu 09:00--09:30 + \item[Session 1] Thu 09:30--10:30 + \item[Session 2] Thu 10:45--11:45 + \item[Session 3] Thu 11:50--12:30 + \item[Session 4] Thu 12:30--1:30 + \item[Quiz 1] Thu 14:30--14:45 + \item[Exercises] Thu 14:45--15:30 + \item[Session 5] Thu 15:45--16:45 + \item[Quiz 2] Thu 16:50--17:05 \end{description} \end{frame} \begin{frame} \frametitle{Workshop Schedule: Day 2} \begin{description} - \item[Session 1] Tue 09:00--10:00 - \item[Session 2] Tue 10:05--11:05 - \item[Session 3] Tue 11:20--12:20 - \item[Session 4] Tue 12:25--13:25 - \item[Quiz 1] Tue 14:25--14:40 - \item[Exercises] Tue 14:40--15:25 - \item[Session 5] Tue 15:40--16:40 - \item[Quiz 2] Tue 16:45--17:00 + \item[Session 1] Fri 09:00--10:00 + \item[Session 2] Fri 10:05--11:05 + \item[Session 3] Fri 11:20--12:20 + \item[Session 4] Fri 12:25--13:25 + \item[Quiz 1] Fri 14:25--14:40 + \item[Exercises] Fri 14:40--15:25 + \item[Session 5] Fri 15:40--16:40 + \item[Quiz 2] Fri 16:45--17:00 \end{description} \end{frame} @@ -155,7 +156,7 @@ \frametitle{Checklist} \begin{enumerate} \item IPython - \item Editor: We recommend \alert{scite}. + \item Editor \item Data files: \begin{itemize} \item \typ{sslc1.txt} @@ -190,13 +191,13 @@ Hello, World! \end{lstlisting} Exiting -\begin{lstlisting} +\begin{lstlisting} In []: ^D(Ctrl-D) Do you really want to exit([y]/n)? y \end{lstlisting} \end{frame} -\section{Loops - Indentation and Breaking out of loops} +\section{Loops} \begin{frame}[fragile] \frametitle{Loops} Breaking out of loops @@ -208,16 +209,60 @@ Hello, World!^C(Ctrl-C) ------------------------------------ KeyboardInterrupt +\end{lstlisting} +\end{frame} -\end{lstlisting} -\emphbar{\alert{Indentation: Notice the 4 spaces before\\} \typ{print "Hello, World!"}} +\section{Indentation} +\begin{frame}[fragile] + \frametitle{Indentation} + \begin{lstlisting} + In []: while True: + ...: print "Hello, World!" + ...: + \end{lstlisting} +\emphbar{\alert{Indentation: Notice the 4 spaces before\\} \typ{print "Hello, World!"}\\ + Hit the ``ENTER'' key twice to return to the previous indentation level} +\end{frame} + +\section{Tab Completion} +\begin{frame}[fragile] + \frametitle{Tab Completion} + Type \typ{pri} and hit the Tab key + \begin{lstlisting} + In []: pri + In []: print + \end{lstlisting} + Type \typ{whi} and hit the Tab key + \begin{lstlisting} + In []: whi + In []: while + \end{lstlisting} +\end{frame} + +\section{Tab Suggestions} +\begin{frame}[fragile] + \frametitle{Tab Suggestions} + \begin{lstlisting} +In []: a = 'Hello world' + +In []: a. + \end{lstlisting} + \ldots +\end{frame} + +\section{Command history} +\begin{frame}[fragile] + \frametitle{Command history} + \typ{In []:} \alert{$\uparrow$}\\ + \typ{In []: a = 'Hello world'}\\ + \emphbar{The previously entered commands can be browsed using the \alert{$\uparrow$} key.} \end{frame} \section{Saving Commands} \begin{frame}[fragile] \frametitle{History and Saving of Commands} \begin{itemize} -\item \typ{\%hist} gives complete history of commands in a session +\item \typ{\%hist} gives history of commands in a session \item \typ{\%save} can be used to save the commands \end{itemize} \begin{block}{Careful about errors!} @@ -233,7 +278,7 @@ \begin{itemize} \item emacs \item vim - \item scite - we recommend scite + \item \alert{scite} - we recommend it \end{itemize} \end{frame} @@ -241,9 +286,14 @@ \begin{frame}[fragile] \frametitle{Scite - How to \ldots} \begin{itemize} - \item Opening scite - run scite from command line + \item Opening scite + \begin{itemize} + \item GNU/Linux: \alert{Applications} $\rightarrow$ \alert{Programming} $\rightarrow$ \alert{SciTE Text Editor} + \item Windows: Double click on the \alert{SciTE} Desktop icon + \end{itemize} \item Type the contents \item Saving the file with a filename \alert{File $\rightarrow$ Save as} + \item Saving the file \alert{File $\rightarrow$ Save} \item Exiting the editor \alert{File $\rightarrow$ Exit} \item To open an existing file: \alert{File $\rightarrow$ Open} \end{itemize} @@ -257,6 +307,7 @@ \item Loops - Indentation and breaking out of loops \item \kwrd{\%hist} - History of commands \item \kwrd{\%save} - Saving commands + \item Using SciTE \end{itemize} \end{frame} diff -r 3c911c958bcf -r 701585ab7eca day2/session1.tex --- a/day2/session1.tex Mon Jan 25 12:06:18 2010 +0530 +++ b/day2/session1.tex Thu Feb 04 19:36:17 2010 +0530 @@ -79,7 +79,7 @@ \author[FOSSEE Team] {The FOSSEE Group} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {12 January, 2010\\Day 2, Session 1} +\date[] {29 January, 2010\\Day 2, Session 1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -255,6 +255,7 @@ \begin{frame}[fragile] \frametitle{A bit about IPython} + Recall, we showed a few features of IPython, here is one more: \begin{itemize} \item IPython provides better help \item object.function? @@ -262,10 +263,6 @@ In []: a = 'Hello World' In []: a.lower? \end{lstlisting} - \item It provides tab completion - \begin{lstlisting} -In []: a.s - \end{lstlisting} \end{itemize} \end{frame}