author | Puneeth Chaganti <punchagan@fossee.in> |
Fri, 23 Oct 2009 12:24:52 +0530 | |
changeset 151 | 55c22520ff5e |
parent 146 | 09efb6e419f5 |
child 153 | dc0da25b788b |
permissions | -rw-r--r-- |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
2 |
%Tutorial slides on Python. |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
3 |
% |
146
09efb6e419f5
Updated session 2, day 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
145
diff
changeset
|
4 |
% Author: The FOSSEE Group |
09efb6e419f5
Updated session 2, day 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
145
diff
changeset
|
5 |
% Copyright (c) 2009, The FOSSEE Group, IIT Bombay |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
7 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
8 |
\documentclass[14pt,compress]{beamer} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
9 |
%\documentclass[draft]{beamer} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
10 |
%\documentclass[compress,handout]{beamer} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
11 |
%\usepackage{pgfpages} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
12 |
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
13 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
14 |
% Modified from: generic-ornate-15min-45min.de.tex |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
15 |
\mode<presentation> |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
16 |
{ |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
17 |
\usetheme{Warsaw} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
18 |
\useoutertheme{split} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
19 |
\setbeamercovered{transparent} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
20 |
} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
21 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
22 |
\usepackage[english]{babel} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
23 |
\usepackage[latin1]{inputenc} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
24 |
%\usepackage{times} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
25 |
\usepackage[T1]{fontenc} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
26 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
27 |
% Taken from Fernando's slides. |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
28 |
\usepackage{ae,aecompl} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
29 |
\usepackage{mathpazo,courier,euler} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
30 |
\usepackage[scaled=.95]{helvet} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
31 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
32 |
\definecolor{darkgreen}{rgb}{0,0.5,0} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
33 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
34 |
\usepackage{listings} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
35 |
\lstset{language=Python, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
36 |
basicstyle=\ttfamily\bfseries, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
37 |
commentstyle=\color{red}\itshape, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
38 |
stringstyle=\color{darkgreen}, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
39 |
showstringspaces=false, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
40 |
keywordstyle=\color{blue}\bfseries} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
41 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
42 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
43 |
% Macros |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
44 |
\setbeamercolor{emphbar}{bg=blue!20, fg=black} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
45 |
\newcommand{\emphbar}[1] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
46 |
{\begin{beamercolorbox}[rounded=true]{emphbar} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
47 |
{#1} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
48 |
\end{beamercolorbox} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
49 |
} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
50 |
\newcounter{time} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
51 |
\setcounter{time}{0} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
52 |
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
53 |
|
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
54 |
\newcommand{\typ}[1]{\lstinline{#1}} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
55 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
56 |
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} } |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
57 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
58 |
%%% This is from Fernando's setup. |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
59 |
% \usepackage{color} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
60 |
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
61 |
% % Use and configure listings package for nicely formatted code |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
62 |
% \usepackage{listings} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
63 |
% \lstset{ |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
64 |
% language=Python, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
65 |
% basicstyle=\small\ttfamily, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
66 |
% commentstyle=\ttfamily\color{blue}, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
67 |
% stringstyle=\ttfamily\color{orange}, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
68 |
% showstringspaces=false, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
69 |
% breaklines=true, |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
70 |
% postbreak = \space\dots |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
71 |
% } |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
72 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
73 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
74 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
75 |
% Title page |
144
0407ddc37038
Updated session 2, day 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
134
diff
changeset
|
76 |
\title[Plotting using Python]{Plotting experimental data\\} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
77 |
|
146
09efb6e419f5
Updated session 2, day 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
145
diff
changeset
|
78 |
\author[FOSSEE Team] {The FOSSEE Group} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
79 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
80 |
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
81 |
\date[] {31, October 2009\\Day 1, Session 2} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
82 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
83 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
84 |
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
85 |
%\logo{\pgfuseimage{iitmlogo}} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
86 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
87 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
88 |
%% Delete this, if you do not want the table of contents to pop up at |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
89 |
%% the beginning of each subsection: |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
90 |
\AtBeginSubsection[] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
91 |
{ |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
92 |
\begin{frame}<beamer> |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
93 |
\frametitle{Outline} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
94 |
\tableofcontents[currentsection,currentsubsection] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
95 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
96 |
} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
97 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
98 |
\AtBeginSection[] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
99 |
{ |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
100 |
\begin{frame}<beamer> |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
101 |
\frametitle{Outline} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
102 |
\tableofcontents[currentsection,currentsubsection] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
103 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
104 |
} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
105 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
106 |
% If you wish to uncover everything in a step-wise fashion, uncomment |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
107 |
% the following command: |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
108 |
%\beamerdefaultoverlayspecification{<+->} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
109 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
110 |
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
111 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
112 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
113 |
% DOCUMENT STARTS |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
114 |
\begin{document} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
115 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
116 |
\begin{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
117 |
\titlepage |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
118 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
119 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
120 |
\begin{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
121 |
\frametitle{Outline} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
122 |
\tableofcontents |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
123 |
% You might wish to add the option [pausesections] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
124 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
125 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
126 |
\section{Creating and running scripts} |
151
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
127 |
\begin{frame}[fragile] |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
128 |
\frametitle{Python Scripts} |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
129 |
\begin{itemize} |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
130 |
\item Let us now put all the commands used in the review problem into a file. |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
131 |
\item The following commands of IPython help us do this. |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
132 |
\end{itemize} |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
133 |
\begin{lstlisting} |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
134 |
In []: %hist |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
135 |
In []: %hist -n |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
136 |
\end{lstlisting} |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
137 |
\end{frame} |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
138 |
|
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
139 |
\begin{frame} |
151
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
140 |
\frametitle{Python Scripts\ldots} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
141 |
\begin{itemize} |
151
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
142 |
\item Open a new file in an \alert{editor} |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
143 |
\item Copy and paste required lines from the output of \typ{\%hist -n} |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
144 |
\item Save the file as \typ{first_plot.py} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
145 |
\end{itemize} |
151
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
146 |
\begin{itemize} |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
147 |
\item run the file in IPython using \typ{\%run first_plot.py}\\ |
55c22520ff5e
Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
146
diff
changeset
|
148 |
\end{itemize} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
149 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
150 |
|
134
31b3e5051b06
Updated Session 1, day 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
132
diff
changeset
|
151 |
\section{File Handling} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
152 |
\begin{frame}[fragile] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
153 |
\frametitle{File and \kwrd{for}} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
154 |
\begin{lstlisting} |
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
155 |
In []: f = open('dummyfile') |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
156 |
|
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
157 |
In []: for line in f: |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
158 |
...: print line |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
159 |
...: |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
160 |
\end{lstlisting} |
132
c10d8cb8d690
Updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
130
diff
changeset
|
161 |
\inctime{5} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
162 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
163 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
164 |
\section{Strings} |
132
c10d8cb8d690
Updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
130
diff
changeset
|
165 |
\begin{frame}{Strings} |
c10d8cb8d690
Updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
130
diff
changeset
|
166 |
Anything within ``quotes'' is a string! |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
167 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
168 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
169 |
\begin{frame}[fragile]\frametitle{Strings and \typ{split()}} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
170 |
\begin{lstlisting} |
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
171 |
In []: a = 'hello world' |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
172 |
|
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
173 |
In []: a.split() |
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
174 |
Out[]: ['hello', 'world'] |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
175 |
\end{lstlisting} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
176 |
Now try this: |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
177 |
\begin{lstlisting} |
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
178 |
In []: b = 'KD, MCS, PC, SC, SV' |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
179 |
|
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
180 |
In []: b.split(',') |
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
181 |
Out[]: ['KD', 'MCS', 'PC', 'SC', 'SV'] |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
182 |
\end{lstlisting} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
183 |
\inctime{5} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
184 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
185 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
186 |
\section{Plotting points} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
187 |
\begin{frame}[fragile] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
188 |
\frametitle{How to plot points?} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
189 |
\begin{lstlisting} |
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
190 |
In []: plt.plot(x, sin(x), 'ro') |
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
191 |
Out[]: [<matplotlib.lines.Line2D object at 0xac17e0c>] |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
192 |
\end{lstlisting} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
193 |
\begin{itemize} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
194 |
\item \kwrd{'r'},\kwrd{'g'},\kwrd{'b'} for red, green and blue |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
195 |
\item \kwrd{'o'} - Dots |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
196 |
\item \kwrd{'-'} - Lines |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
197 |
\item \kwrd{'- -'} - Dashed lines |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
198 |
\end{itemize} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
199 |
\inctime{5} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
200 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
201 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
202 |
\section{Lists} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
203 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
204 |
\begin{frame}[fragile] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
205 |
\frametitle{List creation and indexing} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
206 |
\begin{lstlisting} |
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
207 |
In []: lst = [1,2,3,4] |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
208 |
|
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
209 |
In []: lst[0]+lst[1]+lst[-1] |
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
210 |
Out[]: 7 |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
211 |
\end{lstlisting} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
212 |
\begin{itemize} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
213 |
\item Indices start with ? |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
214 |
\item Negative indices indicate ? |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
215 |
\end{itemize} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
216 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
217 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
218 |
\begin{frame}[fragile] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
219 |
\frametitle{List: slices} |
132
c10d8cb8d690
Updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
130
diff
changeset
|
220 |
\typ{list[initial:final:step]} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
221 |
\begin{lstlisting} |
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
222 |
In []: lst[1:3] # A slice. |
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
223 |
Out[]: [2, 3] |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
224 |
|
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
225 |
In []: lst[1:-1] |
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
226 |
Out[]: [2, 3] |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
227 |
\end{lstlisting} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
228 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
229 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
230 |
\begin{frame}[fragile] |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
231 |
\frametitle{List methods} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
232 |
\begin{lstlisting} |
130
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
233 |
In []: lst.append([6,7]) |
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
234 |
In []: lst |
8905a5badd7e
Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
235 |
Out[]: [1, 2, 3, 4, 5, [6, 7]] |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
236 |
\end{lstlisting} |
132
c10d8cb8d690
Updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
130
diff
changeset
|
237 |
\inctime{10} |
109
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
238 |
\end{frame} |
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
239 |
|
16e04782baac
Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
240 |
\end{document} |