Edited import section in session3 - removed scipy imports.
authorPuneeth Chaganti <punchagan@fossee.in>
Sun, 10 Jan 2010 18:29:20 +0530
changeset 351 c9d1d5a7b629
parent 350 385b9df26f25
child 352 b44d7bcc6609
Edited import section in session3 - removed scipy imports.
day2/cheatsheet3.tex
day2/session3.tex
--- a/day2/cheatsheet3.tex	Sun Jan 10 18:10:31 2010 +0530
+++ b/day2/cheatsheet3.tex	Sun Jan 10 18:29:20 2010 +0530
@@ -105,7 +105,7 @@
 \section{Self contained python script}
 Functions like \typ{plot}, \typ{linspace} etc are not inbuilt functions. One have to import them to use them.
   \begin{lstlisting}
-from scipy import linspace, pi, sin
+from pylab import linspace, pi, sin
 from pylab import plot, legend, annotate
 from pylab import xlim, ylim
 
--- a/day2/session3.tex	Sun Jan 10 18:10:31 2010 +0530
+++ b/day2/session3.tex	Sun Jan 10 18:29:20 2010 +0530
@@ -248,21 +248,6 @@
 \end{frame}
 
 \begin{frame}[fragile]
-  \frametitle{Remedy}
-  \begin{lstlisting}
-from scipy import *
-  \end{lstlisting}
-\alert{Now run python four\_plot.py again!}
-  \pause
-  \begin{lstlisting}
-Traceback (most recent call last):
-  File "four_plot.py", line 4, in <module>
-    plot(x, x, 'b')
-NameError: name 'plot' is not defined
-  \end{lstlisting}
-\end{frame}
-
-\begin{frame}[fragile]
   \frametitle{Remedy \ldots}
   \begin{lstlisting}
 from pylab import *
@@ -276,8 +261,8 @@
     \item The \kwrd{import} keyword ``loads'' a module
     \item One can also use:
       \begin{lstlisting}
-In []: from scipy import *
-In []: from scipy import linspace
+In []: from pylab import *
+In []: from pylab import linspace
       \end{lstlisting}    
     \item What is the difference?
     \item \alert{Use the former only in interactive mode}
@@ -297,7 +282,7 @@
   \frametitle{\texttt{from} \ldots \texttt{import} - conventional way!}
   \small
   \begin{lstlisting}
-from scipy import linspace, pi, sin
+from pylab import linspace, pi, sin
 from pylab import plot, legend, annotate
 from pylab import xlim, ylim
 
@@ -317,18 +302,17 @@
   \frametitle{\texttt{from} \ldots \texttt{import} - conventional way!}
   \small
   \begin{lstlisting}
-import scipy
 import pylab
 
-x = scipy.linspace(-5*scipy.pi, 5*scipy.pi, 500)
+x = pylab.linspace(-5*pylab.pi, 5*pylab.pi, 500)
 pylab.plot(x, x, 'b')
 pylab.plot(x, -x, 'b')
-pylab.plot(x, scipy.sin(x), 'g', linewidth=2)
-pylab.plot(x, x*scipy.sin(x), 'r', linewidth=3)
+pylab.plot(x, pylab.sin(x), 'g', linewidth=2)
+pylab.plot(x, x*pylab.sin(x), 'r', linewidth=3)
 pylab.legend(['x', '-x', 'sin(x)', 'xsin(x)'])
 pylab.annotate('origin', xy = (0, 0))
-pylab.xlim(-5*scipy.pi, 5*scipy.pi)
-pylab.ylim(-5*scipy.pi, 5*scipy.pi)
+pylab.xlim(-5*pylab.pi, 5*pylab.pi)
+pylab.ylim(-5*pylab.pi, 5*pylab.pi)
   \end{lstlisting}
 \end{frame}