summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShantanu2009-10-31 01:33:12 +0530
committerShantanu2009-10-31 01:33:12 +0530
commitd55d50cdba2ec3288c47de8b35119dd84f382948 (patch)
tree54141e7718f5682c02ffe53c352ceb575f2f3434
parent42d39e2b87ac0fa94de65d82888b4a8688b46298 (diff)
downloadworkshops-more-scipy-d55d50cdba2ec3288c47de8b35119dd84f382948.tar.gz
workshops-more-scipy-d55d50cdba2ec3288c47de8b35119dd84f382948.tar.bz2
workshops-more-scipy-d55d50cdba2ec3288c47de8b35119dd84f382948.zip
1 quiz, seesion5 plots, added links to reference.
-rw-r--r--day1/data/missing_points.pngbin0 -> 15363 bytes
-rw-r--r--day1/links.tex5
-rw-r--r--day1/session5.tex9
-rw-r--r--day1quiz1.tex150
-rw-r--r--day1quiz2.tex178
-rw-r--r--day2quiz2.tex178
6 files changed, 517 insertions, 3 deletions
diff --git a/day1/data/missing_points.png b/day1/data/missing_points.png
new file mode 100644
index 0000000..ff74050
--- /dev/null
+++ b/day1/data/missing_points.png
Binary files differ
diff --git a/day1/links.tex b/day1/links.tex
index 7734d47..c820d22 100644
--- a/day1/links.tex
+++ b/day1/links.tex
@@ -1,6 +1,7 @@
\documentclass[12pt]{article}
\title{Links and References}
-\author{Asokan Pichai\\Prabhu Ramachandran}
+\author{FOSSEE}
+\date{}
\begin{document}
\maketitle
\begin{itemize}
@@ -8,7 +9,9 @@
\item ``may be one of the thinnest programming language books on my shelf, but it's also one of the best.'' -- \emph{Slashdot, AccordianGuy, September 8, 2004}- available at \url{http://diveintopython.org/}
\item How to Think Like a Computer Scientist: Learning with Python available at \url{http://www.openbookproject.net/thinkcs/python/english/}\\``The concepts covered here apply to all programming languages and to problem solving in general.'' -- \emph{Guido van Rossum, creator of Python}
\item Some assorted articles related to Python \url{http://effbot.org/zone/index.htm}
+ \item Reference manual to describe the standard libraries that are distributed with Python is available at \url{http://docs.python.org/library/}
\item To read more on strings refer to: \\ \url{http://docs.python.org/library/stdtypes.html#string-methods}
+ \item Some coding conventions for using Python language are available at \\ \url{http://www.python.org/dev/peps/pep-0008/}
\item For documentation on IPython refer: \\ \url{http://ipython.scipy.org/moin/Documentation}
\item Documentation for Numpy and Scipy is available at: \url{http://docs.scipy.org/doc/}
\item For "recipes" or worked examples of commonly-done tasks in SciPy explore: \url{http://www.scipy.org/Cookbook/}
diff --git a/day1/session5.tex b/day1/session5.tex
index ac1d8b6..46dcd54 100644
--- a/day1/session5.tex
+++ b/day1/session5.tex
@@ -146,14 +146,13 @@ In []: T = data[:,1]
\section{Interpolation}
\begin{frame}[fragile]
-\frametitle{Interpolation}
+\frametitle{Loading data (revisited)}
\begin{itemize}
\item Given data file \typ{points.txt}.
\item It contains x,y position of particle.
\item Plot the given points.
%% \item Interpolate the missing region.
\end{itemize}
-\emphbar{Loading data (revisited)}
\begin{lstlisting}
In []: data = loadtxt('points.txt')
In []: data.shape
@@ -164,6 +163,12 @@ In []: plot(x, y, '.')
\end{lstlisting}
\end{frame}
+\begin{frame}
+ \frametitle{Plot}
+ \begin{center}
+ \includegraphics[height=2in, interpolate=true]{data/missing_points}
+ \end{center}
+\end{frame}
%% \begin{frame}[fragile]
%% \frametitle{Interpolation \ldots}
%% \begin{small}
diff --git a/day1quiz1.tex b/day1quiz1.tex
new file mode 100644
index 0000000..ea15d9d
--- /dev/null
+++ b/day1quiz1.tex
@@ -0,0 +1,150 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Tutorial slides on Python.
+%
+% Author: FOSSEE <info at fossee dot in>
+% Copyright (c) 2005-2009, FOSSEE Team
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\documentclass[14pt,compress]{beamer}
+
+\mode<presentation>
+{
+ \useoutertheme{split}
+ \setbeamercovered{transparent}
+}
+
+\definecolor{darkgreen}{rgb}{0,0.5,0}
+
+\usepackage{listings}
+\lstset{language=Python,
+ basicstyle=\ttfamily\bfseries,
+ commentstyle=\color{red}\itshape,
+ stringstyle=\color{darkgreen},
+ showstringspaces=false,
+ keywordstyle=\color{blue}\bfseries}
+
+\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Macros
+
+\newcounter{qno}
+\setcounter{qno}{0}
+\newcommand{\incqno}{\addtocounter{qno}{1}{Question \theqno}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Title page
+\title[Basic Python]{Python: Quiz}
+
+\author[FOSSEE Team] {FOSSEE}
+
+\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\date[] {31, October 2009\\Day 1, Quiz 1}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\begin{document}
+
+\begin{frame}
+ \titlepage
+\end{frame}
+
+\begin{frame}
+ \frametitle{Write your details...}
+On the top right hand corner please write down the following:
+ \begin{itemize}
+ \item Name:
+ \item Affliation:
+ \item Occupation:
+ \end{itemize}
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ A sample line from a Comma Separated Values (CSV) file:\\
+ \vspace*{0.2in}
+ \emph{Rossum, Guido, 42, 56, 34, 54}\\
+ \vspace*{0.2in}
+ What method would you use to separate the line into fields?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ \begin{lstlisting}
+ In [1]: a = [1, 2, 5, 9]
+ In [2]: a[:-1]
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+ How do you combine the two lists \emph{a} and \emph{b}?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ \begin{lstlisting}
+ In [1]: d = {
+ 'a': 1,
+ 'b': 2
+ }
+ In [2]: print d['c']
+ \end{lstlisting}
+ What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+ \begin{lstlisting}
+ for x in "abcd":
+ print x
+
+ a
+ b
+ c
+ d
+ \end{lstlisting}
+ How do you get the following output?
+ \begin{lstlisting}
+ 0 a
+ 1 b
+ 2 c
+ 3 d
+ \end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the result?
+\begin{lstlisting}
+ In [1]: x
+ array([[0, 1, 2],
+ [3, 4, 5],
+ [6, 7, 8]])
+ In [2]: x[::-1,:]
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+How to read and print each line of file.
+\end{frame}
+
+\begin{frame}
+\frametitle{\incqno }
+How to get list of third column of a data file.
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What is the output of:
+\begin{lstlisting}
+In []: x=linspace(0 , 2 * pi)
+In []: plot(x, cos(x),'go')
+\end{lstlisting}
+\end{frame}
+
+\end{document}
+
diff --git a/day1quiz2.tex b/day1quiz2.tex
new file mode 100644
index 0000000..7b65c87
--- /dev/null
+++ b/day1quiz2.tex
@@ -0,0 +1,178 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Tutorial slides on Python.
+%
+% Author: FOSSEE <info at fossee dot in>
+% Copyright (c) 2005-2009, FOSSEE Team
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\documentclass[14pt,compress]{beamer}
+
+\mode<presentation>
+{
+ \useoutertheme{split}
+ \setbeamercovered{transparent}
+}
+
+\definecolor{darkgreen}{rgb}{0,0.5,0}
+
+\usepackage{listings}
+\lstset{language=Python,
+ basicstyle=\ttfamily\bfseries,
+ commentstyle=\color{red}\itshape,
+ stringstyle=\color{darkgreen},
+ showstringspaces=false,
+ keywordstyle=\color{blue}\bfseries}
+
+\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Macros
+
+\newcounter{qno}
+\setcounter{qno}{0}
+\newcommand{\incqno}{\addtocounter{qno}{1}{Question \theqno}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Title page
+\title[Basic Python]{Python: Quiz}
+
+\author[FOSSEE Team] {FOSSEE}
+
+\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\date[] {11, October 2009\\Day 2}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\begin{document}
+
+\begin{frame}
+ \titlepage
+\end{frame}
+
+\begin{frame}
+ \frametitle{Write your details...}
+On the top right hand corner please write down the following:
+ \begin{itemize}
+ \item Name:
+ \item Affliation:
+ \item Occupation:
+ \end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x = array([[1,2,3,4],[3,4,2,5]])
+ >>> x.shape
+ (2, 4)
+\end{lstlisting}
+Change the shape of \lstinline+x+ to (4,2)
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x = array([[1,2,3,4]])
+\end{lstlisting}
+How to change the third element of \lstinline+x+ to 0?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the result?
+\begin{lstlisting}
+ >>> y = arange(3)
+ >>> x = linspace(0,3,3)
+ >>> x-y
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x = array([0, 1, 2, 3])
+ >>> x.shape = 2,2
+ >>> x
+ array([[0, 1],
+ [2, 3]])
+ >>> x[::2,::2]
+\end{lstlisting}
+What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the result?
+\begin{lstlisting}
+ >>> x
+ array([[0, 1, 2],
+ [3, 4, 5],
+ [6, 7, 8]])
+ >>> x[::-1,:]
+\end{lstlisting}
+Hint:
+\begin{lstlisting}
+ >>> x = arange(9)
+ >>> x[::-1]
+ array([8, 7, 6, 5, 4, 3, 2, 1, 0])
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x
+ array([[ 0, 1, 2, 3],
+ [ 4, 5, 6, 7],
+ [ 8, 9, 10, 11],
+ [12, 13, 14, 15]])
+\end{lstlisting}
+How will you get the following \lstinline+x+?
+\begin{lstlisting}
+ array([[ 5, 7],
+ [ 9, 11]])
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x = array(([1,2,3,4],[2,3,4,5]))
+ >>> x[-2][-3] = 4
+ >>> x
+\end{lstlisting}
+What will be printed?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the output?
+\begin{lstlisting}
+ >>> y = arange(4)
+ >>> x = array(([1,2,3,2],[1,3,6,0]))
+ >>> x + y
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> line = plot(x, sin(x))
+\end{lstlisting}
+Use the \lstinline+set_linewidth+ method to set width of \lstinline+line+ to 2.
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the output?
+\begin{lstlisting}
+ >>> x = arange(9)
+ >>> y = arange(9.)
+ >>> x == y
+\end{lstlisting}
+\end{frame}
+
+
+\end{document}
+
diff --git a/day2quiz2.tex b/day2quiz2.tex
new file mode 100644
index 0000000..7b65c87
--- /dev/null
+++ b/day2quiz2.tex
@@ -0,0 +1,178 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Tutorial slides on Python.
+%
+% Author: FOSSEE <info at fossee dot in>
+% Copyright (c) 2005-2009, FOSSEE Team
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\documentclass[14pt,compress]{beamer}
+
+\mode<presentation>
+{
+ \useoutertheme{split}
+ \setbeamercovered{transparent}
+}
+
+\definecolor{darkgreen}{rgb}{0,0.5,0}
+
+\usepackage{listings}
+\lstset{language=Python,
+ basicstyle=\ttfamily\bfseries,
+ commentstyle=\color{red}\itshape,
+ stringstyle=\color{darkgreen},
+ showstringspaces=false,
+ keywordstyle=\color{blue}\bfseries}
+
+\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Macros
+
+\newcounter{qno}
+\setcounter{qno}{0}
+\newcommand{\incqno}{\addtocounter{qno}{1}{Question \theqno}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Title page
+\title[Basic Python]{Python: Quiz}
+
+\author[FOSSEE Team] {FOSSEE}
+
+\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\date[] {11, October 2009\\Day 2}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\begin{document}
+
+\begin{frame}
+ \titlepage
+\end{frame}
+
+\begin{frame}
+ \frametitle{Write your details...}
+On the top right hand corner please write down the following:
+ \begin{itemize}
+ \item Name:
+ \item Affliation:
+ \item Occupation:
+ \end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x = array([[1,2,3,4],[3,4,2,5]])
+ >>> x.shape
+ (2, 4)
+\end{lstlisting}
+Change the shape of \lstinline+x+ to (4,2)
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x = array([[1,2,3,4]])
+\end{lstlisting}
+How to change the third element of \lstinline+x+ to 0?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the result?
+\begin{lstlisting}
+ >>> y = arange(3)
+ >>> x = linspace(0,3,3)
+ >>> x-y
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x = array([0, 1, 2, 3])
+ >>> x.shape = 2,2
+ >>> x
+ array([[0, 1],
+ [2, 3]])
+ >>> x[::2,::2]
+\end{lstlisting}
+What is the output?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the result?
+\begin{lstlisting}
+ >>> x
+ array([[0, 1, 2],
+ [3, 4, 5],
+ [6, 7, 8]])
+ >>> x[::-1,:]
+\end{lstlisting}
+Hint:
+\begin{lstlisting}
+ >>> x = arange(9)
+ >>> x[::-1]
+ array([8, 7, 6, 5, 4, 3, 2, 1, 0])
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x
+ array([[ 0, 1, 2, 3],
+ [ 4, 5, 6, 7],
+ [ 8, 9, 10, 11],
+ [12, 13, 14, 15]])
+\end{lstlisting}
+How will you get the following \lstinline+x+?
+\begin{lstlisting}
+ array([[ 5, 7],
+ [ 9, 11]])
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> x = array(([1,2,3,4],[2,3,4,5]))
+ >>> x[-2][-3] = 4
+ >>> x
+\end{lstlisting}
+What will be printed?
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the output?
+\begin{lstlisting}
+ >>> y = arange(4)
+ >>> x = array(([1,2,3,2],[1,3,6,0]))
+ >>> x + y
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+\begin{lstlisting}
+ >>> line = plot(x, sin(x))
+\end{lstlisting}
+Use the \lstinline+set_linewidth+ method to set width of \lstinline+line+ to 2.
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\incqno }
+What would be the output?
+\begin{lstlisting}
+ >>> x = arange(9)
+ >>> y = arange(9.)
+ >>> x == y
+\end{lstlisting}
+\end{frame}
+
+
+\end{document}
+