author | anand |
Mon, 08 Nov 2010 01:36:47 +0530 | |
changeset 455 | f5b7d0b693d9 |
parent 309 | 9d8fd5ea64b2 |
permissions | -rw-r--r-- |
309
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
1 |
% Created 2010-10-12 Tue 17:12 |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
2 |
\documentclass[presentation]{beamer} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
3 |
\usepackage[latin1]{inputenc} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
4 |
\usepackage[T1]{fontenc} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
5 |
\usepackage{fixltx2e} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
6 |
\usepackage{graphicx} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
7 |
\usepackage{longtable} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
8 |
\usepackage{float} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
9 |
\usepackage{wrapfig} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
10 |
\usepackage{soul} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
11 |
\usepackage{t1enc} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
12 |
\usepackage{textcomp} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
13 |
\usepackage{marvosym} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
14 |
\usepackage{wasysym} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
15 |
\usepackage{latexsym} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
16 |
\usepackage{amssymb} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
17 |
\usepackage{hyperref} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
18 |
\tolerance=1000 |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
19 |
\usepackage[english]{babel} \usepackage{ae,aecompl} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
20 |
\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
21 |
\usepackage{listings} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
22 |
\lstset{language=Python, basicstyle=\ttfamily\bfseries, |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
23 |
commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
24 |
showstringspaces=false, keywordstyle=\color{blue}\bfseries} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
25 |
\providecommand{\alert}[1]{\textbf{#1}} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
26 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
27 |
\title{Using python modules} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
28 |
\author{FOSSEE} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
29 |
\date{} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
30 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
31 |
\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
32 |
\begin{document} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
33 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
34 |
\maketitle |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
35 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
36 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
37 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
38 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
39 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
40 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
41 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
42 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
43 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
44 |
\begin{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
45 |
\frametitle{Outline} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
46 |
\label{sec-1} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
47 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
48 |
\begin{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
49 |
\item Running python scripts from command line |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
50 |
\item Importing python modules |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
51 |
\item Importing scipy \& pylab modules |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
52 |
\item About python standard library. |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
53 |
\end{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
54 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
55 |
\begin{frame}[fragile] |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
56 |
\frametitle{Running Python script from command line} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
57 |
\label{sec-2} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
58 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
59 |
\begin{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
60 |
\item Create a script, open text editor and type the following |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
61 |
\begin{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
62 |
print "hello world!" |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
63 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
64 |
\end{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
65 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
66 |
\item Save the script as \texttt{hello.py} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
67 |
\end{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
68 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
69 |
\begin{frame}[fragile] |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
70 |
\frametitle{Running Python script from command line (cont'd)} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
71 |
\label{sec-3} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
72 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
73 |
\begin{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
74 |
\item Run the script |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
75 |
\begin{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
76 |
$ python hello.py |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
77 |
\end{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
78 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
79 |
\end{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
80 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
81 |
\emph{Syntax :} \textbf{python filename} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
82 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
83 |
\begin{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
84 |
\frametitle{Four plot problem} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
85 |
\label{sec-4} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
86 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
87 |
\begin{center} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
88 |
\includegraphics[scale=0.4]{four_plot} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
89 |
\end{center} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
90 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
91 |
\begin{frame}[fragile] |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
92 |
\frametitle{Fix \texttt{linspace()} problem} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
93 |
\label{sec-5} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
94 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
95 |
\begin{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
96 |
from scipy import * |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
97 |
\end{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
98 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
99 |
\begin{frame}[fragile] |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
100 |
\frametitle{Fix \texttt{plot()} problem} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
101 |
\label{sec-6} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
102 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
103 |
\begin{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
104 |
from pylab import * |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
105 |
\end{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
106 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
107 |
\begin{frame}[fragile] |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
108 |
\frametitle{Better way of fixing} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
109 |
\label{sec-7} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
110 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
111 |
\begin{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
112 |
from scipy import linspace |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
113 |
\end{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
114 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
115 |
instead of |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
116 |
\begin{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
117 |
from scipy import * |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
118 |
\end{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
119 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
120 |
\texttt{*} means import all functions from name-space \texttt{scipy}. |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
121 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
122 |
\begin{frame}[fragile] |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
123 |
\frametitle{Instead of \texttt{*}} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
124 |
\label{sec-8} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
125 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
126 |
\begin{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
127 |
from scipy import linspace, pi, sin |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
128 |
from pylab import plot, legend, annotate |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
129 |
from pylab import xlim, ylim, title, show |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
130 |
\end{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
131 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
132 |
Is better than, \texttt{from scipy import *} \& \texttt{from pylab import *}. |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
133 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
134 |
\begin{frame}[fragile] |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
135 |
\frametitle{Another Fix} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
136 |
\label{sec-9} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
137 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
138 |
\begin{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
139 |
import scipy |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
140 |
import pylab |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
141 |
x = scipy.linspace(-5*scipy.pi, 5*scipy.pi, 500) |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
142 |
pylab.plot(x, x, 'b') |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
143 |
pylab.plot(x, -x, 'b') |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
144 |
pylab.plot(x, scipy.sin(x), 'g', linewidth=2) |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
145 |
pylab.plot(x, x*scipy.sin(x), 'r', linewidth=3) |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
146 |
pylab.legend(['x', '-x', 'sin(x)', 'xsin(x)']) |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
147 |
pylab.annotate('origin', xy = (0, 0)) |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
148 |
pylab.xlim(-5*scipy.pi, 5*scipy.pi) |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
149 |
pylab.ylim(-5*scipy.pi, 5*scipy.pi) |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
150 |
\end{verbatim} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
151 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
152 |
\begin{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
153 |
\frametitle{Exercise 1} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
154 |
\label{sec-10} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
155 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
156 |
Write a python script to plot a sine wave from |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
157 |
$-2\Pi$ |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
158 |
to |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
159 |
$2\Pi$ |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
160 |
. |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
161 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
162 |
\begin{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
163 |
\frametitle{What is a module?} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
164 |
\label{sec-11} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
165 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
166 |
Module is simply a file containing Python definitions and |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
167 |
statements. Definitions from a module can be imported into other |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
168 |
modules or into the main module. |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
169 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
170 |
\begin{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
171 |
\frametitle{Python standard library} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
172 |
\label{sec-12} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
173 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
174 |
Python has a very rich standard library of modules. |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
175 |
\begin{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
176 |
\item Few libraries |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
177 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
178 |
\begin{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
179 |
\item Math: \texttt{math}, \texttt{random} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
180 |
\item Internet access: \texttt{urllib2}, \texttt{smtplib} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
181 |
\item System, Command line arguments: \texttt{sys} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
182 |
\item Operating system interface: \texttt{os} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
183 |
\item regular expressions: \texttt{re} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
184 |
\item compression: \texttt{gzip}, \texttt{zipfile}, \texttt{tarfile} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
185 |
\end{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
186 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
187 |
\item More information |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
188 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
189 |
\begin{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
190 |
\item \href{http://docs.python.org/library}{http://docs.python.org/library} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
191 |
\end{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
192 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
193 |
\end{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
194 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
195 |
\begin{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
196 |
\frametitle{Summary} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
197 |
\label{sec-13} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
198 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
199 |
\begin{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
200 |
\item Running scripts from command line |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
201 |
\item Learned about modules |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
202 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
203 |
\begin{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
204 |
\item importing modules |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
205 |
\end{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
206 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
207 |
\item Python standard library |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
208 |
\end{itemize} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
209 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
210 |
\begin{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
211 |
\frametitle{Thank you!} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
212 |
\label{sec-14} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
213 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
214 |
\begin{block}{} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
215 |
\begin{center} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
216 |
This spoken tutorial has been produced by the |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
217 |
\textcolor{blue}{FOSSEE} team, which is funded by the |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
218 |
\end{center} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
219 |
\begin{center} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
220 |
\textcolor{blue}{National Mission on Education through \\ |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
221 |
Information \& Communication Technology \\ |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
222 |
MHRD, Govt. of India}. |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
223 |
\end{center} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
224 |
\end{block} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
225 |
\end{frame} |
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
226 |
|
9d8fd5ea64b2
added slides for using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff
changeset
|
227 |
\end{document} |