day1/session2.tex
author Santosh G. Vattam <vattam.santosh@gmail.com>
Fri, 06 Nov 2009 18:39:56 +0530
changeset 291 ec70a2048871
parent 290 10528e3073ef
child 293 f7d7b5565232
permissions -rw-r--r--
Updated cheatsheet for session 2.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
109
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
%
153
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
     4
% Author: FOSSEE
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
     5
% Copyright (c) 2009, FOSSEE, 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}
239
8953675dc056 Added slide numbers.
Puneeth Chaganti <punchagan@fossee.in>
parents: 213
diff changeset
    18
  \useoutertheme{infolines}
109
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
240
5a96cf81bdc5 Changed titles of Day1 slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 239
diff changeset
    76
\title[Plotting with Python]{Python for Science and Engg: Plotting experimental data}
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    77
153
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
    78
\author[FOSSEE] {FOSSEE}
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}
286
ac457f7d1702 Changed dates in day1 slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 280
diff changeset
    81
\date[] {7 November, 2009\\Day 1, Session 2}
109
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
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   126
%\begin{frame}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   127
%\frametitle{Python Scripts\ldots}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   128
%  \begin{itemize}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   129
%    \item Open a new file in an \alert{editor}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   130
%    \item Copy and paste from the output of \typ{\%hist -n}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   131
%    \item Save the file as \typ{sine_plot.py}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   132
%  \end{itemize}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   133
%  \begin{itemize}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   134
%  \item run the file in IPython using \typ{\%run -i sine_plot.py}\\
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   135
%  \end{itemize}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   136
%\end{frame}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   137
280
9bed85f05eb8 Added save command in session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 276
diff changeset
   138
\section{Scripts}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   139
151
55c22520ff5e Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
   140
\begin{frame}[fragile]
55c22520ff5e Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
   141
\frametitle{Python Scripts}
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   142
  \begin{itemize}
280
9bed85f05eb8 Added save command in session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 276
diff changeset
   143
  \item four\_plot.py is called a Python Script
9bed85f05eb8 Added save command in session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 276
diff changeset
   144
  \item run the file in IPython using \typ{\%run -i four_plot.py}
151
55c22520ff5e Added IPython history to Day1 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 146
diff changeset
   145
  \end{itemize}
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   146
\end{frame}
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   147
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   148
\begin{frame}[fragile]
194
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   149
\frametitle{Why would I plot f(x)?}
183
b34c3a22d726 Fixed some slides
rivermaker@RivermakerMBP.local
parents: 179
diff changeset
   150
How often do we plot analytical functions?\\We plot experimental data more.
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   151
\begin{small}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   152
\begin{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   153
In []: x = [0, 1, 2, 3]
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   154
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   155
In []: y = [7, 11, 15, 19]
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   156
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   157
In []: plot(x, y)
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   158
Out[]: [<matplotlib.lines.Line2D object at 0xa73aa8c>]
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   159
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   160
In []: xlabel('X')
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   161
Out[]: <matplotlib.text.Text object at 0x986e9ac>
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   162
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   163
In []: ylabel('Y')
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   164
Out[]: <matplotlib.text.Text object at 0x98746ec>
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   165
\end{lstlisting}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   166
\end{small}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   167
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   168
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   169
\begin{frame}[fragile]
194
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   170
\begin{figure}
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   171
\includegraphics[width=3.5in]{data/straightline.png}
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   172
\end{figure}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   173
\alert{Is this what you have?}
194
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   174
\end{frame}
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   175
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   176
\begin{frame}[fragile]
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   177
\frametitle{Plotting points}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   178
\begin{itemize}
183
b34c3a22d726 Fixed some slides
rivermaker@RivermakerMBP.local
parents: 179
diff changeset
   179
\item What if we want to plot the points!
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   180
\end{itemize}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   181
\begin{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   182
  In []: clf()
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   183
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   184
  In []: plot(x, y, 'o')
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   185
  Out[]: [<matplotlib.lines.Line2D object at 0xac17e0c>]
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   186
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   187
  In []: clf()
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   188
  In []: plot(x, y, '.')
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   189
  Out[]: [<matplotlib.lines.Line2D object at 0xac17e0c>]
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   190
\end{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   191
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   192
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   193
\begin{frame}[fragile]
198
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   194
\begin{figure}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   195
\includegraphics[width=2in]{data/stline_dots.png}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   196
\includegraphics[width=2in]{data/stline_points.png}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   197
\end{figure}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   198
\end{frame}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   199
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   200
\begin{frame}[fragile]
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   201
\frametitle{Additional Plotting Attributes}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   202
\begin{itemize}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   203
  \item \kwrd{'o'} - Filled circles
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   204
  \item \kwrd{'.'} - Small Dots
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   205
  \item \kwrd{'-'} - Lines
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   206
  \item \kwrd{'- -'} - Dashed lines
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   207
\end{itemize}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   208
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   209
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   210
\section{Lists}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   211
\begin{frame}[fragile]
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   212
  \frametitle{Lists: Introduction}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   213
  \begin{lstlisting}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   214
    In []: x = [0, 1, 2, 3]
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   215
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   216
    In []: y = [7, 11, 15, 19]
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   217
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   218
  \end{lstlisting}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   219
What are \typ{x} and \typ{y}?\\
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   220
\begin{center}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   221
\alert{\typ{lists!!}}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   222
\end{center}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   223
\end{frame}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   224
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   225
\begin{frame}[fragile]
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   226
\frametitle{Lists: Initializing \& accessing elements}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   227
\begin{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   228
In []: mtlist = [] #Empty List
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   229
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   230
In []: a = [ 1, 2, 3, 4, 5] 
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   231
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   232
In []: a[0]+a[1]+a[-1]
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   233
Out[]: 8
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   234
\end{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   235
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   236
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   237
\begin{frame}[fragile]
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   238
  \frametitle{List: Slicing}
188
15f29c7fd925 Made some fixes
rivermaker@RivermakerMBP.local
parents: 183
diff changeset
   239
  \begin{block}{Remember\ldots}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   240
	\kwrd{In []: a = [ 1, 2, 3, 4, 5]}
188
15f29c7fd925 Made some fixes
rivermaker@RivermakerMBP.local
parents: 183
diff changeset
   241
  \end{block}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   242
\begin{lstlisting}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   243
In []: a[1:3]  # A slice.
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   244
Out[]: [2, 3]
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   245
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   246
In []: a[1:-1]
275
71e50184d482 Updated session 2 day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 274
diff changeset
   247
Out[]: [2, 3, 4]
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   248
\end{lstlisting}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   249
\alert{\typ{list[initial:final]}}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   250
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   251
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   252
%% more on list slicing
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   253
\begin{frame}[fragile]
213
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 211
diff changeset
   254
\frametitle{List operations}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   255
\begin{lstlisting}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   256
In []: b = [ 6, 7, 8, 9]
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   257
In []: c = a + b
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   258
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   259
In []: c
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   260
Out[]: [1, 2, 3, 4, 5, 6, 7, 8, 9]
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   261
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   262
In []: a.append(6)
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   263
In []: a
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   264
Out[]: [ 1, 2, 3, 4, 5, 6]
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   265
\end{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   266
%\inctime{10}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   267
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   268
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   269
\section{Simple Pendulum}
153
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
   270
\begin{frame}[fragile]
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
   271
\frametitle{Simple Pendulum - L and T}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   272
Let us look at the Simple Pendulum experiment.
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   273
\begin{center}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   274
\begin{small}
211
8618546997ac Minor edits to session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 198
diff changeset
   275
\begin{tabular}{| c | c | c |}
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   276
\hline
213
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 211
diff changeset
   277
$L$ & $T$ & $T^2$ \\ \hline
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   278
0.1 & 0.6900 & \\ \hline
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   279
0.2 & 0.8989 & \\ \hline
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   280
0.3 & 1.1867 & \\ \hline
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   281
0.4 & 1.2991 & \\ \hline
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   282
0.5 & 1.4656 & \\ \hline
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   283
0.6 & 1.5843 & \\ \hline
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   284
0.7 & 1.7706 & \\ \hline
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   285
0.8 & 1.8296 & \\ \hline
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   286
0.9 & 1.9440 & \\ \hline
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   287
\end{tabular}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   288
\end{small}\\
211
8618546997ac Minor edits to session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 198
diff changeset
   289
\alert{$L \alpha T^2$}
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   290
\end{center}
153
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
   291
\end{frame}
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
   292
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
   293
\begin{frame}[fragile]
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   294
\frametitle{Lets use lists}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   295
\begin{lstlisting}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   296
In []: l = [0.1, 0.2, 0.3, 0.4, 0.5, 
253
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 242
diff changeset
   297
            0.6, 0.7, 0.8, 0.9]
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   298
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   299
In []: t = [0.69, 0.8989, 1.1867, 
253
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 242
diff changeset
   300
            1.2991, 1.4656, 1.5843, 
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 242
diff changeset
   301
            1.7706, 1.8296, 1.9440]
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   302
\end{lstlisting}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   303
\end{frame}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   304
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   305
\begin{frame}[fragile]
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   306
\frametitle{Plotting $L$ vs $T^2$}
156
6a1388c456f4 Added plotting of points, additional attributes of plots.
Puneeth Chaganti <punchagan@fossee.in>
parents: 153
diff changeset
   307
\begin{itemize}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   308
\item We must square each of the values in \typ{t}
156
6a1388c456f4 Added plotting of points, additional attributes of plots.
Puneeth Chaganti <punchagan@fossee.in>
parents: 153
diff changeset
   309
\item How to do it?
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   310
\item We use a \kwrd{for} loop to iterate over \typ{t}
156
6a1388c456f4 Added plotting of points, additional attributes of plots.
Puneeth Chaganti <punchagan@fossee.in>
parents: 153
diff changeset
   311
\end{itemize}
6a1388c456f4 Added plotting of points, additional attributes of plots.
Puneeth Chaganti <punchagan@fossee.in>
parents: 153
diff changeset
   312
\end{frame}
153
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
   313
159
01f57cda252f Manual merge of conflicting branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 158 156
diff changeset
   314
\begin{frame}[fragile]
01f57cda252f Manual merge of conflicting branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 158 156
diff changeset
   315
\frametitle{Plotting $L$ vs $T^2$}
158
978108b0c02c Added lists and for slides to session 2, day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 153
diff changeset
   316
\begin{lstlisting}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   317
In []: tsq = []
153
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
   318
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   319
In []: for time in t:
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   320
 ....:     tsq.append(time*time)
158
978108b0c02c Added lists and for slides to session 2, day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 153
diff changeset
   321
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   322
In []: plot(l, tsq)
158
978108b0c02c Added lists and for slides to session 2, day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 153
diff changeset
   323
Out[]: [<matplotlib.lines.Line2D object at 0xa5b05ac>]
978108b0c02c Added lists and for slides to session 2, day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 153
diff changeset
   324
\end{lstlisting}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   325
This gives \kwrd{tsq} which is the list of squares of \typ{t} values.
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   326
\end{frame}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   327
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   328
\begin{frame}[fragile]
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   329
  \frametitle{How to come out of the \textt{for} loop?}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   330
  Hit the ``enter'' key twice to come to the previous indentation level
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   331
  \begin{lstlisting}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   332
    In []: for time in t:
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   333
     ....:     tsq.append(time*time)
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   334
     ....:     
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   335
     ....:     
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   336
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   337
    In []:
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   338
  \end{lstlisting}
158
978108b0c02c Added lists and for slides to session 2, day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 153
diff changeset
   339
\end{frame}
978108b0c02c Added lists and for slides to session 2, day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 153
diff changeset
   340
978108b0c02c Added lists and for slides to session 2, day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 153
diff changeset
   341
\begin{frame}[fragile]
198
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   342
\begin{figure}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   343
\includegraphics[width=3.5in]{data/L-TSq-limited.png}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   344
\end{figure}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   345
\end{frame}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   346
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   347
\begin{frame}[fragile]
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   348
\frametitle{What about larger data sets?}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   349
\alert{Data is usually present in a file!} \\
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   350
Lets look at the \typ{pendulum.txt} file.
158
978108b0c02c Added lists and for slides to session 2, day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 153
diff changeset
   351
\begin{lstlisting}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   352
$ cat pendulum.txt 
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   353
1.0000e-01 6.9004e-01
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   354
1.1000e-01 6.9497e-01
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   355
1.2000e-01 7.4252e-01
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   356
1.3000e-01 7.5360e-01
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   357
1.4000e-01 8.3568e-01
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   358
1.5000e-01 8.6789e-01
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   359
\end{lstlisting}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   360
\ldots
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   361
\begin{block}{Windows users:}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   362
  >type pendulum.txt
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   363
\end{block}
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   364
\end{frame}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   365
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   366
\begin{frame}[fragile]
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   367
\frametitle{Reading \typ{pendulum.txt}}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   368
\begin{itemize}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   369
  \item Let us generate a plot from the data file
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   370
  \item File contains L vs. T values 
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   371
  \item L - Column1; T - Column2
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   372
\end{itemize}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   373
\end{frame}
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   374
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   375
\begin{frame}[fragile]
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   376
\frametitle{Plotting from \typ{pendulum.txt}}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   377
Open a new script and type the following:
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   378
\begin{lstlisting}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   379
l = []
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   380
t = []
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   381
for line in open('pendulum.txt'):
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   382
    points = line.split()
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   383
    l.append(float(points[0]))
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   384
    t.append(float(points[1]))
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   385
tsq = []
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   386
for time in t:
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   387
    tsq.append(time*time)
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   388
plot(l, tsq, '.')
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   389
\end{lstlisting}
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   390
\end{frame}
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   391
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   392
\begin{frame}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   393
\frametitle{Save and run}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   394
\begin{itemize}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   395
  \item Save as pendulum\_plot.py.
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   396
  \item Run using \kwrd{\%run -i pendulum\_plot.py}
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   397
\end{itemize}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   398
\end{frame}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   399
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   400
\begin{frame}[fragile]
198
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   401
\begin{figure}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   402
\includegraphics[width=3.5in]{data/L-Tsq.png}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   403
\end{figure}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   404
\end{frame}
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   405
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   406
\begin{frame}[fragile]
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   407
  \frametitle{Reading files \ldots}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   408
\typ{for line in open('pendulum.txt'):}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   409
\begin{itemize}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   410
\item opening file `\typ{pendulum.txt}'
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   411
\item reading the file line by line
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   412
\item \typ{line} is a \kwrd{string}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   413
\end{itemize}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   414
\end{frame}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   415
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   416
\section{Strings}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   417
\begin{frame}[fragile]
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   418
\frametitle{Strings}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   419
Anything within ``quotes'' is a string!
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   420
\begin{lstlisting}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   421
' This is a string '  
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   422
" This too! "
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   423
""" This one too! """
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   424
''' And one more! '''
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   425
\end{lstlisting}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   426
\end{frame}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   427
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   428
\begin{frame}[fragile]
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   429
\frametitle{Strings and \typ{split()}}
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   430
  \begin{lstlisting}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   431
In []: greet = 'hello world'
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   432
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   433
In []: greet.split()
130
8905a5badd7e Minor edits to day1 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   434
Out[]: ['hello', 'world']
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   435
  \end{lstlisting}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   436
This is what happens with \typ{line}
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   437
  \begin{lstlisting}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   438
In []: line = '1.2000e-01 7.4252e-01'
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   439
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   440
In []: line.split()
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   441
Out[]: ['1.2000e-01', '7.4252e-01']
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   442
  \end{lstlisting}
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   443
\end{frame}
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   444
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   445
\begin{frame}[fragile]
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   446
\frametitle{Getting floats from strings}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   447
  \begin{lstlisting}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   448
In []: type(points[0])
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   449
Out[]: <type 'str'>
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   450
  \end{lstlisting}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   451
But, we need floating point numbers
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   452
  \begin{lstlisting}
275
71e50184d482 Updated session 2 day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 274
diff changeset
   453
In []: t = float(points[0])
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   454
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   455
In []: type(t)
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   456
Out[]: <type 'float'>
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   457
  \end{lstlisting}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   458
\end{frame}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   459
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   460
\begin{frame}[fragile]
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   461
\frametitle{Let's review the code}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   462
\begin{lstlisting}
290
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   463
l = []
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   464
t = []
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   465
for line in open('pendulum.txt'):
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   466
    points = line.split()
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   467
    l.append(float(points[0]))
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   468
    t.append(float(points[1]))
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   469
tsq = []
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   470
for time in t:
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   471
    tsq.append(time*time)
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   472
plot(l, tsq, '.')
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   473
\end{lstlisting}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   474
\end{frame}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   475
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   476
\begin{frame}[fragile]
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   477
\begin{figure}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   478
\includegraphics[width=3.5in]{data/L-Tsq.png}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   479
\end{figure}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   480
\end{frame}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   481
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   482
\section {Summary}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   483
\begin{frame}[fragile]
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   484
\frametitle{What did we learn?}
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   485
\begin{itemize}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   486
  \item Python scripts
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   487
  \item \kwrd{\%run -i}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   488
  \item Plotting points
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   489
  \item Plot attributes
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   490
  \item Lists
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   491
  \item \kwrd{for}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   492
  \item Reading files
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   493
  \item Strings
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   494
\end{itemize}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   495
\end{frame}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   496
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   497
\end{document}