summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantosh G. Vattam2009-10-23 11:48:55 +0530
committerSantosh G. Vattam2009-10-23 11:48:55 +0530
commita363678a9bee3d69bc603090b40b70154960764e (patch)
tree2e7b3d84ee1252427332daf845b303889a369358
parentf96d9e1a22b947ba35be4bf25b209f8e99cce75c (diff)
parente6c0777ddbd94285b6c342dcd929af4177e5f04d (diff)
downloadworkshops-more-scipy-a363678a9bee3d69bc603090b40b70154960764e.tar.gz
workshops-more-scipy-a363678a9bee3d69bc603090b40b70154960764e.tar.bz2
workshops-more-scipy-a363678a9bee3d69bc603090b40b70154960764e.zip
Merged branches.
-rw-r--r--day1/data/annotate.pngbin0 -> 30194 bytes
-rw-r--r--day1/data/firstplot.pngbin0 -> 24217 bytes
-rw-r--r--day1/data/green.pngbin0 -> 26880 bytes
-rw-r--r--day1/data/label.pngbin0 -> 25676 bytes
-rw-r--r--day1/data/legend.pngbin0 -> 33003 bytes
-rw-r--r--day1/data/loc.pngbin0 -> 32773 bytes
-rw-r--r--day1/data/title.pngbin0 -> 28516 bytes
-rw-r--r--day1/session1.tex184
-rw-r--r--day1/session2.tex6
-rw-r--r--day1/session3.tex8
-rw-r--r--day1/session4.tex6
-rw-r--r--day1/session6.tex8
-rw-r--r--day2/session1.tex12
13 files changed, 147 insertions, 77 deletions
diff --git a/day1/data/annotate.png b/day1/data/annotate.png
new file mode 100644
index 0000000..a9f9a04
--- /dev/null
+++ b/day1/data/annotate.png
Binary files differ
diff --git a/day1/data/firstplot.png b/day1/data/firstplot.png
new file mode 100644
index 0000000..4761cb0
--- /dev/null
+++ b/day1/data/firstplot.png
Binary files differ
diff --git a/day1/data/green.png b/day1/data/green.png
new file mode 100644
index 0000000..2d3937e
--- /dev/null
+++ b/day1/data/green.png
Binary files differ
diff --git a/day1/data/label.png b/day1/data/label.png
new file mode 100644
index 0000000..4d7ebac
--- /dev/null
+++ b/day1/data/label.png
Binary files differ
diff --git a/day1/data/legend.png b/day1/data/legend.png
new file mode 100644
index 0000000..9d28a71
--- /dev/null
+++ b/day1/data/legend.png
Binary files differ
diff --git a/day1/data/loc.png b/day1/data/loc.png
new file mode 100644
index 0000000..30c8f56
--- /dev/null
+++ b/day1/data/loc.png
Binary files differ
diff --git a/day1/data/title.png b/day1/data/title.png
new file mode 100644
index 0000000..cbb588d
--- /dev/null
+++ b/day1/data/title.png
Binary files differ
diff --git a/day1/session1.tex b/day1/session1.tex
index 7fac9b9..880e8b2 100644
--- a/day1/session1.tex
+++ b/day1/session1.tex
@@ -1,8 +1,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Tutorial slides on Python.
+%Tutorial slides on Python.
%
-% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
-% Copyright (c) 2005-2009, Prabhu Ramachandran
+% Author: FOSSEE
+% Copyright (c) 2009, FOSSEE, IIT Bombay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[14pt,compress]{beamer}
@@ -125,51 +125,90 @@
\begin{frame}[fragile]
\frametitle{Starting up...}
+\begin{block}{}
\begin{verbatim}
$ ipython -pylab
\end{verbatim}
-Exiting
+\end{block}
\begin{lstlisting}
In []: print "Hello, World!"
- In []: ^D
- Do you really want to exit ([y]/n)? y
+ 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
+ Hello, World!^C(Ctrl-C)
+ ------------------------------------
+ KeyboardInterrupt
+
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{First Plot}
+\begin{columns}
+ \column{0.25\textwidth}
+ \hspace*{-0.5in}
+ \includegraphics[height=2in, interpolate=true]{data/firstplot}
+ \column{0.8\textwidth}
+ \begin{block}{}
+ \small
\begin{lstlisting}
- In []: x = linspace(0, 2*pi, 51)
+In []: x = linspace(0, 2*pi, 51)
+In []: plot(x, sin(x))
\end{lstlisting}
-\typ{linspace(start, stop, num)} \\
-returns \typ{num} evenly spaced points, in the interval [\typ{start}, \typ{stop}].
-\begin{lstlisting}
+ \small
+ \end{block}
+\end{columns}
+\end{frame}
- In []: plot(x,sin(x))
-\end{lstlisting}
-\typ{plot(x, y)}\\
+
+\begin{frame}[fragile]
+\frametitle{Walkthrough}
+\begin{block}{\typ{linspace(start, stop, num)} }
+returns \typ{num} evenly spaced points, in the interval [\typ{start}, \typ{stop}].
+\end{block}
+\vspace*{.5in}
+\begin{block}{\typ{plot(x, y)}}
plots \typ{x} and \typ{y} using default line style and color
+\end{block}
\end{frame}
\begin{frame}[fragile]
\frametitle{Adding Labels}
+\begin{columns}
+ \column{0.25\textwidth}
+ \hspace*{-0.45in}
+ \includegraphics[height=2in, interpolate=true]{data/label}
+ \hspace*{0.5in}
+ \column{0.55\textwidth}
+ \begin{block}{}
+ \small
\begin{lstlisting}
In []: xlabel('x')
- \end{lstlisting}
-\typ{xlabel(s)} sets the label of the \typ{x}-axis to \typ{s}
- \begin{lstlisting}
In []: ylabel('sin(x)')
\end{lstlisting}
-\typ{ylabel(s)} sets the label of the \typ{y}-axis to \typ{s}
+ \small
+% \end{lstlisting}
+%\typ{xlabel(s)} sets the label of the \typ{x}-axis to \typ{s}
+
+% \begin{lstlisting}
+ \end{block}
+%\typ{ylabel(s)} sets the label of the \typ{y}-axis to \typ{s}
+\end{columns}
\end{frame}
\begin{frame}[fragile]
@@ -177,58 +216,75 @@ In []: ylabel('sin(x)')
\begin{lstlisting}
In []: clf()
In []: y = linspace(0, 2*pi, 51)
-In []: plot(y, -2*sin(-y))
+In []: plot(y, sin(2*y))
In []: xlabel('y')
-In []: ylabel('-2sin(-y)')
+In []: ylabel('sin(2y)')
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Title and Legends}
+\vspace*{-0.15in}
+% \begin{block}{}
+% \small
\begin{lstlisting}
In []: title('Sinusoids')
#Sets the title of the figure
-
-In []: legend()
-# When plot made with label
-# plot(y, -2*sin(-y), label='sin')
-In []: legend(['sin'])
+In []: legend(['sin(2y)'])
# When no label, or to change
-
\end{lstlisting}
+% \small
+% \end{block}
+ \vspace*{-0.1in}
+ \begin{center}
+ \includegraphics[height=2in, interpolate=true]{data/legend}
+ \end{center}
\end{frame}
\begin{frame}[fragile]
\frametitle{Changing Legend Placement}
+\vspace*{-0.1in}
\begin{lstlisting}
-In []: legend(['sin'], loc=5)
-#or
-In []: legend(['sin'], loc='right')
-#or
-In []: legend(['sin'], loc=(x,y))
+In []: legend(['sin(2y)'], loc=(.8,.1))
#(x,y) is position of lower-left
-#corner of legend in the axes co-ords
+#corner of legend box.
\end{lstlisting}
+%\vspace*{-0.2in}
+\begin{center}
+ \includegraphics[height=2in, interpolate=true]{data/loc}
+\end{center}
\end{frame}
\begin{frame}[fragile]
\frametitle{Changing Legend Placement}
-\vspace{-0.15in}
+\begin{columns}
+ \column{0.6\textwidth}
+\begin{block}{}
+ \small
\begin{lstlisting}
-Location String Code
-=============== ====
-'best' 0
-'upper right' 1
-'upper left' 2
-'lower left' 3
-'lower right' 4
-'right' 5
-'center left' 6
-'center right' 7
-'lower center' 8
-'upper center' 9
-'center' 10
+In []: legend(['sin(2y)'],
+ loc='right')
\end{lstlisting}
+ \small
+\end{block}
+\column{0.45\textwidth}
+\vspace{-0.2in}
+\begin{lstlisting}
+Location String
+===============
+'best'
+'upper right'
+'upper left'
+'lower left'
+'lower right'
+'right'
+'center left'
+'center right'
+'lower center'
+'upper center'
+'center'
+\end{lstlisting}
+\end{columns}
\end{frame}
@@ -245,33 +301,45 @@ In []: close()
\frametitle{Multiple Figures}
\begin{lstlisting}
In []: figure(1)
-In []: plot(x, sin(x))
+In []: plot(y, sin(y))
In []: figure(2)
-In []: plot(x, cos(x))
+In []: plot(y, cos(y))
In []: figure(1)
-In []: title('sin(x)'))
+In []: title('sin(y)')
+In []: close()
+In []: close()
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Showing it better}
+\vspace{-0.15in}
\begin{lstlisting}
In []: plot(y, sin(y), 'g')
-# plots the curve using green color
+In []: clf()
In []: plot(y, sin(y), linewidth=2)
-# sets the linewidth to 2
\end{lstlisting}
+\vspace*{-0.2in}
+\begin{center}
+ \includegraphics[height=2.2in, interpolate=true]{data/green}
+\end{center}
\end{frame}
\begin{frame}[fragile]
\frametitle{Annotating}
+\vspace*{-0.15in}
\begin{lstlisting}
-In []: annotate('Sample point',
- (50,200))
-# Adds the note 'Sample point' at
-# the point (50, 200)
+In []: annotate('local max',
+ xy=(1.5, 1),
+ xytext=(2.5, .8),
+ arrowprops=dict(
+ shrink=0.05),)
\end{lstlisting}
+\vspace*{-0.2in}
+\begin{center}
+ \includegraphics[height=2in, interpolate=true]{data/annotate}
+\end{center}
\end{frame}
\begin{frame}[fragile]
@@ -281,9 +349,10 @@ In []: annotate('Sample point',
In []: xmin, xmax = xlim()
In []: ymin, ymax = ylim()
+In []: xmax = 2*pi
#Set the axes limits
-In []: xlim( xmin, xmax )
-In []: ylim( ymin, ymax )
+In []: xlim(xmin, xmax)
+In []: ylim(ymin, ymax)
\end{lstlisting}
\end{frame}
@@ -295,3 +364,4 @@ In []: ylim( ymin, ymax )
\end{frame}
\end{document}
+
diff --git a/day1/session2.tex b/day1/session2.tex
index c5d926d..9e0149c 100644
--- a/day1/session2.tex
+++ b/day1/session2.tex
@@ -1,8 +1,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Tutorial slides on Python.
%
-% Author: The FOSSEE Group
-% Copyright (c) 2009, The FOSSEE Group, IIT Bombay
+% Author: FOSSEE
+% Copyright (c) 2009, FOSSEE, IIT Bombay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[14pt,compress]{beamer}
@@ -75,7 +75,7 @@
% Title page
\title[Plotting using Python]{Plotting experimental data\\}
-\author[FOSEE Team] {The FOSSEE Group}
+\author[FOSSEE] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
\date[] {31, October 2009\\Day 1, Session 2}
diff --git a/day1/session3.tex b/day1/session3.tex
index 7168f72..5f03d41 100644
--- a/day1/session3.tex
+++ b/day1/session3.tex
@@ -1,8 +1,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Tutorial slides on Python.
+%Tutorial slides on Python.
%
-% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
-% Copyright (c) 2005-2009, Prabhu Ramachandran
+% Author: FOSSEE
+% Copyright (c) 2009, FOSSEE, IIT Bombay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[14pt,compress]{beamer}
@@ -174,7 +174,7 @@ We now have two lists L and T
\item Instead, we use arrays
\end{itemize}
\begin{lstlisting}
-In []: array(L)
+In []: L = array(L)
In []: T = array(T)
In []: Tsq = T*T
In []: plot(L, Tsq, 'o')
diff --git a/day1/session4.tex b/day1/session4.tex
index 08f4242..c01c20e 100644
--- a/day1/session4.tex
+++ b/day1/session4.tex
@@ -1,8 +1,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Tutorial slides on Python.
%
-% Author: The FOSSEE Group
-% Copyright (c) 2009, The FOSSEE Group, IIT Bombay
+% Author: FOSSEE
+% Copyright (c) 2009, FOSSEE, IIT Bombay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[14pt,compress]{beamer}
@@ -76,7 +76,7 @@
% Title page
\title[Basic Python]{Matrices, Solution of equations and Integration\\}
-\author[FOSEE Team] {The FOSSEE Group}
+\author[FOSSEE] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
\date[] {31, October 2009\\Day 1, Session 4}
diff --git a/day1/session6.tex b/day1/session6.tex
index adc24ff..1fed5d3 100644
--- a/day1/session6.tex
+++ b/day1/session6.tex
@@ -1,8 +1,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Tutorial slides on Python.
+%Tutorial slides on Python.
%
-% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
-% Copyright (c) 2005-2009, Prabhu Ramachandran
+% Author: FOSSEE
+% Copyright (c) 2009, FOSSEE, IIT Bombay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[14pt,compress]{beamer}
@@ -197,7 +197,7 @@
\begin{frame}[fragile]
\frametitle{Bisection Method}
\begin{enumerate}
-\item Start with an interval $(a, b)$ within wphich a root exists
+\item Start with an interval $(a, b)$ within which a root exists
\item $f(a)\cdot f(b) < 0$
\item Bisect the interval. $c = \frac{a+b}{2}$
\item Change the interval to $(a, c)$ if $f(a)\cdot f(c) < 0$
diff --git a/day2/session1.tex b/day2/session1.tex
index f51ce54..e77e6df 100644
--- a/day2/session1.tex
+++ b/day2/session1.tex
@@ -343,11 +343,11 @@ Out[]: [8, 7, 6, 5, 4, 3, 2, 1]
In []: lst.extend([0, -1, -2])
In []: lst
-Out[]: [8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2]
+Out[]: [8, 7, 6, 5, 4, 3, 2, 1, 0, -1]
In []: lst.remove(0)
In []: lst
-Out[]: [8, 7, 6, 5, 4, 3, 2, 1, -1, -2]
+Out[]: [8, 7, 6, 5, 4, 3, 2, 1, -1]
\end{lstlisting}
\end{frame}
@@ -392,16 +392,16 @@ Out[]: 13
\frametitle{Dictionaries}
\alert {lists and tuples: integer indexes :: dictionaries: string indexes}
\begin{lstlisting}
-In []: player = {'Mat': 134, 'Inn': 233, 'Runs': 10823, 'Avg': 52.53}
+In []: player = {'Mat': 134,'Inn': 233,
+ 'Runs': 10823, 'Avg': 52.53}
In []: player['Avg']
Out[]: 52.530000000000001
-
In []: player.keys()
Out[]: ['Runs', 'Inn', 'Avg', 'Mat']
-
In []: player.values()
-Out[]: [10823, 233, 52.530000000000001, 134]
+Out[]: [10823, 233,
+ 52.530000000000001, 134]
\end{lstlisting}
\end{frame}