day2/session3.tex
author Madhusudan.C.S <madhusudancs@gmail.com>
Wed, 07 Oct 2009 14:42:38 +0530
changeset 49 2adb90f9e287
parent 46 63704b5650f1
child 56 7a8cb7b07ebb
permissions -rw-r--r--
Added what did we learn to all slides and reworked on Session 2 and 4.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 23
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 23
diff changeset
     2
% Tutorial slides on Python.
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 23
diff changeset
     3
%
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 23
diff changeset
     4
% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 23
diff changeset
     5
% Copyright (c) 2005-2009, Prabhu Ramachandran
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 23
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     7
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     8
\documentclass[compress,14pt]{beamer}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     9
% \documentclass[handout]{beamer}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    10
% \usepackage{pgfpages}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    11
% \pgfpagesuselayout{4 on 1}[a4paper,border, shrink=5mm,landscape]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    12
\usepackage{tikz}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    13
\newcommand{\hyperlinkmovie}{}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    14
%\usepackage{movie15}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    15
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    16
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    17
% Note that in presentation mode 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    18
% \paperwidth  364.19536pt
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    19
% \paperheight 273.14662pt
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    20
% h/w = 0.888
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    21
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    23
\mode<presentation>
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    24
{
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    25
  \usetheme{CambridgeUS}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    26
  %\usetheme{Boadilla}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    27
  %\usetheme{default}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    28
  \useoutertheme{split}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    29
  \setbeamercovered{transparent}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    30
}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    31
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    32
% To remove navigation symbols
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    33
\setbeamertemplate{navigation symbols}{}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    34
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    35
\usepackage{amsmath}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    36
\usepackage[english]{babel}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    37
\usepackage[latin1]{inputenc}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    38
\usepackage{times}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    39
\usepackage[T1]{fontenc}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    40
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    41
% Taken from Fernando's slides.
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    42
\usepackage{ae,aecompl}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    43
\usepackage{mathpazo,courier,euler}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    44
\usepackage[scaled=.95]{helvet}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    45
\usepackage{pgf}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    46
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    47
\definecolor{darkgreen}{rgb}{0,0.5,0}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
\usepackage{listings}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
\lstset{language=Python,
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
    51
    basicstyle=\ttfamily\bfseries,
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
    52
    commentstyle=\color{red}\itshape,
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    53
  stringstyle=\color{darkgreen},
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    54
  showstringspaces=false,
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    55
  keywordstyle=\color{blue}\bfseries}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    56
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    57
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    58
% My Macros
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    59
\setbeamercolor{postit}{bg=yellow,fg=black}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    60
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    61
\newcommand{\emphbar}[1]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    62
{\begin{beamercolorbox}[rounded=true]{emphbar} 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    63
      {#1}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    64
 \end{beamercolorbox}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    65
}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    66
%{\centerline{\fcolorbox{gray!50} {blue!10}{
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    67
%\begin{minipage}{0.9\linewidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    68
%    {#1} 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    69
%\end{minipage}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    70
%    }}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    71
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    72
\newcommand{\myemph}[1]{\structure{\emph{#1}}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    73
\newcommand{\PythonCode}[1]{\lstinline{#1}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    74
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    75
\newcommand{\tvtk}{\texttt{tvtk}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    76
\newcommand{\mlab}{\texttt{mlab}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    77
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    78
\newcounter{time}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    79
\setcounter{time}{0}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    80
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\vspace*{0.1in}\tiny \thetime\ m}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    81
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    82
\newcommand\BackgroundPicture[1]{%
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    83
  \setbeamertemplate{background}{%
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    84
      \parbox[c][\paperheight]{\paperwidth}{%
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    85
      \vfill \hfill
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    86
 \hfill \vfill
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    87
}}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    88
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    89
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    90
% Configuring the theme
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    91
%\setbeamercolor{normal text}{fg=white}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    92
%\setbeamercolor{background canvas}{bg=black}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    93
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    94
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    95
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    96
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    97
% Title page
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    98
\title[]{3D data Vizualization\\ \& \\Test Driven Approach}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    99
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   100
\author[FOSSEE Team] {Asokan Pichai\\Prabhu Ramachandran}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   101
46
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 23
diff changeset
   102
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   103
\date[] {11, October 2009}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   104
\date[] % (optional)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   105
}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   106
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   107
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   108
%\pgfdeclareimage[height=0.75cm]{iitblogo}{iitblogo}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   109
%\logo{\pgfuseimage{iitblogo}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   110
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   111
\AtBeginSection[]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   112
{
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   113
  \begin{frame}<beamer>
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   114
    \frametitle{Outline}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   115
      \Large
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   116
    \tableofcontents[currentsection,currentsubsection]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   117
  \end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   118
}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   119
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   120
%% Delete this, if you do not want the table of contents to pop up at
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   121
%% the beginning of each subsection:
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   122
\AtBeginSubsection[]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   123
{
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   124
  \begin{frame}<beamer>
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   125
    \frametitle{Outline}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   126
    \tableofcontents[currentsection,currentsubsection]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   127
  \end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   128
}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   129
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   130
\AtBeginSection[]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   131
{
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   132
  \begin{frame}<beamer>
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   133
    \frametitle{Outline}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   134
    \tableofcontents[currentsection,currentsubsection]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   135
  \end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   136
}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   137
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   138
% DOCUMENT STARTS
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   139
\begin{document}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   140
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   141
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   142
  \maketitle
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   143
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   144
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   145
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   146
  \frametitle{Outline}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   147
  \Large
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   148
  \tableofcontents
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   149
  % You might wish to add the option [pausesections]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   150
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   151
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   152
\section{3D Data Visualization}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   153
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   154
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   155
    \frametitle{What is visualization?}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   156
    \Large
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   157
    \begin{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   158
    Visual representation of data
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   159
    \end{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   160
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   161
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   162
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   163
    \frametitle{3D visualization}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   164
    \Large
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   165
    \begin{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   166
        Harder but important
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   167
    \end{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   168
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   169
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   170
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   171
    \frametitle{Is this Graphics?}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   172
    \Large
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   173
    \begin{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   174
        Visualization is about data!
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   175
    \end{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   176
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   177
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   178
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   179
    \frametitle{Examples: trajectory in space}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   180
    \Large
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   181
    \begin{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   182
        \pgfimage[width=2.5in]{MEDIA/m2/mlab/plot3d_ex}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   183
    \end{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   184
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   185
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   186
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   187
    \frametitle{Examples: Fire in a room}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   188
    \Large
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   189
    \begin{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   190
        Demo of data
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   191
    \end{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   192
\inctime{10}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   193
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   194
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   195
\section{Tools at your disposal:}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   196
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   197
\subsection{mlab}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   198
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   199
\begin{frame}
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   200
    {Overview}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   201
    \Large
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   202
    \begin{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   203
        \item Simple
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   204
        \item Convenient
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   205
        \item Full-featured
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   206
    \end{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   207
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   208
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   209
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   210
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   211
    \frametitle{Getting started}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   212
    \myemph{\Large Vanilla:}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   213
    \begin{lstlisting}[language=bash]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   214
        $ ipython -wthread
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   215
    \end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   216
    \myemph{\Large with Pylab:}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   217
    \begin{lstlisting}[language=bash]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   218
        $ ipython -pylab -wthread
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   219
    \end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   220
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   221
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   222
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   223
    \frametitle{Using mlab:}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   224
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   225
    \begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   226
>>> from enthought.mayavi import mlab
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   227
    \end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   228
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   229
    \vspace*{0.5in}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   230
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   231
    \myemph{\Large Try these:}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   232
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   233
    \vspace*{0.25in}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   234
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   235
    \begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   236
>>> mlab.test_<TAB>
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   237
>>> mlab.test_contour3d()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   238
>>> mlab.test_contour3d??
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   239
    \end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   240
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   241
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   242
\begin{frame}
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   243
    {Exploring the view}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   244
    \begin{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   245
        \column{0.6\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   246
    \pgfimage[width=3in]{MEDIA/m2/contour3d}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   247
        \column{0.4\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   248
        \begin{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   249
            \item Mouse
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   250
            \item Keyboard
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   251
            \item Toolbar
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   252
            \item Mayavi icon(wait for it...) \pgfimage[width=0.2in]{MEDIA/m2/m2_icon}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   253
        \end{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   254
    \end{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   255
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   256
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   257
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   258
    \frametitle{\mlab\ plotting functions}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   259
    \begin{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   260
        \column{0.25\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   261
        \myemph{\Large 0D data}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   262
        \column{0.5\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   263
    \pgfimage[width=2in]{MEDIA/m2/mlab/points3d_ex}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   264
    \end{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   265
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   266
    \begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   267
>>> from numpy import *
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   268
>>> t = linspace(0, 2*pi, 50)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   269
>>> u = cos(t)*pi
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   270
>>> x, y, z = sin(u), cos(u), sin(t)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   271
    \end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   272
    \emphbar{\PythonCode{>>> mlab.points3d(x, y, z)}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   273
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   274
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   275
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   276
  \begin{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   277
        \column{0.25\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   278
        \myemph{\Large 1D data}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   279
        \column{0.5\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   280
        \pgfimage[width=2.5in]{MEDIA/m2/mlab/plot3d_ex}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   281
  \end{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   282
  \emphbar{\PythonCode{>>> mlab.plot3d(x, y, z, t)}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   283
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   284
    Plots lines between the points
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   285
    
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   286
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   287
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   288
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   289
    \begin{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   290
        \column{0.25\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   291
        \myemph{\Large 2D data}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   292
        \column{0.5\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   293
        \pgfimage[width=2in]{MEDIA/m2/mlab/surf_ex}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   294
    \end{columns}            
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   295
    \begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   296
>>> x = mgrid[-3:3:100j,-3:3:100j]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   297
>>> z = sin(x*x + y*y)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   298
    \end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   299
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   300
    \emphbar{\PythonCode{>>> mlab.surf(x, y, z)}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   301
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   302
    \alert{Assumes the points are rectilinear}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   303
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   304
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   305
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   306
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   307
    \myemph{\Large 2D data: \texttt{mlab.mesh}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   308
    \vspace*{0.25in}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   309
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   310
    \emphbar{\PythonCode{>>> mlab.mesh(x, y, z)}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   311
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   312
    \alert{Points needn't be regular}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   313
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   314
    \vspace*{0.25in}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   315
\begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   316
>>> phi, theta = numpy.mgrid[0:pi:20j, 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   317
...                         0:2*pi:20j]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   318
>>> x = sin(phi)*cos(theta)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   319
>>> y = sin(phi)*sin(theta)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   320
>>> z = cos(phi)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   321
>>> mlab.mesh(x, y, z, 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   322
...           representation='wireframe')
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   323
\end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   324
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   325
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   326
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   327
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   328
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   329
  \begin{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   330
        \column{0.25\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   331
        \myemph{\Large 3D data}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   332
        \column{0.5\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   333
        \pgfimage[width=1.5in]{MEDIA/m2/mlab/contour3d}\\        
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   334
    \end{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   335
\begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   336
>>> x, y, z = ogrid[-5:5:64j, 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   337
...                -5:5:64j, 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   338
...                -5:5:64j]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   339
>>> mlab.contour3d(x*x*0.5 + y*y + 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   340
                   z*z*2)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   341
\end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   342
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   343
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   344
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   345
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   346
    \myemph{\Large 3D vector data: \PythonCode{mlab.quiver3d}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   347
    \vspace*{0.25in}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   348
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   349
    \pgfimage[width=2in]{MEDIA/m2/mlab/quiver3d_ex}\\
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   350
    
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   351
\begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   352
>>> mlab.test_quiver3d()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   353
\end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   354
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   355
\emphbar{\PythonCode{obj = mlab.quiver3d(x, y, z, u, v, w)}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   356
\inctime{20}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   357
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   358
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   359
\subsection{Mayavi2.0}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   360
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   361
\begin{frame}
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   362
  \frametitle{Introduction to Mayavi}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   363
  \begin{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   364
  \item Most scientists not interested in details of visualization
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   365
  \item Visualization of data files with a nice UI
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   366
  \item Interactive visualization of data (think Matlab)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   367
  \item Embedding visualizations in applications
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   368
  \item Customization
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   369
  \end{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   370
  \pause
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   371
  \begin{block}{The Goal}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   372
      Provide a \alert{flexible} library/app for every one of these needs!
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   373
  \end{block}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   374
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   375
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   376
\begin{frame}
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   377
    {Overview of features}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   378
      \vspace*{-0.3in}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   379
  \begin{center}    
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   380
    \hspace*{-0.2in}\pgfimage[width=5in]{MEDIA/m2/m2_app3_3}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   381
  \end{center}    
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   382
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   383
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   384
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   385
\begin{frame}
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   386
    \frametitle{Mayavi in applications}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   387
      \vspace*{-0.3in}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   388
  \begin{center}    
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   389
    \hspace*{0.2in}\pgfimage[width=4.5in]{MEDIA/m2/m2_envisage}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   390
  \end{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   391
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   392
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   393
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   394
    {Exploring the documentation}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   395
    \begin{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   396
    \pgfimage[width=4.5in]{MEDIA/m2/m2_ug_doc}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   397
    \end{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   398
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   399
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   400
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   401
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   402
  \frametitle{Summary}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   403
      \begin{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   404
          \item \url{http://code.enthought.com/projects/mayavi}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   405
          \item Uses VTK (\url{www.vtk.org})
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   406
          \item BSD license
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   407
          \item Linux, win32 and Mac OS X
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   408
          \item Highly scriptable
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   409
          \item Embed in Traits UIs (wxPython and PyQt4)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   410
          \item Envisage Plugins
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   411
          \item Debian/Ubuntu/Fedora
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   412
          \item \alert{Pythonic}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   413
      \end{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   414
    
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   415
      \inctime{10}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   416
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   417
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   418
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   419
\begin{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   420
    {Getting hands dirty!}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   421
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   422
        \begin{block}{Motivational problem}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   423
        Atmospheric data of temperature over the surface of the earth.
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   424
        Let temperature ($T$) vary linearly with height ($z$):
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   425
        \begin{center}            
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   426
        $T = 288.15 - 6.5z$
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   427
        \end{center}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   428
        \end{block}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   429
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   430
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   431
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   432
    \frametitle{Simple solution}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   433
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   434
    \begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   435
lat = linspace(-89, 89, 37)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   436
lon = linspace(0, 360, 37)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   437
z = linspace(0, 100, 11)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   438
    \end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   439
\pause
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   440
    \begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   441
x, y, z = mgrid[0:360:37j,-89:89:37j,
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   442
                0:100:11j]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   443
t = 288.15 - 6.5*z
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   444
mlab.contour3d(x, y, z, t)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   445
mlab.outline()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   446
mlab.colorbar()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   447
    \end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   448
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   449
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   450
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   451
    \frametitle{Exercise: Lorenz equation}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   452
    \begin{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   453
        \column{0.25\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   454
        \begin{eqnarray*}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   455
        \frac{d x}{dt} &=& s (y-x)\\
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   456
        \frac{d y}{d t} &=& rx -y -xz\\
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   457
        \frac{d z}{d t} &=& xy - bz\\
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   458
        \end{eqnarray*}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   459
        \column{0.25\textwidth}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   460
        Let $s=10,$
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   461
        $r=28,$ 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   462
        $b=8./3.$
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   463
    \end{columns}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   464
    \structure{\Large Region of interest}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   465
  \begin{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   466
x, y, z = mgrid[-50:50:20j,-50:50:20j,
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   467
                -10:60:20j]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   468
  \end{lstlisting}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   469
\inctime{20}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   470
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   471
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   472
\section{Test Driven Approach}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   473
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   474
\begin{frame}
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   475
    \frametitle{Testing code with \typ{nosetests}}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   476
   
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   477
    \begin{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   478
        \item Writing tests is really simple!
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   479
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   480
        \item Using nose
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   481
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   482
        \item Example!
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   483
    \end{itemize}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   484
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   485
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   486
\begin{frame}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   487
    \frametitle{Need of Testing!}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   488
   
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   489
    \begin{itemize}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   490
        \item Quality
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   491
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   492
        \item Regression
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   493
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   494
        \item Documentation
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   495
    \end{itemize}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   496
\end{frame}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   497
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   498
\begin{frame}[fragile]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   499
    \frametitle{Nosetest}
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   500
  \begin{lstlisting}
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   501
def gcd(a, b):
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   502
    """Returns gcd of a and b, 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   503
     handles only positive numbers."""
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   504
    if a%b == 0: return b
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   505
    return gcd(b, a%b)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   506
def lcm(a, b):
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   507
    return a*b/gcd(a, b)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   508
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   509
if __name__ == '__main__':
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   510
    import nose
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   511
    nose.main()
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   512
  \end{lstlisting}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   513
\inctime{15}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   514
\end{frame}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   515
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   516
\begin{frame}[fragile]
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   517
    \frametitle{Example}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   518
    \begin{block}{Problem Statement:}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   519
      Write a function to check whether a given input
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   520
      string is a palindrome.
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   521
    \end{block}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   522
\end{frame}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   523
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   524
\begin{frame}[fragile]
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   525
    \frametitle{Function: code.py}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   526
\begin{lstlisting}    
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   527
def is_palindrome(input_str):
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   528
  return input_str == input_str[::-1]
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   529
\end{lstlisting}    
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   530
\end{frame}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   531
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   532
\begin{frame}[fragile]
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   533
    \frametitle{Test for the palindrome: code.py}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   534
\begin{lstlisting}    
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   535
from code import is_palindrome
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   536
def test_function_normal_words():
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   537
  input = "noon"
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   538
  assert is_palindrome(input) == True
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   539
\end{lstlisting}    
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   540
\end{frame}
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   541
23
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   542
\begin{frame}[fragile]
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   543
    \frametitle{Running the tests.}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   544
\begin{lstlisting}    
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   545
$ nosetests test.py 
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   546
.
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   547
----------------------------------------------
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   548
Ran 1 test in 0.001s
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   549
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   550
OK
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   551
\end{lstlisting}    
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   552
\end{frame}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   553
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   554
\begin{frame}[fragile]
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   555
    \frametitle{Exercise: Including new tests.}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   556
\begin{lstlisting}    
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   557
def test_function_ignore_cases_words():
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   558
  input = "Noon"
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   559
  assert is_palindrome(input) == True
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   560
\end{lstlisting}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   561
Check
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   562
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   563
\PythonCode{$ nosetests test.py} 
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   564
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   565
Tweak the code to pass this test.
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   566
\end{frame}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   567
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   568
\begin{frame}[fragile]
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   569
    \frametitle{Exercise: Some more tests.}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   570
\begin{lstlisting}    
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   571
def test_function_ignore_spaces_in_text():
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   572
    input = "ab raca carba"
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   573
    assert is_palindrome(input) == True
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   574
\end{lstlisting}
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   575
Check
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   576
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   577
\PythonCode{$ nosetests test.py} 
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   578
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   579
Tweak the code to pass this test.
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   580
14c817585247 Added Exercise for testing in Session3.
Shantanu <shantanu@fossee.in>
parents: 22
diff changeset
   581
\inctime{15} 
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   582
\end{frame}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   583
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   584
\end{document}
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   585