day2/session3.tex
author Christopher Burns <chris.d.burns@gmail.com>
Tue, 29 Jun 2010 01:40:24 -0500
branchscipy2010
changeset 434 99e1af343b04
parent 431 9126059d6b37
child 451 db7b23465572
permissions -rw-r--r--
DOC: More slides on whitespace.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     2
%Tutorial slides on Python.
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     3
%
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     4
% Author: FOSSEE 
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     5
% Copyright (c) 2009, FOSSEE, IIT Bombay
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     7
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     8
\documentclass[14pt,compress]{beamer}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     9
%\documentclass[draft]{beamer}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    10
%\documentclass[compress,handout]{beamer}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    11
%\usepackage{pgfpages} 
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    13
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    15
\mode<presentation>
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    16
{
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    17
  \usetheme{Warsaw}
239
8953675dc056 Added slide numbers.
Puneeth Chaganti <punchagan@fossee.in>
parents: 220
diff changeset
    18
  \useoutertheme{infolines}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    20
}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    21
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    22
\usepackage[english]{babel}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    24
%\usepackage{times}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    26
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    27
% Taken from Fernando's slides.
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    30
\usepackage[scaled=.95]{helvet}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    31
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    32
\definecolor{darkgreen}{rgb}{0,0.5,0}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    33
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    34
\usepackage{listings}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    35
\lstset{language=Python,
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    36
    basicstyle=\ttfamily\bfseries,
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    37
    commentstyle=\color{red}\itshape,
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    38
  stringstyle=\color{darkgreen},
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    39
  showstringspaces=false,
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    40
  keywordstyle=\color{blue}\bfseries}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    41
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    43
% Macros
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    44
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    45
\newcommand{\emphbar}[1]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    46
{\begin{beamercolorbox}[rounded=true]{emphbar} 
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    47
      {#1}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
 \end{beamercolorbox}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
\newcounter{time}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    51
\setcounter{time}{0}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    52
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    53
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
    54
\newcommand{\typ}[1]{\lstinline{#1}}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    55
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    56
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    57
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    58
%%% This is from Fernando's setup.
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    59
% \usepackage{color}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    60
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    61
% % Use and configure listings package for nicely formatted code
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    62
% \usepackage{listings}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    63
% \lstset{
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    64
%    language=Python,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    65
%    basicstyle=\small\ttfamily,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    66
%    commentstyle=\ttfamily\color{blue},
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    67
%    stringstyle=\ttfamily\color{orange},
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    68
%    showstringspaces=false,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    69
%    breaklines=true,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    70
%    postbreak = \space\dots
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    71
% }
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    72
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    73
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    75
% Title page
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
    76
\title[Basic Python]{Python language: Functions, modules and objects}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    77
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    78
\author[FOSSEE Team] {The FOSSEE Group}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    79
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    80
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
389
aa392117454f Changed dates for MVIT workshop.
Puneeth Chaganti <punchagan@gmail.com>
parents: 385
diff changeset
    81
\date[] {1 May, 2010\\Day 2, Session 3}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    82
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    83
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    84
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    85
%\logo{\pgfuseimage{iitmlogo}}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    86
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    87
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    88
%% Delete this, if you do not want the table of contents to pop up at
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    89
%% the beginning of each subsection:
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    90
\AtBeginSubsection[]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    91
{
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    92
  \begin{frame}<beamer>
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    93
    \frametitle{Outline}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    94
    \tableofcontents[currentsection,currentsubsection]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    95
  \end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    96
}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    97
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    98
\AtBeginSection[]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    99
{
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   100
  \begin{frame}<beamer>
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   101
    \frametitle{Outline}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   102
    \tableofcontents[currentsection,currentsubsection]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   103
  \end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   104
}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   105
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   106
% If you wish to uncover everything in a step-wise fashion, uncomment
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   107
% the following command: 
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   108
%\beamerdefaultoverlayspecification{<+->}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   109
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   110
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   111
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   112
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   113
% DOCUMENT STARTS
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   114
\begin{document}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   115
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   116
\begin{frame}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   117
  \titlepage
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   118
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   119
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   120
\begin{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   121
  \frametitle{Outline}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   122
  \tableofcontents
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   123
  % You might wish to add the option [pausesections]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   124
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   125
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   126
\section{Functions}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   127
\subsection{Default arguments}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   128
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   129
  \frametitle{Functions: default arguments}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   130
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   131
In []: greet = 'hello world'
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   132
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   133
In []: greet.split()
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   134
Out[]: ['hello', 'world']
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   135
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   136
In []: line = 'Rossum, Guido, 54, 46, 55'
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   137
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   138
In []: line.split(',')
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   139
Out[]: ['Rossum', ' Guido', ' 54',
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   140
                        ' 46', ' 55']
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   141
  \end{lstlisting}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   142
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   143
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   144
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   145
  \frametitle{Functions: default arguments \ldots}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   146
  \begin{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   147
In []: def welcome(greet, name="World"):
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   148
  ....     print greet, name
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   149
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   150
In []: welcome("Hello")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   151
Hello World
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   152
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   153
In []: welcome("Hi", "Guido")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   154
Hi Guido
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   155
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   156
\end{frame} 
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   157
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   158
\subsection{Keyword arguments}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   159
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   160
  \frametitle{Functions: Keyword arguments}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   161
We have seen the following
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   162
\begin{lstlisting}
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   163
legend(['sin(2y)'], loc = 'center')
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   164
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   165
plot(y, sin(y), 'g', linewidth = 2)
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   166
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   167
annotate('local max', xy = (1.5, 1))
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   168
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   169
pie(science.values(), 
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   170
            labels = science.keys())
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   171
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   172
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   173
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   174
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   175
  \frametitle{Functions: keyword arguments \ldots}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   176
  \begin{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   177
In []: def welcome(greet, name="World"):
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   178
  ....     print greet, name
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   179
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   180
In []: welcome("Hello", "James")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   181
Hello James
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   182
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   183
In []: welcome("Hi", name="Guido")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   184
Hi Guido
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   185
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   186
In []: welcome(name="Guido", greet="Hey")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   187
Hey Guido
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   188
  \end{lstlisting}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   189
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   190
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   191
\subsection{Built-in functions}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   192
\begin{frame}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   193
  {Before writing a function}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   194
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   195
      \item Variety of built-in functions are available
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   196
      \item \typ{abs, any, all, len, max, min}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   197
      \item \typ{pow, range, sum, type}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   198
      \item Refer here:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   199
          \url{http://docs.python.org/library/functions.html}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   200
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   201
  \inctime{10} 
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   202
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   203
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   204
\subsection{Exercises}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   205
\begin{frame}{Problem set 3: Problem 3.1}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   206
  Write a function to return the gcd of two numbers.
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   207
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   208
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   209
\begin{frame}{Problem 3.2}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   210
Write a program to print all primitive pythagorean triads (a, b, c) where a, b are in the range 1---100 \\
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   211
A pythagorean triad $(a,b,c)$ has the property $a^2 + b^2 = c^2$.\\By primitive we mean triads that do not `depend' on others. For example, (4,3,5) is a variant of (3,4,5) and hence is not primitive. And (10,24,26) is easily derived from (5,12,13) and is also not primitive.
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   212
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   213
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   214
\begin{frame}{Problem 3.3}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   215
  Write a program that generates a list of all four digit numbers that have all their digits even and are perfect squares.\newline\\\emph{For example, the output should include 6400 but not 8100 (one digit is odd) or 4248 (not a perfect square).}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   216
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   217
\inctime{15}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   218
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   219
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   220
\section{Modules}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   221
\begin{frame}[fragile]
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   222
  \frametitle{\texttt{from} \ldots \texttt{import} magic}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   223
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   224
from scipy.integrate import odeint
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   225
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   226
from scipy.optimize import fsolve
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   227
  \end{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   228
\emphbar{Above statements import a function to our namespace}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   229
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   230
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   231
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   232
  \frametitle{Running scripts from command line}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   233
  \small
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   234
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   235
    \item Fire up a terminal
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   236
    \item python four\_plot.py
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   237
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   238
  \pause
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   239
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   240
Traceback (most recent call last):
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   241
  File "four_plot.py", line 1, in <module>
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   242
    x = linspace(-5*pi, 5*pi, 500)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   243
NameError: name 'linspace' is not defined
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   244
  \end{lstlisting}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   245
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   246
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   247
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   248
  \frametitle{Remedy \ldots}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   249
  \begin{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   250
from scipy import *
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   251
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   252
\alert{Now run python four\_plot.py again}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   253
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   254
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   255
\begin{frame}[fragile]
380
669b72283b55 Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   256
  \frametitle{Now what?}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   257
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   258
Traceback (most recent call last):
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   259
  File "four_plot.py", line 1, in <module>
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   260
    x = plot(x, x, 'b')
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   261
NameError: name 'plot' is not defined
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   262
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   263
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   264
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   265
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   266
  \frametitle{Remedy \ldots}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   267
  \begin{lstlisting}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   268
from pylab import *
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   269
  \end{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   270
\alert{Now run python four\_plot.py again!!}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   271
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   272
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   273
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   274
  \frametitle{Modules}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   275
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   276
    \item The \kwrd{import} keyword ``loads'' a module
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   277
    \item One can also use:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   278
      \begin{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   279
In []: from scipy import *
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   280
In []: from scipy import linspace
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   281
      \end{lstlisting}    
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   282
    \item What is the difference?
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   283
    \item \alert{Use the former only in interactive mode}
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   284
    \end{itemize}
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   285
\end{frame}
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   286
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   287
\begin{frame}[fragile]
429
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   288
  \frametitle{IPython namespace}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   289
  \begin{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   290
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   291
In [4]: whos
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   292
Interactive namespace is empty.
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   293
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   294
  \end{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   295
\end{frame}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   296
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   297
\begin{frame}[fragile]
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   298
  \frametitle{IPython namespace}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   299
  \begin{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   300
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   301
In [5]: from numpy import *
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   302
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   303
In [6]: whos
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   304
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   305
  \end{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   306
\end{frame}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   307
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   308
\begin{frame}[fragile]
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   309
  \frametitle{Package hierarchies}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   310
  \begin{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   311
from scipy.integrate import odeint
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   312
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   313
from scipy.optimize import fsolve
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   314
  \end{lstlisting}
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   315
\end{frame}
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   316
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   317
\begin{frame}[fragile]
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   318
  \frametitle{\texttt{from} \ldots \texttt{import} - conventional way!}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   319
  \small
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   320
  \begin{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   321
from scipy import linspace, pi, sin
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   322
from pylab import plot, legend, annotate
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   323
from pylab import xlim, ylim
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   324
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   325
x = linspace(-5*pi, 5*pi, 500)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   326
plot(x, x, 'b')
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   327
plot(x, -x, 'b')
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   328
plot(x, sin(x), 'g', linewidth=2)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   329
plot(x, x*sin(x), 'r', linewidth=3)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   330
legend(['x', '-x', 'sin(x)', 'xsin(x)'])
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   331
annotate('origin', xy = (0, 0))
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   332
xlim(-5*pi, 5*pi)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   333
ylim(-5*pi, 5*pi)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   334
  \end{lstlisting}
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   335
\end{frame}
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   336
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   337
\begin{frame}[fragile]
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   338
  \frametitle{\texttt{from} \ldots \texttt{import} - conventional way!}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   339
  \small
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   340
  \begin{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   341
import scipy
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   342
import pylab
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   343
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   344
x = scipy.linspace(-5*scipy.pi, 5*scipy.pi, 500)
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   345
pylab.plot(x, x, 'b')
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   346
pylab.plot(x, -x, 'b')
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   347
pylab.plot(x, scipy.sin(x), 'g', linewidth=2)
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   348
pylab.plot(x, x*scipy.sin(x), 'r', linewidth=3)
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   349
pylab.legend(['x', '-x', 'sin(x)', 'xsin(x)'])
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   350
pylab.annotate('origin', xy = (0, 0))
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   351
pylab.xlim(-5*scipy.pi, 5*scipy.pi)
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   352
pylab.ylim(-5*scipy.pi, 5*scipy.pi)
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   353
  \end{lstlisting}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   354
\end{frame}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents: 215
diff changeset
   355
429
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   356
\begin{frame}[fragile]
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   357
  \frametitle{\texttt{import} - the community convention}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   358
  \begin{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   359
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   360
import numpy as np
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   361
np.linspace(-5 * np.pi, 5 * np.pi, 500)
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   362
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   363
import scipy as sp
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   364
sp.linspace(-5 * sp.pi, 5 * sp.pi, 500)
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   365
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   366
  \end{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   367
\end{frame}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   368
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents: 215
diff changeset
   369
\begin{frame}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   370
  \frametitle{Modules: Standard library}
220
15306dad3b81 Corrections to day1 Session1, day2 Session 3 and 4.
Shantanu <shantanu@fossee.in>
parents: 219
diff changeset
   371
  \begin{itemize}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   372
  \item Very powerful, ``Batteries included''
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   373
  \item Some standard modules:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   374
    \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   375
    \item Math: \typ{math}, \typ{random}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   376
    \item Internet access: \typ{urllib2}, \typ{smtplib}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   377
    \item System, Command line arguments: \typ{sys}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   378
    \item Operating system interface: \typ{os}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   379
    \item Regular expressions: \typ{re}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   380
    \item Compression: \typ{gzip}, \typ{zipfile}, and \typ{tarfile}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   381
    \item And a whole lot more!
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   382
    \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   383
  \item Check out the Python Library reference:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   384
    \url{http://docs.python.org/library/}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   385
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   386
\inctime{5}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   387
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   388
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   389
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   390
  \frametitle{Modules of special interest}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   391
  \begin{description}[matplotlibfor2d]
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   392
    \item[\texttt{pylab}] Easy, interactive, 2D plotting
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   393
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   394
    \item[\texttt{scipy}] arrays, statistics, optimization, integration, linear
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   395
            algebra, Fourier transforms, signal and image processing,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   396
            genetic algorithms, ODE solvers, special functions, and more
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   397
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   398
    \item[\texttt{Mayavi}] Easy, interactive, 3D plotting
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   399
  \end{description}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   400
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   401
431
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   402
\begin{frame}[fragile]
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   403
  \frametitle{From which module?}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   404
  
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   405
This plot function in pylab is cool, 
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   406
from where do I import it to include it in 
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   407
my\_nifty\_module.py?
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   408
  
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   409
\end{frame}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   410
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   411
\begin{frame}[fragile]
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   412
  \frametitle{From which module?}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   413
  \begin{lstlisting}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   414
   
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   415
In [15]: plot.__module__
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   416
Out[15]: 'matplotlib.pyplot'
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   417
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   418
from matplotlib.pyplot import plot
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   419
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   420
  \end{lstlisting}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   421
\end{frame}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   422
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   423
\section{Objects}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   424
\begin{frame}{Everything is an Object!}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   425
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   426
    \item \typ{int}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   427
    \item \typ{float}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   428
    \item \typ{str}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   429
    \item \typ{list}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   430
    \item \typ{tuple}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   431
    \item \typ{string}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   432
    \item \typ{dictionary}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   433
    \item \typ{function}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   434
    \item User defined class is also an object!
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   435
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   436
\end {frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   437
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   438
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   439
\frametitle{Using Objects}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   440
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   441
    \item Creating Objects
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   442
    \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   443
      \item Initialization
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   444
    \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   445
    \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   446
In []: a = str()
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   447
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   448
In []: b = "Hello World"
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   449
    \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   450
    \item Object Manipulation
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   451
    \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   452
      \item Object methods
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   453
      \item ``.'' operator
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   454
    \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   455
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   456
In []: "Hello World".split()
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   457
Out[]: ['Hello', 'World']
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   458
    \end{lstlisting}
220
15306dad3b81 Corrections to day1 Session1, day2 Session 3 and 4.
Shantanu <shantanu@fossee.in>
parents: 219
diff changeset
   459
  \end{itemize}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents: 215
diff changeset
   460
\end{frame}
220
15306dad3b81 Corrections to day1 Session1, day2 Session 3 and 4.
Shantanu <shantanu@fossee.in>
parents: 219
diff changeset
   461
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   462
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   463
  \frametitle{Objects provide consistency}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   464
  \small
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   465
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   466
for element in (1, 2, 3):
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   467
    print element
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   468
for key in {'one':1, 'two':2}:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   469
    print key
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   470
for char in "123":
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   471
    print char
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   472
for line in open("myfile.txt"):
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   473
    print line
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   474
for line in urllib2.urlopen('http://site.com'):
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   475
    print line
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   476
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   477
  \inctime{10}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   478
\end{frame}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   479
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   480
\begin{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   481
  \frametitle{What did we learn?}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   482
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   483
    \item Functions: Default and Keyword arguments
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   484
    \item Modules
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   485
    \item Objects
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   486
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   487
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   488
330
46533051b9d3 commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents: 300
diff changeset
   489
\end{document}
344
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   490
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   491
%% Questions for Quiz %%
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   492
%% ------------------ %%
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   493
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   494
\begin{frame}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   495
    \frametitle{\incqno}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   496
  How many items can a function return?
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   497
\end{frame}