author | Santosh G. Vattam <vattam.santosh@gmail.com> |
Fri, 09 Oct 2009 16:59:30 +0530 | |
changeset 91 | aa271f590e24 |
parent 84 | 338b85a9c864 |
child 96 | a749db24e73b |
permissions | -rw-r--r-- |
35
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
2 |
% Tutorial slides on Python. |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
3 |
% |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
4 |
% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in> |
46
63704b5650f1
Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
41
diff
changeset
|
5 |
% Copyright (c) 2005-2009, Prabhu Ramachandran |
35
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
7 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
8 |
\documentclass[14pt,compress]{beamer} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
9 |
%\documentclass[draft]{beamer} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
10 |
%\documentclass[compress,handout]{beamer} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
11 |
%\usepackage{pgfpages} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
12 |
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm] |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
13 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
14 |
% Modified from: generic-ornate-15min-45min.de.tex |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
15 |
\mode<presentation> |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
16 |
{ |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
17 |
\usetheme{Warsaw} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
18 |
\useoutertheme{split} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
19 |
\setbeamercovered{transparent} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
20 |
} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
21 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
22 |
\usepackage[english]{babel} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
23 |
\usepackage[latin1]{inputenc} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
24 |
%\usepackage{times} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
25 |
\usepackage[T1]{fontenc} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
26 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
27 |
% Taken from Fernando's slides. |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
28 |
\usepackage{ae,aecompl} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
29 |
\usepackage{mathpazo,courier,euler} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
30 |
\usepackage[scaled=.95]{helvet} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
31 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
32 |
\definecolor{darkgreen}{rgb}{0,0.5,0} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
33 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
34 |
\usepackage{listings} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
35 |
\lstset{language=Python, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
36 |
basicstyle=\ttfamily\bfseries, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
37 |
commentstyle=\color{red}\itshape, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
38 |
stringstyle=\color{darkgreen}, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
39 |
showstringspaces=false, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
40 |
keywordstyle=\color{blue}\bfseries} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
41 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
42 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
43 |
% Macros |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
44 |
\setbeamercolor{emphbar}{bg=blue!20, fg=black} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
45 |
\newcommand{\emphbar}[1] |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
46 |
{\begin{beamercolorbox}[rounded=true]{emphbar} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
47 |
{#1} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
48 |
\end{beamercolorbox} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
49 |
} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
50 |
\newcounter{time} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
51 |
\setcounter{time}{0} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
52 |
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
53 |
|
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
54 |
\newcommand{\typ}[1]{\lstinline{#1}} |
35
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
55 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
56 |
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} } |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
57 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
58 |
%%% This is from Fernando's setup. |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
59 |
% \usepackage{color} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
60 |
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
61 |
% % Use and configure listings package for nicely formatted code |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
62 |
% \usepackage{listings} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
63 |
% \lstset{ |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
64 |
% language=Python, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
65 |
% basicstyle=\small\ttfamily, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
66 |
% commentstyle=\ttfamily\color{blue}, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
67 |
% stringstyle=\ttfamily\color{orange}, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
68 |
% showstringspaces=false, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
69 |
% breaklines=true, |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
70 |
% postbreak = \space\dots |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
71 |
% } |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
72 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
73 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
74 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
75 |
% Title page |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
76 |
\title[]{Numerical Computing with Numpy \& Scipy} |
35
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
77 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
78 |
\author[FOSSEE Team] {Asokan Pichai\\Prabhu Ramachandran} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
79 |
|
46
63704b5650f1
Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
41
diff
changeset
|
80 |
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} |
35
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
81 |
\date[] {11, October 2009} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
82 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
83 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
84 |
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
85 |
%\logo{\pgfuseimage{iitmlogo}} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
86 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
87 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
88 |
%% Delete this, if you do not want the table of contents to pop up at |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
89 |
%% the beginning of each subsection: |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
90 |
\AtBeginSubsection[] |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
91 |
{ |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
92 |
\begin{frame}<beamer> |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
93 |
\frametitle{Outline} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
94 |
\tableofcontents[currentsection,currentsubsection] |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
95 |
\end{frame} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
96 |
} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
97 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
98 |
\AtBeginSection[] |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
99 |
{ |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
100 |
\begin{frame}<beamer> |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
101 |
\frametitle{Outline} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
102 |
\tableofcontents[currentsection,currentsubsection] |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
103 |
\end{frame} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
104 |
} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
105 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
106 |
% If you wish to uncover everything in a step-wise fashion, uncomment |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
107 |
% the following command: |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
108 |
%\beamerdefaultoverlayspecification{<+->} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
109 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
110 |
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
111 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
112 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
113 |
% DOCUMENT STARTS |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
114 |
\begin{document} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
115 |
|
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
116 |
\begin{frame} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
117 |
\maketitle |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
118 |
\end{frame} |
71
d0679d2f9339
Added section and subsections to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
67
diff
changeset
|
119 |
|
d0679d2f9339
Added section and subsections to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
67
diff
changeset
|
120 |
\section{Advanced Numpy} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
121 |
\begin{frame}[fragile] |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
122 |
\frametitle{Broadcasting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
123 |
Try it! |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
124 |
\begin{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
125 |
>>> a = np.arange(4) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
126 |
>>> b = np.arange(5) |
77
3cb7e25f7c0e
Edited Broadcasting slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
76
diff
changeset
|
127 |
>>> a+b #Does this work? |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
128 |
>>> a+3 |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
129 |
>>> c=np.array([3]) |
77
3cb7e25f7c0e
Edited Broadcasting slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
76
diff
changeset
|
130 |
>>> a+c #Works! |
3cb7e25f7c0e
Edited Broadcasting slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
76
diff
changeset
|
131 |
>>> b+c #But how? |
3cb7e25f7c0e
Edited Broadcasting slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
76
diff
changeset
|
132 |
>>> a.shape, b.shape, c.shape |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
133 |
\end{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
134 |
\begin{itemize} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
135 |
\item Enter Broadcasting! |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
136 |
\end{itemize} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
137 |
\end{frame} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
138 |
|
35
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
139 |
\begin{frame}[fragile] |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
140 |
\frametitle{Broadcasting} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
141 |
\begin{columns} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
142 |
\column{0.65\textwidth} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
143 |
\hspace*{-1.5in} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
144 |
\begin{lstlisting} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
145 |
>>> a = np.arange(4) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
146 |
>>> a+3 |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
147 |
array([3, 4, 5, 6]) |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
148 |
\end{lstlisting} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
149 |
\column{0.35\textwidth} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
150 |
\includegraphics[height=0.7in, interpolate=true]{data/broadcast_scalar} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
151 |
\end{columns} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
152 |
\begin{itemize} |
82
e352b67ab357
Minor edits to Copies and Views.
Puneeth Chaganti <punchagan@fossee.in>
parents:
77
diff
changeset
|
153 |
\item Allows functions to take inputs that are not of the same shape |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
154 |
\item 2 rules - |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
155 |
\begin{enumerate} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
156 |
\item 1 is (repeatedly) prepended to shapes of smaller arrays |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
157 |
\item Size 1 in a dimension changed to Largest size in that dimension |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
158 |
\end{enumerate} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
159 |
\end{itemize} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
160 |
\end{frame} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
161 |
|
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
162 |
\begin{frame}[fragile] |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
163 |
\frametitle{Broadcasting in 3D} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
164 |
\begin{lstlisting} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
165 |
>>> x = np.ones((3, 5)) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
166 |
>>> y = np.ones(8) |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
167 |
>>> (x[..., None] + y).shape |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
168 |
(3, 5, 8) |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
169 |
\end{lstlisting} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
170 |
\begin{figure} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
171 |
\begin{center} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
172 |
\includegraphics[height=1.5in, interpolate=true]{data/array_3x5x8} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
173 |
\end{center} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
174 |
\end{figure} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
175 |
\end{frame} |
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
176 |
|
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
177 |
\begin{frame}[fragile] |
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
178 |
\frametitle{Copies \& Views} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
179 |
Try it! |
82
e352b67ab357
Minor edits to Copies and Views.
Puneeth Chaganti <punchagan@fossee.in>
parents:
77
diff
changeset
|
180 |
\vspace{-0.1in} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
181 |
\begin{lstlisting} |
82
e352b67ab357
Minor edits to Copies and Views.
Puneeth Chaganti <punchagan@fossee.in>
parents:
77
diff
changeset
|
182 |
>>> a = np.arange(1,9); a.shape=3,3 |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
183 |
>>> b = a |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
184 |
>>> b is a |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
185 |
>>> b[0,0]=0; print a |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
186 |
>>> c = a.view() |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
187 |
>>> c is a |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
188 |
>>> c.base is a |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
189 |
>>> c.flags.owndata |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
190 |
>>> d = a.copy() |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
191 |
>>> d.base is a |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
192 |
>>> d.flags.owndata |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
193 |
\end{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
194 |
\end{frame} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
195 |
|
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
196 |
\begin{frame}[fragile] |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
197 |
\frametitle{Copies \& Views} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
198 |
Try it! |
82
e352b67ab357
Minor edits to Copies and Views.
Puneeth Chaganti <punchagan@fossee.in>
parents:
77
diff
changeset
|
199 |
\vspace{-0.1in} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
200 |
\begin{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
201 |
>>> b = a[0,1:3] |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
202 |
>>> c = a[0::2,0::2] |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
203 |
>>> a.flags.owndata |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
204 |
>>> b.flags.owndata |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
205 |
>>> b.base |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
206 |
>>> c.base is a |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
207 |
\end{lstlisting} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
208 |
\begin{itemize} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
209 |
\item Slicing and Striding just reference the same memory |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
210 |
\item They produce views of the data, not copies |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
211 |
\end{itemize} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
212 |
\end{frame} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
213 |
|
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
214 |
\begin{frame}[fragile] |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
215 |
\frametitle{Copies contd \ldots} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
216 |
\begin{lstlisting} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
217 |
>>> b = a[np.array([0,1,2])] |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
218 |
array([[1, 2, 3], |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
219 |
[4, 5, 6], |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
220 |
[7, 8, 9]]) |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
221 |
>>> b.flags.owndata |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
222 |
>>> abool=np.greater(a,2) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
223 |
>>> c = a[abool] |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
224 |
>>> c.flags.owndata |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
225 |
\end{lstlisting} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
226 |
\begin{itemize} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
227 |
\item Indexing arrays or Boolean arrays produce copies |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
228 |
\end{itemize} |
41
64177498937a
Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
37
diff
changeset
|
229 |
\inctime{15} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
230 |
\end{frame} |
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
231 |
|
71
d0679d2f9339
Added section and subsections to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
67
diff
changeset
|
232 |
\section{SciPy} |
d0679d2f9339
Added section and subsections to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
67
diff
changeset
|
233 |
\subsection{Introduction} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
234 |
\begin{frame} |
35
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
235 |
{Intro to SciPy} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
236 |
\begin{itemize} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
237 |
\item \url{http://www.scipy.org} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
238 |
\item Open source scientific libraries for Python |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
239 |
\item Based on NumPy |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
240 |
\end{itemize} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
241 |
\end{frame} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
242 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
243 |
\begin{frame} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
244 |
\frametitle{SciPy} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
245 |
\begin{itemize} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
246 |
\item Provides: |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
247 |
\begin{itemize} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
248 |
\item Linear algebra |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
249 |
\item Numerical integration |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
250 |
\item Fourier transforms |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
251 |
\item Signal processing |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
252 |
\item Special functions |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
253 |
\item Statistics |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
254 |
\item Optimization |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
255 |
\item Image processing |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
256 |
\item ODE solvers |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
257 |
\end{itemize} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
258 |
\item Uses LAPACK, QUADPACK, ODEPACK, FFTPACK etc. from netlib |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
259 |
\end{itemize} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
260 |
\end{frame} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
261 |
|
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
262 |
\begin{frame}[fragile] |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
263 |
\frametitle{SciPy - Functions \& Submodules} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
264 |
\begin{itemize} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
265 |
\item All \typ{numpy} functions are in \typ{scipy} namespace |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
266 |
\item Domain specific functions organized into subpackages |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
267 |
\item Subpackages need to be imported separately |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
268 |
\end{itemize} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
269 |
\begin{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
270 |
>>> from scipy import linalg |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
271 |
\end{lstlisting} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
272 |
\end{frame} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
273 |
|
71
d0679d2f9339
Added section and subsections to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
67
diff
changeset
|
274 |
\subsection{Linear Algebra} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
275 |
\begin{frame}[fragile] |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
276 |
\frametitle{Linear Algebra} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
277 |
Try it! |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
278 |
\begin{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
279 |
>>> import scipy as sp |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
280 |
>>> from scipy import linalg |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
281 |
>>> A=sp.mat(np.arange(1,10)) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
282 |
>>> A.shape=3,3 |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
283 |
>>> linalg.inv(A) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
284 |
>>> linalg.det(A) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
285 |
>>> linalg.norm(A) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
286 |
>>> linalg.expm(A) #logm |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
287 |
>>> linalg.sinm(A) #cosm, tanm, ... |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
288 |
\end{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
289 |
\end{frame} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
290 |
|
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
291 |
\begin{frame}[fragile] |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
292 |
\frametitle{Linear Algebra ...} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
293 |
Try it! |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
294 |
\begin{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
295 |
>>> A = sp.mat(np.arange(1,10)) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
296 |
>>> A.shape=3,3 |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
297 |
>>> linalg.lu(A) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
298 |
>>> linalg.eig(A) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
299 |
>>> linalg.eigvals(A) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
300 |
\end{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
301 |
\end{frame} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
302 |
|
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
303 |
\begin{frame}[fragile] |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
304 |
\frametitle{Solving Linear Equations} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
305 |
\begin{align*} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
306 |
3x + 2y - z & = 1 \\ |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
307 |
2x - 2y + 4z & = -2 \\ |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
308 |
-x + \frac{1}{2}y -z & = 0 |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
309 |
\end{align*} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
310 |
To Solve this, |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
311 |
\begin{lstlisting} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
312 |
>>> A = sp.mat([[3,2,-1],[2,-2,4] |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
313 |
,[-1,1/2,-1]]) |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
314 |
>>> B = sp.mat([[1],[-2],[0]]) |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
315 |
>>> linalg.solve(A,B) |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
316 |
\end{lstlisting} |
41
64177498937a
Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
37
diff
changeset
|
317 |
\inctime{15} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
318 |
\end{frame} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
319 |
|
71
d0679d2f9339
Added section and subsections to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
67
diff
changeset
|
320 |
\subsection{Integration} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
321 |
\begin{frame}[fragile] |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
322 |
\frametitle{Integrate} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
323 |
\begin{itemize} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
324 |
\item Integrating Functions given function object |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
325 |
\item Integrating Functions given fixed samples |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
326 |
\item Numerical integrators of ODE systems |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
327 |
\end{itemize} |
72
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
328 |
Calculate the area under $(sin(x) + x^2)$ in the range $(0,1)$ |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
329 |
\begin{lstlisting} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
330 |
>>> def f(x): |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
331 |
return np.sin(x)+x**2 |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
332 |
>>> integrate.quad(f, 0, 1) |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
333 |
\end{lstlisting} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
334 |
\end{frame} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
335 |
|
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
336 |
\begin{frame}[fragile] |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
337 |
\frametitle{Integrate \ldots} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
338 |
Numerically solve ODEs\\ |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
339 |
\begin{align*} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
340 |
\frac{dx}{dt}&=-e^{-t}x^2\\ |
84
338b85a9c864
Minor edits to Session2 Day2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
82
diff
changeset
|
341 |
x&=2 \quad at \ t=0 |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
342 |
\end{align*} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
343 |
\begin{lstlisting} |
72
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
344 |
>>> def dx_dt(x,t): |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
345 |
return -np.exp(-t)*x**2 |
84
338b85a9c864
Minor edits to Session2 Day2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
82
diff
changeset
|
346 |
>>> t=np.linspace(0,2,100) |
72
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
347 |
>>> x=integrate.odeint(dx_dt, 2, t) |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
348 |
>>> plt.plot(x,t) |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
349 |
\end{lstlisting} |
41
64177498937a
Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
37
diff
changeset
|
350 |
\inctime{10} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
351 |
\end{frame} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
352 |
|
71
d0679d2f9339
Added section and subsections to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
67
diff
changeset
|
353 |
\subsection{Interpolation} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
354 |
\begin{frame}[fragile] |
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
355 |
\frametitle{Interpolation} |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
356 |
Try it! |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
357 |
\begin{lstlisting} |
66
523f788d2147
Minor edits to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
58
diff
changeset
|
358 |
>>> from scipy import interpolate |
523f788d2147
Minor edits to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
58
diff
changeset
|
359 |
>>> interpolate.interp1d? |
523f788d2147
Minor edits to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
58
diff
changeset
|
360 |
>>> x = np.arange(0,2*np.pi,np.pi/4) |
523f788d2147
Minor edits to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
58
diff
changeset
|
361 |
>>> y = np.sin(x) |
67
4f2b4c14fc03
Minor edits to SciPy problem in Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
66
diff
changeset
|
362 |
>>> fl = interpolate.interp1d( |
4f2b4c14fc03
Minor edits to SciPy problem in Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
66
diff
changeset
|
363 |
x,y,kind='linear') |
4f2b4c14fc03
Minor edits to SciPy problem in Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
66
diff
changeset
|
364 |
>>> fc = interpolate.interp1d( |
4f2b4c14fc03
Minor edits to SciPy problem in Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
66
diff
changeset
|
365 |
x,y,kind='cubic') |
66
523f788d2147
Minor edits to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
58
diff
changeset
|
366 |
>>> fl(np.pi/3) |
523f788d2147
Minor edits to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
58
diff
changeset
|
367 |
>>> fc(np.pi/3) |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
368 |
\end{lstlisting} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
369 |
\end{frame} |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
370 |
|
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
371 |
\begin{frame}[fragile] |
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
372 |
\frametitle{Interpolation - Splines} |
72
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
373 |
Plot the Cubic Spline of $sin(x)$ |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
374 |
\begin{lstlisting} |
72
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
375 |
>>> tck = interpolate.splrep(x,y) |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
376 |
>>> X = np.arange(0,2*np.pi,np.pi/50) |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
377 |
>>> Y = interpolate.splev(X,tck,der=0) |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
378 |
>>> plt.plot(x,y,'o',x,y,X,Y) |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
379 |
>>> plt.show() |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
380 |
\end{lstlisting} |
41
64177498937a
Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
37
diff
changeset
|
381 |
\inctime{10} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
382 |
\end{frame} |
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
383 |
|
71
d0679d2f9339
Added section and subsections to Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
67
diff
changeset
|
384 |
\subsection{Signal Processing} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
385 |
\begin{frame}[fragile] |
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
386 |
\frametitle{Signal \& Image Processing} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
387 |
\begin{itemize} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
388 |
\item Convolution |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
389 |
\item B-splines |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
390 |
\item Filtering |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
391 |
\item Filter design |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
392 |
\item IIR filter design |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
393 |
\item Linear Systems |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
394 |
\item LTI Reresentations |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
395 |
\item Waveforms |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
396 |
\item Window functions |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
397 |
\item Wavelets |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
398 |
\end{itemize} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
399 |
\end{frame} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
400 |
|
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
401 |
\begin{frame}[fragile] |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
402 |
\frametitle{Signal \& Image Processing} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
403 |
Applying a simple median filter |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
404 |
\begin{lstlisting} |
72
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
405 |
>>> from scipy import signal, ndimage |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
406 |
>>> from scipy import lena |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
407 |
>>> A=lena().astype('float32') |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
408 |
>>> B=signal.medfilt2d(A) |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
409 |
>>> imshow(B) |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
410 |
\end{lstlisting} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
411 |
Zooming an array - uses spline interpolation |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
412 |
\begin{lstlisting} |
72
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
413 |
>>> b=ndimage.zoom(A,0.5) |
1c1d6aaa2be3
Added first cut of Day2 handout; Minor edits to sessions 2 and 3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
71
diff
changeset
|
414 |
>>> imshow(b) |
58
ab9192cfe870
Improved Try-it sections in day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
46
diff
changeset
|
415 |
\end{lstlisting} |
41
64177498937a
Added time counter increments to day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
37
diff
changeset
|
416 |
\inctime{5} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
417 |
\end{frame} |
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
418 |
|
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
419 |
\begin{frame}[fragile] |
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
420 |
\frametitle{Problems} |
37
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
421 |
The Van der Pol oscillator is a type of nonconservative oscillator with nonlinear damping. It evolves in time according to the second order differential equation: |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
422 |
\begin{equation*} |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
423 |
\frac{d^2x}{dt^2}+\mu(x^2-1)\frac{dx}{dt}+x= 0 |
d5b7be72693b
Updated Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
36
diff
changeset
|
424 |
\end{equation*} |
67
4f2b4c14fc03
Minor edits to SciPy problem in Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
66
diff
changeset
|
425 |
Make a plot of $\frac{dx}{dt}$ vs. $x$. |
4f2b4c14fc03
Minor edits to SciPy problem in Day2 Session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
66
diff
changeset
|
426 |
\inctime{30} |
36
8047755ae660
Modified the skeleton for session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
35
diff
changeset
|
427 |
\end{frame} |
76
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
428 |
\begin{frame}{Summary} |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
429 |
\begin{itemize} |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
430 |
\item Advanced NumPy |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
431 |
\item SciPy |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
432 |
\begin{itemize} |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
433 |
\item Linear Algebra |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
434 |
\item Integration |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
435 |
\item Interpolation |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
436 |
\item Signal and Image processing |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
437 |
\end{itemize} |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
438 |
\end{itemize} |
b24c2560f626
Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents:
72
diff
changeset
|
439 |
\end{frame} |
35
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
440 |
\end{document} |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
441 |
|
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
442 |
- Numpy arrays (30 mins) |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
443 |
- Matrices |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
444 |
- random number generation. |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
445 |
- Image manipulation: jigsaw puzzle. |
a49b340696ba
Adding a skeleton for day2 session2.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
446 |
- Monte-carlo integration. |