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