# HG changeset patch # User Santosh G. Vattam # Date 1257512996 -19800 # Node ID ec70a20488715f734480f9851ec2e81a36a8a4e4 # Parent 10528e3073ef3aa2b9b8088d6ecf231c1bcb87e8 Updated cheatsheet for session 2. diff -r 10528e3073ef -r ec70a2048871 day1/cheatsheet2.tex --- a/day1/cheatsheet2.tex Fri Nov 06 17:51:40 2009 +0530 +++ b/day1/cheatsheet2.tex Fri Nov 06 18:39:56 2009 +0530 @@ -8,30 +8,18 @@ \LARGE{Plotting Data}\\ \large{FOSSEE} \end{center} -\section{Scripts} -IPython History -\begin{verbatim} -In [1]: %hist -In [2]: %hist -n -\end{verbatim} - -Running a Script -\begin{verbatim} -In [3]: %run script_name.py -\end{verbatim} - \section{Plotting from Data files} \begin{verbatim} -In [1]: L = [] #Empty List -In [2]: T = [] -In [3]: for line in open('pendulum.txt'): # Opening & Reading files - ....: points = line.split() # Splitting a string - ....: L.append(float(points[0])) # Appending to a list - ....: T.append(float(points[1])) -In [4]: TSq = [] -In [5]: for t in T: #Iterating through lists - ....: TSq.append(t*t) -In [6]: plot(L, TSq, '.') # Plotting points +l = [] #Empty List +t = [] +for line in open('pendulum.txt'): # Opening & Reading files + points = line.split() # Splitting a string + l.append(float(points[0])) # Appending to a list + t.append(float(points[1])) +tsq = [] +for time in t: #Iterating through lists + tsq.append(t*t) +plot(l, tsq, '.') # Plotting points \end{verbatim} \end{document}