summaryrefslogtreecommitdiff
path: root/day1
diff options
context:
space:
mode:
authorPuneeth Chaganti2009-10-26 19:48:59 +0530
committerPuneeth Chaganti2009-10-26 19:48:59 +0530
commita8ae4a30e6cafcc67d6430a4f927f7eb0d06c3ef (patch)
treee256843a1ce092872deb022831b1c84fff83cec9 /day1
parent7d91a5b7f63408d4ce9bba97cf3fda5380ad51e8 (diff)
parent08fd91c3a013634ecb9e93bcdbcb879d03d8fdbe (diff)
downloadworkshops-more-scipy-a8ae4a30e6cafcc67d6430a4f927f7eb0d06c3ef.tar.gz
workshops-more-scipy-a8ae4a30e6cafcc67d6430a4f927f7eb0d06c3ef.tar.bz2
workshops-more-scipy-a8ae4a30e6cafcc67d6430a4f927f7eb0d06c3ef.zip
Merged with mainline.
Diffstat (limited to 'day1')
-rw-r--r--day1/data/position.pngbin0 -> 28574 bytes
-rw-r--r--day1/session1.tex46
-rw-r--r--day1/session3.tex29
3 files changed, 45 insertions, 30 deletions
diff --git a/day1/data/position.png b/day1/data/position.png
new file mode 100644
index 0000000..f4108bc
--- /dev/null
+++ b/day1/data/position.png
Binary files differ
diff --git a/day1/session1.tex b/day1/session1.tex
index 3e12da9..8eb1226 100644
--- a/day1/session1.tex
+++ b/day1/session1.tex
@@ -215,11 +215,13 @@ In []: ylabel('sin(x)')
\frametitle{Another example}
\begin{lstlisting}
In []: clf()
+#Clears the plot area.
In []: y = linspace(0, 2*pi, 51)
In []: plot(y, sin(2*y))
In []: xlabel('y')
In []: ylabel('sin(2y)')
\end{lstlisting}
+\emphbar{By default plots would be overlayed!}
\end{frame}
\begin{frame}[fragile]
@@ -231,7 +233,6 @@ In []: ylabel('sin(2y)')
In []: title('Sinusoids')
#Sets the title of the figure
In []: legend(['sin(2y)'])
-# When no label, or to change
\end{lstlisting}
% \small
% \end{block}
@@ -243,30 +244,17 @@ In []: legend(['sin(2y)'])
\begin{frame}[fragile]
\frametitle{Changing Legend Placement}
-\vspace*{-0.1in}
-\begin{lstlisting}
-In []: legend(['sin(2y)'], loc=(.8,.1))
-#(x,y) is position of lower-left
-#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}
\begin{columns}
\column{0.6\textwidth}
\begin{block}{}
\small
\begin{lstlisting}
In []: legend(['sin(2y)'],
- loc='right')
+ loc='center')
\end{lstlisting}
\small
\end{block}
+ \includegraphics[height=2in, interpolate=true]{data/position}
\column{0.45\textwidth}
\vspace{-0.2in}
\begin{lstlisting}
@@ -287,6 +275,19 @@ Location String
\end{columns}
\end{frame}
+\begin{frame}[fragile]
+\frametitle{For placing legend at $(x,y)$}
+\vspace*{-0.1in}
+\begin{lstlisting}
+In []: legend(['sin(2y)'], loc=(.8,.1))
+#(x,y) is position of lower-left
+#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{Saving \& Closing}
@@ -298,7 +299,7 @@ In []: close()
\end{frame}
\begin{frame}[fragile]
-\frametitle{Multiple Figures}
+\frametitle{Plotting seprate figures}
\begin{lstlisting}
In []: figure(1)
In []: plot(y, sin(y))
@@ -359,7 +360,7 @@ In []: ylim(ymin, ymax)
\begin{frame}[fragile]
\frametitle{Review Problem}
\begin{enumerate}
-\item Plot x, -x, sin(x), xsin(x) in the range $-5\pi$ to $5\pi$
+\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
@@ -392,7 +393,14 @@ In []: ylim(5*pi, 5*pi)
\end{lstlisting}
}
\end{frame}
-
+\begin{frame}
+ \frametitle{Things we have learned}
+ \begin{itemize}
+ \item Creating plots.
+ \item Handling labels and legends.
+ \item Changing properties of plot.
+ \end{itemize}
+\end{frame}
\begin{frame}[fragile]
\begin{center}
End of Session-1\\
diff --git a/day1/session3.tex b/day1/session3.tex
index 47921f1..997fea3 100644
--- a/day1/session3.tex
+++ b/day1/session3.tex
@@ -311,8 +311,8 @@ data = {} # is an empty dictionary
\item In this problem let the value of a \emph{key} be another dictionary.
\item This dictionary contains:
\begin{itemize}
- \item 'marks': A \emph{list} of NumPy arrays
- \item 'total': Total marks of each student
+ \item 'marks': A \emph{List} of \emph{Lists} containing all marks
+ \item 'total': A \emph{List} of total marks of each student
\item 'P': Number of passes
\item 'F': Number of failures
\item 'W': Number of withdrawls
@@ -362,11 +362,6 @@ total = 0 if score_str == 'AA'
or score_str == ''
else int(fields[8])
data[fields[0]]['total'].append(total)
-
-pfw_key = fields[9]
- or fields[10]
- or 'F'
-data[fields[0]][pfw_key] += 1
\end{lstlisting}
\end{frame}
@@ -381,13 +376,25 @@ data[fields[0]][pfw_key] += 1
\end{frame}
\begin{frame}[fragile]
+ \frametitle{NumPy arrays}
+ \centerline{\alert{But I lied!?!?!?}}
+\end{frame}
+
+\begin{frame}[fragile]
\frametitle{Calculations}
- \small
\begin{lstlisting}
for k in data:
- data[k]['marks'] = array(data[k]['marks'])
- data[k]['total'] = array(data[k]['total'])
+ data[k]['marks'] = array(
+ data[k]['marks'])
+ data[k]['total'] = array(
+ data[k]['total'])
+ \end{lstlisting}
+\end{frame}
+\begin{frame}[fragile]
+ \frametitle{Calculations}
+ \small
+ \begin{lstlisting}
data[k]['avg'] = average(
data[k]['total'])
marks = data[k]['marks']
@@ -408,7 +415,7 @@ for k in data:
\item New type of conditional
\item NumPy arrays
\item Slicing NumPy arrays
- \item NumPy array operations - square, average, sqrt
+ \item NumPy array functions - square, average, sqrt
\end{itemize}
\end{frame}