additional_ipython/slides.org
changeset 522 d33698326409
parent 521 88a01948450d
child 523 54bdda4aefa5
equal deleted inserted replaced
521:88a01948450d 522:d33698326409
     1 #+LaTeX_CLASS: beamer
       
     2 #+LaTeX_CLASS_OPTIONS: [presentation]
       
     3 #+BEAMER_FRAME_LEVEL: 1
       
     4 
       
     5 #+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
       
     6 #+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
       
     7 #+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
       
     8 
       
     9 #+LaTeX_CLASS: beamer
       
    10 #+LaTeX_CLASS_OPTIONS: [presentation]
       
    11 
       
    12 #+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
       
    13 #+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
       
    14 
       
    15 #+LaTeX_HEADER:\usepackage{listings}
       
    16 
       
    17 #+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
       
    18 #+LaTeX_HEADER:  commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
       
    19 #+LaTeX_HEADER:  showstringspaces=false, keywordstyle=\color{blue}\bfseries}
       
    20 
       
    21 #+TITLE:    Additional Features of =ipython=
       
    22 #+AUTHOR:    FOSSEE
       
    23 #+EMAIL:     
       
    24 #+DATE:    
       
    25 
       
    26 #+DESCRIPTION: 
       
    27 #+KEYWORDS: 
       
    28 #+LANGUAGE:  en
       
    29 #+OPTIONS:   H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
       
    30 #+OPTIONS:   TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
       
    31 
       
    32 * Outline
       
    33   + Retrieving ipython history 
       
    34   + Viewing a part of the history 
       
    35   + Saving (relevant) parts of the history to a file
       
    36   + Running a script from within ipython 
       
    37 * Question 1
       
    38   Read through the documentation of ~%hist~ and find out how to list
       
    39   all the commands between 5 and 10
       
    40 * Solution 1
       
    41   #+begin_src python
       
    42     In []: %hist 5 10
       
    43   #+end_src
       
    44 * Question 2
       
    45   Change the label on y-axis to "y" and save the lines of code
       
    46   accordingly
       
    47 * Solution 2
       
    48   #+begin_src python
       
    49     In []: ylabel("y")
       
    50     In []: %save /home/fossee/example_plot.py 1 3-6 10
       
    51   #+end_src
       
    52 * Question 3
       
    53   Use =%hist= and =%save= and create a script that has show in it and
       
    54   run it to produce and show the plot.
       
    55 
       
    56 * Solution 3
       
    57   #+begin_src python
       
    58     In []: %hist 20
       
    59         
       
    60     In []: %save /home/fossee/show_included.py 1 3-6 8 10 13
       
    61     In []: %run -i /home/fossee/show_included.py
       
    62   #+end_src
       
    63 * Question 4
       
    64   Run the script without using the -i option. Do you find any
       
    65   difference?
       
    66 * Solution 4
       
    67   We see that it raises ~NameError~ saying the name ~linspace~ is not
       
    68   found.
       
    69 * Summary
       
    70   + Retreiving history using =%hist= command
       
    71   + Vieweing only a part of history by passing an argument to %hist
       
    72   + Saving the required lines of code in required order using %save
       
    73   + Using %run -i command to run the saved script
       
    74 
       
    75 * Thank you!
       
    76 #+begin_latex
       
    77   \begin{block}{}
       
    78   \begin{center}
       
    79   This spoken tutorial has been produced by the
       
    80   \textcolor{blue}{FOSSEE} team, which is funded by the 
       
    81   \end{center}
       
    82   \begin{center}
       
    83     \textcolor{blue}{National Mission on Education through \\
       
    84       Information \& Communication Technology \\ 
       
    85       MHRD, Govt. of India}.
       
    86   \end{center}  
       
    87   \end{block}
       
    88 #+end_latex
       
    89 
       
    90