diff options
Diffstat (limited to 'additional_features_of_ipython')
-rw-r--r-- | additional_features_of_ipython/script.rst | 28 | ||||
-rw-r--r-- | additional_features_of_ipython/slides.org | 79 | ||||
-rw-r--r-- | additional_features_of_ipython/slides.tex | 146 |
3 files changed, 132 insertions, 121 deletions
diff --git a/additional_features_of_ipython/script.rst b/additional_features_of_ipython/script.rst index a88ba3e..087f43f 100644 --- a/additional_features_of_ipython/script.rst +++ b/additional_features_of_ipython/script.rst @@ -34,7 +34,7 @@ Hello friends and welcome to the tutorial on "Additional Features of IPython". .. L2 -{{{ Show the slide containing the outline slide }}} +{{{ Show the slide containing the objectives }}} .. R2 @@ -81,7 +81,7 @@ xsin(x) is actually x * sin(x) plot(x, sin(x)) xlabel("x") ylabel("$f(x)$") - title("x and xsin") + title("x and xsin(x)") .. R6 @@ -123,17 +123,19 @@ The default number is 40. .. R9 -Pause here and try out the following exercise + Pause the video here, try out the following exercise and resume the video. Read through the documentation of %hist and find out how to list all the commands between 5 and 10. .. L9 +{{{ Show slide with question 1 }}} + .. L10 {{{ continue from paused state }}} - +{{{ Switch to the terminal }}} :: %hist 5 10 @@ -199,12 +201,14 @@ arguments there after are the commands to be saved in the given order. .. R16 -Pause here and try out the following exercise +Pause the video here, try out the following exercise and resume the video. Change the label on y-axis to "y" and save the lines of code accordingly. .. L16 +{{{ Show slide with question 2 }}} + .. L17 {{{ continue from paused state }}} @@ -257,10 +261,10 @@ Hence to view the plot type ``show()`` on your terminal .. R21 -Pause here and try out the following exercise + Pause the video here, try out the following exercise and resume the video. - Use %hist and %save and create a script that has show in it and run it - to produce and show the plot. + Use %hist and %save and create a script that has the function show() in it.Run the + script to produce the plot and display the same. <Pause> @@ -268,6 +272,8 @@ We first look at the history using .. L21 +{{{ Show slide with question 3 }}} + :: %hist 20 @@ -299,7 +305,7 @@ interpreter and used to run the script. .. R24 -Pause here and try out the following exercise + Pause the video here, try out the following exercise and resume the video. Run the script without using the -i option. Do you find any difference? @@ -307,6 +313,8 @@ Pause here and try out the following exercise .. L24 +{{{ Show slide with question 4 }}} + .. L25 :: @@ -327,7 +335,7 @@ This brings us to the end of the tutorial.let's revise quickly what we have lear 1. to retreive the history using =%hist= command. #. to view only a part of history by passing an argument to %hist. - #. to save the required lines of code in required order using %save. + #. to save the required lines of code in required order using %save command. #. to use %run -i command to run the saved script. .. L27 diff --git a/additional_features_of_ipython/slides.org b/additional_features_of_ipython/slides.org index 4f315fc..e899837 100644 --- a/additional_features_of_ipython/slides.org +++ b/additional_features_of_ipython/slides.org @@ -32,7 +32,7 @@ * #+begin_latex \begin{center} -\textcolor{blue}{Additional Features of \texttt{ipython}} +\textcolor{blue}{Additional Features of \texttt{ipython}} \end{center} \begin{center} \includegraphics[scale=0.25]{../images/iitb-logo.png}\\ @@ -42,82 +42,62 @@ Funded by National Mission on Education through ICT MHRD, Govt. of India \end{center} #+end_latex - * Objectives At the end of this tutorial, you will be able to, - - Retrieve the ipython history. + + - Retrieve your ipython history. - View a part of the history. - - Save (relevant) parts of the history to a file. + - Save a part of your history to a file. - Run a script from within ipython. * Question 1 - Read through the documentation of ~%hist~ and find out how to list - all the commands between 5 and 10 -* Solution 1 - #+begin_src python - In []: %hist 5 10 - #+end_src + Read through the documentation of =%hist= and find out how to + list all the commands between 5 and 10. * Question 2 Change the label on y-axis to "y" and save the lines of code accordingly -* Solution 2 - #+begin_src python - In []: ylabel("y") - In []: %save /home/fossee/example_plot.py 1 3-6 10 - #+end_src * Question 3 - Use =%hist= and =%save= and create a script that has show in it and - run it to produce and show the plot. - -* Solution 3 - #+begin_src python - In []: %hist 20 - - In []: %save /home/fossee/show_included.py 1 3-6 8 10 13 - In []: %run -i /home/fossee/show_included.py - #+end_src + Use =%hist= and =%save= and create a script that has the function show() + in it.Run the script to produce the plot and display the same. + * Question 4 Run the script without using the -i option. Do you find any difference? * Solution 4 We see that it raises ~NameError~ saying the name ~linspace~ is not found. - * Summary In this tutorial, we have learnt to – - - Retrieve history using =%hist= command. - - View only a part of history by passing an argument to =%hist=. - - Sav the required lines of code in the required order using =%save=. - - Use =%run -i= command to run the saved script. - + - Retrieve the history using =%hist= command. + - View only a part of history by passing an argument to %hist. + - Save the required lines of code in required order using %save command. + - Use %run -i command to run the saved script. * Evaluation - 1. How do you retrieve the recent 5 commands - - - ``%hist`` - - ``%hist -5`` - - ``%hist 5`` - - ``%hist 5-10`` + 1. How do you retrieve the recent 5 commands + + - ``%hist`` + - ``%hist -5`` + - ``%hist 5`` + - ``%hist 5-10`` 2. How do you save the lines 2 3 4 5 7 9 10 11 - - ``%save filepath 2-5 7 9-11`` - - ``%save filepath 2-11`` - - ``%save filepath`` - - ``%save 2-5 7 9 10 11`` + - ``%save filepath 2-5 7 9-11`` + - ``%save filepath 2-11`` + - ``%save filepath`` + - ``%save 2-5 7 9 10 11`` 3. What will the command ``%hist 5 10`` display. - - The recently typed commands from 5 to 10 inclusive of - the history command - - The recently typed commands from 5 to 10 excluding - the history command - + - The recently typed commands from 5 to 10 inclusive of + the history command + - The recently typed commands from 5 to 10 excluding + the history command * Solutions 1. %hist 5 - + 2. %save filepath 2-5 7 9-11 3. %hist 5 10 - * Acknowledgement #+begin_latex \begin{block}{} @@ -134,6 +114,3 @@ MHRD, Govt. of India #+end_latex - - - diff --git a/additional_features_of_ipython/slides.tex b/additional_features_of_ipython/slides.tex index b21fa3e..cfd731c 100644 --- a/additional_features_of_ipython/slides.tex +++ b/additional_features_of_ipython/slides.tex @@ -1,6 +1,6 @@ -% Created 2010-10-10 Sun 17:30 +% Created 2011-05-03 Tue 12:39 \documentclass[presentation]{beamer} -\usepackage[latin1]{inputenc} +\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} @@ -23,14 +23,13 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Additional Features of \texttt{ipython}} +\title{} \author{FOSSEE} \date{} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} -\maketitle @@ -42,31 +41,38 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \begin{frame} -\frametitle{Outline} -\label{sec-1} -\begin{itemize} -\item Retrieving ipython history -\item Viewing a part of the history -\item Saving (relevant) parts of the history to a file -\item Running a script from within ipython -\end{itemize} +\begin{center} +\textcolor{blue}{Additional Features of \texttt{ipython}} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} \end{frame} \begin{frame} -\frametitle{Question 1} +\frametitle{Objectives} \label{sec-2} - Read through the documentation of \texttt{\%hist} and find out how to list - all the commands between 5 and 10 + At the end of this tutorial, you will be able to, + + +\begin{itemize} +\item Retrieve your ipython history. +\item View a part of the history. +\item Save a part of your history to a file. +\item Run a script from within ipython. +\end{itemize} \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 1} +\begin{frame} +\frametitle{Question 1} \label{sec-3} -\lstset{language=Python} -\begin{lstlisting} -In []: %hist 5 10 -\end{lstlisting} + Read through the documentation of \texttt{\%hist} and find out how to + list all the commands between 5 and 10. \end{frame} \begin{frame} \frametitle{Question 2} @@ -75,75 +81,95 @@ In []: %hist 5 10 Change the label on y-axis to ``y'' and save the lines of code accordingly \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 2} +\begin{frame} +\frametitle{Question 3} \label{sec-5} -\lstset{language=Python} -\begin{lstlisting} -In []: ylabel("y") -In []: %save /home/fossee/example_plot.py 1 3-6 10 -\end{lstlisting} + Use \texttt{\%hist} and \texttt{\%save} and create a script that has the function show() + in it.Run the script to produce the plot and display the same. \end{frame} \begin{frame} -\frametitle{Question 3} +\frametitle{Question 4} \label{sec-6} - Use \texttt{\%hist} and \texttt{\%save} and create a script that has show in it and - run it to produce and show the plot. + Run the script without using the -i option. Do you find any + difference? \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 3} +\begin{frame} +\frametitle{Solution 4} \label{sec-7} -\lstset{language=Python} -\begin{lstlisting} -In []: %hist 20 - -In []: %save /home/fossee/show_included.py 1 3-6 8 10 13 -In []: %run -i /home/fossee/show_included.py -\end{lstlisting} + We see that it raises \verb~NameError~ saying the name \verb~linspace~ is not + found. \end{frame} \begin{frame} -\frametitle{Question 4} +\frametitle{Summary} \label{sec-8} - Run the script without using the -i option. Do you find any - difference? + In this tutorial, we have learnt to – + +\begin{itemize} +\item Retrieve the history using \texttt{\%hist} command. +\item View only a part of history by passing an argument to \%hist. +\item Save the required lines of code in required order using \%save command. +\item Use \%run -i command to run the saved script. +\end{itemize} \end{frame} \begin{frame} -\frametitle{Solution 4} +\frametitle{Evaluation} \label{sec-9} - We see that it raises \texttt{NameError} saying the name \texttt{linspace} is not - found. + +\begin{enumerate} +\item How do you retrieve the recent 5 commands +\begin{itemize} +\item ``\%hist`` +\item ``\%hist -5`` +\item ``\%hist 5`` +\item ``\%hist 5-10`` +\end{itemize} +\item How do you save the lines 2 3 4 5 7 9 10 11 +\begin{itemize} +\item ``\%save filepath 2-5 7 9-11`` +\item ``\%save filepath 2-11`` +\item ``\%save filepath`` +\item ``\%save 2-5 7 9 10 11`` +\end{itemize} +\item What will the command ``\%hist 5 10`` display. +\begin{itemize} +\item The recently typed commands from 5 to 10 inclusive of + the history command +\item The recently typed commands from 5 to 10 excluding + the history command +\end{itemize} +\end{enumerate} \end{frame} \begin{frame} -\frametitle{Summary} +\frametitle{Solutions} \label{sec-10} -\begin{itemize} -\item Retreiving history using \texttt{\%hist} command -\item Vieweing only a part of history by passing an argument to \%hist -\item Saving the required lines of code in required order using \%save -\item Using \%run -i command to run the saved script -\end{itemize} + +\begin{enumerate} +\item \%hist 5 +\item \%save filepath 2-5 7 9-11 +\item \%hist 5 10 +\end{enumerate} \end{frame} \begin{frame} -\frametitle{Thank you!} +\frametitle{Acknowledgement} \label{sec-11} \begin{block}{} \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the + \textcolor{blue}{\Large THANK YOU!} \end{center} + \end{block} +\begin{block}{} \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. + For more Information, visit our website\\ + \url{http://fossee.in/} \end{center} \end{block} \end{frame} -\end{document} +\end{document}
\ No newline at end of file |