|
1 % Created 2010-10-10 Sun 17:30 |
|
2 \documentclass[presentation]{beamer} |
|
3 \usepackage[latin1]{inputenc} |
|
4 \usepackage[T1]{fontenc} |
|
5 \usepackage{fixltx2e} |
|
6 \usepackage{graphicx} |
|
7 \usepackage{longtable} |
|
8 \usepackage{float} |
|
9 \usepackage{wrapfig} |
|
10 \usepackage{soul} |
|
11 \usepackage{textcomp} |
|
12 \usepackage{marvosym} |
|
13 \usepackage{wasysym} |
|
14 \usepackage{latexsym} |
|
15 \usepackage{amssymb} |
|
16 \usepackage{hyperref} |
|
17 \tolerance=1000 |
|
18 \usepackage[english]{babel} \usepackage{ae,aecompl} |
|
19 \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} |
|
20 \usepackage{listings} |
|
21 \lstset{language=Python, basicstyle=\ttfamily\bfseries, |
|
22 commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, |
|
23 showstringspaces=false, keywordstyle=\color{blue}\bfseries} |
|
24 \providecommand{\alert}[1]{\textbf{#1}} |
|
25 |
|
26 \title{Additional Features of \texttt{ipython}} |
|
27 \author{FOSSEE} |
|
28 \date{} |
|
29 |
|
30 \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} |
|
31 \begin{document} |
|
32 |
|
33 \maketitle |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 \begin{frame} |
|
45 \frametitle{Outline} |
|
46 \label{sec-1} |
|
47 |
|
48 \begin{itemize} |
|
49 \item Retrieving ipython history |
|
50 \item Viewing a part of the history |
|
51 \item Saving (relevant) parts of the history to a file |
|
52 \item Running a script from within ipython |
|
53 \end{itemize} |
|
54 \end{frame} |
|
55 \begin{frame} |
|
56 \frametitle{Question 1} |
|
57 \label{sec-2} |
|
58 |
|
59 Read through the documentation of \texttt{\%hist} and find out how to list |
|
60 all the commands between 5 and 10 |
|
61 \end{frame} |
|
62 \begin{frame}[fragile] |
|
63 \frametitle{Solution 1} |
|
64 \label{sec-3} |
|
65 |
|
66 \lstset{language=Python} |
|
67 \begin{lstlisting} |
|
68 In []: %hist 5 10 |
|
69 \end{lstlisting} |
|
70 \end{frame} |
|
71 \begin{frame} |
|
72 \frametitle{Question 2} |
|
73 \label{sec-4} |
|
74 |
|
75 Change the label on y-axis to ``y'' and save the lines of code |
|
76 accordingly |
|
77 \end{frame} |
|
78 \begin{frame}[fragile] |
|
79 \frametitle{Solution 2} |
|
80 \label{sec-5} |
|
81 |
|
82 \lstset{language=Python} |
|
83 \begin{lstlisting} |
|
84 In []: ylabel("y") |
|
85 In []: %save /home/fossee/example_plot.py 1 3-6 10 |
|
86 \end{lstlisting} |
|
87 \end{frame} |
|
88 \begin{frame} |
|
89 \frametitle{Question 3} |
|
90 \label{sec-6} |
|
91 |
|
92 Use \texttt{\%hist} and \texttt{\%save} and create a script that has show in it and |
|
93 run it to produce and show the plot. |
|
94 \end{frame} |
|
95 \begin{frame}[fragile] |
|
96 \frametitle{Solution 3} |
|
97 \label{sec-7} |
|
98 |
|
99 \lstset{language=Python} |
|
100 \begin{lstlisting} |
|
101 In []: %hist 20 |
|
102 |
|
103 In []: %save /home/fossee/show_included.py 1 3-6 8 10 13 |
|
104 In []: %run -i /home/fossee/show_included.py |
|
105 \end{lstlisting} |
|
106 \end{frame} |
|
107 \begin{frame} |
|
108 \frametitle{Question 4} |
|
109 \label{sec-8} |
|
110 |
|
111 Run the script without using the -i option. Do you find any |
|
112 difference? |
|
113 \end{frame} |
|
114 \begin{frame} |
|
115 \frametitle{Solution 4} |
|
116 \label{sec-9} |
|
117 |
|
118 We see that it raises \texttt{NameError} saying the name \texttt{linspace} is not |
|
119 found. |
|
120 \end{frame} |
|
121 \begin{frame} |
|
122 \frametitle{Summary} |
|
123 \label{sec-10} |
|
124 |
|
125 \begin{itemize} |
|
126 \item Retreiving history using \texttt{\%hist} command |
|
127 \item Vieweing only a part of history by passing an argument to \%hist |
|
128 \item Saving the required lines of code in required order using \%save |
|
129 \item Using \%run -i command to run the saved script |
|
130 \end{itemize} |
|
131 \end{frame} |
|
132 \begin{frame} |
|
133 \frametitle{Thank you!} |
|
134 \label{sec-11} |
|
135 |
|
136 \begin{block}{} |
|
137 \begin{center} |
|
138 This spoken tutorial has been produced by the |
|
139 \textcolor{blue}{FOSSEE} team, which is funded by the |
|
140 \end{center} |
|
141 \begin{center} |
|
142 \textcolor{blue}{National Mission on Education through \\ |
|
143 Information \& Communication Technology \\ |
|
144 MHRD, Govt. of India}. |
|
145 \end{center} |
|
146 \end{block} |
|
147 \end{frame} |
|
148 |
|
149 \end{document} |