diff options
-rw-r--r-- | day1/session1.tex | 27 | ||||
-rw-r--r-- | day1/session2.tex | 21 |
2 files changed, 22 insertions, 26 deletions
diff --git a/day1/session1.tex b/day1/session1.tex index 11126bf..5f525ca 100644 --- a/day1/session1.tex +++ b/day1/session1.tex @@ -401,7 +401,7 @@ In []: close() Supported formats to store images: \begin{itemize} \item png -\item eps - Easy to embed in Latex files +\item eps - Easy to embed in LaTeX files \item emf \item pdf \item ps @@ -471,23 +471,16 @@ In []: annotate('local max', xy=(1.5, 1)) \end{frame} \begin{frame}[fragile] -\frametitle{Getting axes lengths} +\frametitle{Axes lengths} +\emphbar{Getting axes lengths} \begin{lstlisting} -In []: orig_xmin, orig_xmax = xlim() -In []: orig_ymin, orig_ymax = ylim() +In []: xmin, xmax = xlim() +In []: ymin, ymax = ylim() \end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Set the axes limits} +\emphbar{Set the axes limits} \begin{lstlisting} -In []: up_xmin = orig_xmin -In []: up_xmax = 2*pi -In []: up_ymin = ymin-0.2 -In []: up_ymax = ymax+0.2 - -In []: xlim(up_xmin, up_xmax) -In []: ylim(up_ymin, up_ymax) +In []: xlim(xmin, 2*pi ) +In []: ylim(ymin-0.2, ymax+0.2) \end{lstlisting} \end{frame} @@ -551,11 +544,11 @@ This displays all the commands typed in so far aka Command History. \frametitle{Saving commands into script} Use the \typ{\%save} \alert{magic} command of IPython \begin{block}{} -\typ{In []: \%save script_name line_numbers} +\typ{\%save script_name line_numbers} \end{block} Line numbers can be specified individually separated by commas or as a range separated by a dash.\\ \begin{block}{} -\typ{In []: \%save four_plot.py} \alert{\typ{16 18-27}} \\ +\typ{\%save four_plot.py} \alert{\typ{16 18-27}} \\ \end{block} This saves from the history the commands entered on line numbers \alert{16, 18, 19, 20, \ldots 27} \end{frame} diff --git a/day1/session2.tex b/day1/session2.tex index 9666fd0..9afc5b9 100644 --- a/day1/session2.tex +++ b/day1/session2.tex @@ -281,7 +281,7 @@ $L$ & $T$ & $T^2$ \\ \hline \begin{frame}[fragile] \frametitle{Lets use lists} \begin{lstlisting} -In []: l = [0.1, 0.2, 0.3, 0.4, 0.5, +In []: L = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9] In []: t = [0.69, 0.90, 1.19, @@ -309,9 +309,12 @@ In []: for time in t: ....: ....: -In []: print len(l), len(t), len(tsq) \end{lstlisting} This gives \kwrd{tsq} which is the list of squares of \typ{t} values. +\begin{lstlisting} +In []: print len(L), len(t), len(tsq) +Out[]: 9 9 9 +\end{lstlisting} \end{frame} \begin{frame}[fragile] @@ -323,7 +326,7 @@ This gives \kwrd{tsq} which is the list of squares of \typ{t} values. ....: ....: - In []: plot(l, tsq) + In []: plot(L, tsq) \end{lstlisting} \end{frame} @@ -362,16 +365,16 @@ In []: cat pendulum.txt \frametitle{Plotting from \typ{pendulum.txt}} Open a new script and type the following: \begin{lstlisting} -l = [] +L = [] t = [] for line in open('pendulum.txt'): point = line.split() - l.append(float(point[0])) + L.append(float(point[0])) t.append(float(point[1])) tsq = [] for time in t: tsq.append(time*time) -plot(l, tsq, '.') +plot(L, tsq, '.') \end{lstlisting} \end{frame} @@ -448,16 +451,16 @@ Out[]: <type 'float'> \begin{frame}[fragile] \frametitle{Let's review the code} \begin{lstlisting} -l = [] +L = [] t = [] for line in open('pendulum.txt'): point = line.split() - l.append(float(point[0])) + L.append(float(point[0])) t.append(float(point[1])) tsq = [] for time in t: tsq.append(time*time) -plot(l, tsq, '.') +plot(L, tsq, '.') \end{lstlisting} \end{frame} |