day1/session2.tex
author Nishanth Amuluru <nishanth@fossee.in>
Tue, 14 Dec 2010 23:15:36 +0530
branchscipyin2010
changeset 456 a27ccfc118fb
parent 441 9d9e4026238f
permissions -rw-r--r--
removed sslc1.txt from circulate since it is not required
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
408
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
    78
\author[FOSSEE group] {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}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
    81
\date[] {SciPy.in 2010, Tutorials}
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
293
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 290
diff changeset
   126
\section{Plotting Points}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   127
\begin{frame}[fragile]
194
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   128
\frametitle{Why would I plot f(x)?}
301
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   129
Do we plot analytical functions or experimental data?
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   130
\begin{small}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   131
\begin{lstlisting}
397
28915381ac32 Changes from BHU workshop . changed variable names in list intro . pendulum.pychanged to pendulum_plot.py . Also an extra space added on slide 33 session1 day1
amit@shrike.aero.iitb.ac.in
parents: 392
diff changeset
   132
In []: time = [0, 1, 2, 3]
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   133
397
28915381ac32 Changes from BHU workshop . changed variable names in list intro . pendulum.pychanged to pendulum_plot.py . Also an extra space added on slide 33 session1 day1
amit@shrike.aero.iitb.ac.in
parents: 392
diff changeset
   134
In []: distance = [7, 11, 15, 19]
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   135
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   136
In []: plot(time, distance)
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   137
Out[]: [<matplotlib.lines.Line2D object at 0xa73aa8c>]
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   138
397
28915381ac32 Changes from BHU workshop . changed variable names in list intro . pendulum.pychanged to pendulum_plot.py . Also an extra space added on slide 33 session1 day1
amit@shrike.aero.iitb.ac.in
parents: 392
diff changeset
   139
In []: xlabel('time')
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   140
Out[]: <matplotlib.text.Text object at 0x986e9ac>
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   141
397
28915381ac32 Changes from BHU workshop . changed variable names in list intro . pendulum.pychanged to pendulum_plot.py . Also an extra space added on slide 33 session1 day1
amit@shrike.aero.iitb.ac.in
parents: 392
diff changeset
   142
In []: ylabel('distance')
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   143
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
   144
\end{lstlisting}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   145
\end{small}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   146
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   147
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
\begin{figure}
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   150
\includegraphics[width=3.5in]{data/straightline.png}
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   151
\end{figure}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   152
\alert{Is this what you have?}
194
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   153
\end{frame}
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   154
7288d3867df2 Manual merge of branches.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 193 188
diff changeset
   155
\begin{frame}[fragile]
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   156
\frametitle{Plotting points}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   157
\begin{itemize}
408
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   158
\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
   159
\end{itemize}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   160
\begin{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   161
  In []: clf()
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   162
397
28915381ac32 Changes from BHU workshop . changed variable names in list intro . pendulum.pychanged to pendulum_plot.py . Also an extra space added on slide 33 session1 day1
amit@shrike.aero.iitb.ac.in
parents: 392
diff changeset
   163
  In []: plot(time, distance, 'o')
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   164
  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
   165
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   166
  In []: clf()
397
28915381ac32 Changes from BHU workshop . changed variable names in list intro . pendulum.pychanged to pendulum_plot.py . Also an extra space added on slide 33 session1 day1
amit@shrike.aero.iitb.ac.in
parents: 392
diff changeset
   167
  In []: plot(time, distance, '.')
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   168
  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
   169
\end{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   170
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   171
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   172
\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
   173
\begin{figure}
426
7d8738ce004d Adding an acknowledgement slide to session 1. Minor changes to session
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 408
diff changeset
   174
\includegraphics[interpolate=true,width=2.35in]{data/stline_dots.png}
7d8738ce004d Adding an acknowledgement slide to session 1. Minor changes to session
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 408
diff changeset
   175
\includegraphics[interpolate=true,width=2.35in]{data/stline_points.png}
198
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   176
\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
   177
\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
   178
4cb13665b3b6 Updated session 2 slides and added 4 graphs to data directory.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 195
diff changeset
   179
\begin{frame}[fragile]
426
7d8738ce004d Adding an acknowledgement slide to session 1. Minor changes to session
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 408
diff changeset
   180
\frametitle{Additional Line Styles}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   181
\begin{itemize}
391
92e56697e489 Removed spaces in dashed lines of session2 day1.
Puneeth Chaganti <punchagan@gmail.com>
parents: 389
diff changeset
   182
  \item \typ{'o'} - Filled circles
92e56697e489 Removed spaces in dashed lines of session2 day1.
Puneeth Chaganti <punchagan@gmail.com>
parents: 389
diff changeset
   183
  \item \typ{'.'} - Small Dots
92e56697e489 Removed spaces in dashed lines of session2 day1.
Puneeth Chaganti <punchagan@gmail.com>
parents: 389
diff changeset
   184
  \item \typ{'-'} - Lines
92e56697e489 Removed spaces in dashed lines of session2 day1.
Puneeth Chaganti <punchagan@gmail.com>
parents: 389
diff changeset
   185
  \item \typ{'--'} - Dashed lines
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   186
\end{itemize}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   187
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   188
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   189
\section{Lists}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   190
\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
   191
  \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
   192
  \begin{lstlisting}
397
28915381ac32 Changes from BHU workshop . changed variable names in list intro . pendulum.pychanged to pendulum_plot.py . Also an extra space added on slide 33 session1 day1
amit@shrike.aero.iitb.ac.in
parents: 392
diff changeset
   193
    In []: time = [0, 1, 2, 3]
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
   194
397
28915381ac32 Changes from BHU workshop . changed variable names in list intro . pendulum.pychanged to pendulum_plot.py . Also an extra space added on slide 33 session1 day1
amit@shrike.aero.iitb.ac.in
parents: 392
diff changeset
   195
    In []: distance = [7, 11, 15, 19]
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
   196
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   197
  \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
   198
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
   199
\begin{center}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   200
\alert{\typ{lists!!}}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   201
\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
   202
\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
   203
10528e3073ef Changed the schedule in session 1 slides and updated session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 286
diff changeset
   204
\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
   205
\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
   206
\begin{lstlisting}
301
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   207
In []: mtlist = [] 
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   208
\end{lstlisting}
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   209
\emphbar{Empty List}
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   210
\begin{lstlisting}
373
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   211
In []: p = [ 2, 3, 5, 7] 
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   212
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   213
In []: p[1]
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   214
Out[]: 3
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   215
373
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   216
In []: p[0]+p[1]+p[-1]
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   217
Out[]: 12
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   218
\end{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   219
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   220
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   221
\begin{frame}[fragile]
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   222
\frametitle{List: Appending elements}
301
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   223
\begin{lstlisting}
373
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   224
In []: p.append(11)
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   225
In []: p
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   226
Out[]: [ 2, 3, 5, 7, 11]
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   227
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   228
In []: b = [11, 13, 17]
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   229
In []: p.append(b)
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   230
Out[]: [ 2, 3, 5, 7, 11, [11, 13, 17]]
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   231
\end{lstlisting}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   232
%\inctime{10}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   233
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   234
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 163
diff changeset
   235
\section{Simple Pendulum}
153
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
   236
\begin{frame}[fragile]
dc0da25b788b Minor edits to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 151
diff changeset
   237
\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
   238
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
   239
\begin{center}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   240
\begin{small}
211
8618546997ac Minor edits to session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 198
diff changeset
   241
\begin{tabular}{| c | c | c |}
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   242
\hline
213
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 211
diff changeset
   243
$L$ & $T$ & $T^2$ \\ \hline
301
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   244
0.1 & 0.69 & \\ \hline
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   245
0.2 & 0.90 & \\ \hline
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   246
0.3 & 1.19 & \\ \hline
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   247
0.4 & 1.30 & \\ \hline
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   248
0.5 & 1.47 & \\ \hline
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   249
0.6 & 1.58 & \\ \hline
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   250
0.7 & 1.77 & \\ \hline
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   251
0.8 & 1.83 & \\ \hline
49bdffe4dca5 Updated session 2 slides of day 1 and added cheatsheets of day 2.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 300
diff changeset
   252
0.9 & 1.94 & \\ \hline
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   253
\end{tabular}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   254
\end{small}\\
211
8618546997ac Minor edits to session2.
Puneeth Chaganti <punchagan@fossee.in>
parents: 198
diff changeset
   255
\alert{$L \alpha T^2$}
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   256
\end{center}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   257
Our data is present in \typ{pendulum.txt}. Let's look at it.
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   258
\end{frame}
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   259
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   260
\begin{frame}[fragile]
408
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   261
    \frametitle{Gotcha and an aside}
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   262
    Ensure you are in the same directory as \typ{pendulum.txt}\\
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   263
    if not, do the following on IPython:
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   264
    \begin{lstlisting}
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   265
In []: %cd directory_containing_file
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   266
# Check if pendulum.txt is there.
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   267
In []: ls
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   268
# Also try 
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   269
In []: !ls
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   270
    \end{lstlisting}
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   271
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   272
    \alert{Note:} \typ{\%cd} is an IPython magic command.  For more information
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   273
    do:
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   274
    \begin{lstlisting}
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   275
In []: ?
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   276
    \end{lstlisting}
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   277
\end{frame}
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   278
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   279
\begin{frame}[fragile]
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   280
\frametitle{Looking at \typ{pendulum.txt}}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   281
\begin{lstlisting} 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   282
In []: cat pendulum.txt 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   283
1.0000e-01 6.9004e-01
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   284
1.1000e-01 6.9497e-01
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   285
1.2000e-01 7.4252e-01
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   286
1.3000e-01 7.5360e-01
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   287
\end{lstlisting}  %$
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   288
\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
   289
\begin{itemize}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   290
  \item File contains L vs.\ T values 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   291
  \item First Column -- L values
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   292
  \item Second Column -- T values
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
   293
\end{itemize}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   294
\end{frame}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   295
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   296
\begin{frame}[fragile]
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   297
  \frametitle{\typ{loadtxt}}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   298
  \begin{itemize}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   299
  \item We shall use the \typ{loadtxt} command to load data
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   300
  \item Let's use \typ{primes.txt} file learn to use it
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   301
  \item \typ{primes.txt} has a single column
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   302
  \item Then, we shall use it for \typ{pendulum.txt} -- 2 cols
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   303
  \end{itemize}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   304
\end{frame}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   305
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   306
\begin{frame}[fragile]
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   307
\frametitle{What's in \typ{primes.txt}?}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   308
Lets look at the \typ{primes.txt} file.
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   309
\begin{lstlisting} 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   310
In []: cat primes.txt 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   311
2
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   312
3      
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   313
5      
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   314
7     
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   315
11     
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   316
13
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   317
.
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   318
.
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   319
.
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   320
\end{lstlisting}  %$
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   321
\end{frame}
408
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   322
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   323
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   324
\begin{frame}[fragile]
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   325
  \frametitle{\typ{loadtxt} \ldots}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   326
  \begin{lstlisting}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   327
In []: primes = loadtxt('primes.txt')
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   328
In []: primes
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   329
Out[]: array([ 2., 3., 5., 7., 11., 13., 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   330
               17., 19., 23., 29., 31., 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   331
               37., 41., 43., 47., 53., 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   332
               59., 61., 67., 71., 73., 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   333
               79., 83., 89., 97.])
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   334
  \end{lstlisting}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   335
408
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   336
\end{frame}
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   337
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   338
\begin{frame}[fragile]
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   339
  \frametitle{Reading \typ{pendulum.txt}}
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   340
  \begin{lstlisting}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   341
In []: pend = loadtxt('pendulum.txt')
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   342
In []: pend
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   343
  \end{lstlisting}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   344
  \begin{itemize}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   345
  \item \typ{pend} is 2 Dimensional. 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   346
  \item We don't \alert{yet} know how to handle it.
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   347
  \item We obtain 1D sequences using \typ{unpack=True}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   348
  \end{itemize}
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   349
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   350
  \begin{lstlisting}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   351
In []: L, T = loadtxt('pendulum.txt', 
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   352
                      unpack=True)
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   353
In []: print L, T
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   354
In []: print len(L), len(T)
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   355
Out[]: 90 90
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   356
  \end{lstlisting}
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   357
\end{frame}
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   358
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   359
\begin{frame}[fragile]
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   360
\frametitle{Plotting $L$ vs $T^2$}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   361
\begin{itemize}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   362
\item We must square each of the values in \typ{T}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   363
\item How to do it?
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   364
\item We use a \kwrd{for} loop to iterate over \typ{T}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   365
\end{itemize}
161
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   366
\end{frame}
ff22fae4fde5 Adding reading files and plotting to day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 160
diff changeset
   367
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   368
\begin{frame}[fragile]
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   369
\frametitle{Plotting $L$ vs $T^2$}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   370
\begin{lstlisting}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   371
In []: tsq = []
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   372
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   373
In []: for time in T:
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   374
 ....:     tsq.append(time*time)
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   375
 ....:
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   376
 ....:
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   377
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   378
\end{lstlisting}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   379
\alert{Hit ``ENTER'' key twice, to get out of \typ{for} loop}.
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   380
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   381
\begin{lstlisting}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   382
In []: print len(tsq)
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   383
Out[]: 90
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   384
\end{lstlisting}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   385
\typ{tsq} is a \kwrd{list} of squares of \typ{T} values.
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   386
\end{frame}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   387
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   388
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   389
\begin{frame}[fragile]
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   390
\frametitle{Plotting $L$ vs $T^2$ \ldots}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   391
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   392
\begin{lstlisting}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   393
In []: plot(L, tsq, '.')
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   394
\end{lstlisting}
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   395
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   396
\begin{figure}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   397
  \includegraphics[width=3.5in]{data/L-Tsq.png}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   398
\end{figure}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   399
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   400
\end{frame}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   401
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   402
\section {Summary}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   403
\begin{frame}[fragile]
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   404
\frametitle{What did we learn?}
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   405
\begin{itemize}
408
217c38c06ebd ENH: Minor changes to session 2.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 397
diff changeset
   406
  \item Plot attributes and plotting points
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   407
  \item Lists
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   408
  \item \kwrd{for}
441
9d9e4026238f Changed session-2 - now uses loadtxt.
Puneeth Chaganti <punchagan@gmail.com>
parents: 426
diff changeset
   409
  \item Loading data from files
193
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   410
\end{itemize}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   411
\end{frame}
a31b0e76c0fb Revamped session 2 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 179
diff changeset
   412
109
16e04782baac Added session2.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   413
\end{document}
343
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   414
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   415
%% Questions for Quiz %%
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   416
%% ------------------ %%
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   417
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   418
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   419
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   420
  \begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   421
  In []: a = [1, 2, 5, 9]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   422
  In []: a[0:-1]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   423
  \end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   424
  What is the output?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   425
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   426
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   427
\begin{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   428
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   429
  How do you combine two lists \emph{a} and \emph{b} to produce one list?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   430
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   431
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   432
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   433
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   434
  \begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   435
  In []: a = [1, 2, 5, 9]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   436
  \end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   437
  How do you add the value 10 to the end of this list?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   438
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   439
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   440
\begin{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   441
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   442
Write the code to read a file \texttt{data.txt} and print each line of it?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   443
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   444
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   445
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   446
\frametitle{\incqno }
352
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   447
What would be the result of the following code snippet:
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   448
\begin{lstlisting}
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   449
In []: x = linspace(0, 10, 50)
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   450
In []: y = linspace(50, 100, 100)
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   451
In []: plot(x, y)
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   452
\end{lstlisting}
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   453
\end{frame}
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   454
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   455
\begin{frame}[fragile]
b44d7bcc6609 Added a few quiz questions; Minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   456
\frametitle{\incqno }
343
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   457
The following code snippet has an error/bug:
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   458
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   459
In []: l = [0.1, 0.2, 0.3, 0.4]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   460
In []: t = [0.69, 0.90, 1.19, 1.30]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   461
In []: tsq = []
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   462
In []: for time in t:
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   463
 ....:     tsq.append(time*time)
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   464
 ....:     plot(l, tsq)
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   465
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   466
What is the error? How do you fix it?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   467
\end{frame}