299 \begin{frame}[fragile] |
302 \begin{frame}[fragile] |
300 \frametitle{Plotting $L$ vs $T^2$} |
303 \frametitle{Plotting $L$ vs $T^2$} |
301 \begin{lstlisting} |
304 \begin{lstlisting} |
302 In []: tsq = [] |
305 In []: tsq = [] |
303 |
306 |
304 In []: len(l) |
|
305 Out[]: 9 |
|
306 |
|
307 In []: len(t) |
|
308 Out[]: 9 |
|
309 |
|
310 In []: for time in t: |
307 In []: for time in t: |
311 ....: tsq.append(time*time) |
308 ....: tsq.append(time*time) |
312 ....: |
309 ....: |
313 ....: |
310 ....: |
314 |
311 |
315 In []: plot(l, tsq) |
312 In []: print len(l), len(t), len(tsq) |
316 Out[]: [<matplotlib.lines.Line2D object at 0xa5b05ac>] |
|
317 \end{lstlisting} |
313 \end{lstlisting} |
318 This gives \kwrd{tsq} which is the list of squares of \typ{t} values. |
314 This gives \kwrd{tsq} which is the list of squares of \typ{t} values. |
319 \end{frame} |
315 \end{frame} |
320 |
316 |
321 \begin{frame}[fragile] |
317 \begin{frame}[fragile] |
341 \begin{frame}[fragile] |
336 \begin{frame}[fragile] |
342 \frametitle{What about larger data sets?} |
337 \frametitle{What about larger data sets?} |
343 \alert{Data is usually present in a file!} \\ |
338 \alert{Data is usually present in a file!} \\ |
344 Lets look at the \typ{pendulum.txt} file. |
339 Lets look at the \typ{pendulum.txt} file. |
345 \begin{lstlisting} |
340 \begin{lstlisting} |
346 $ cat pendulum.txt |
341 In []: cd circulate/pendulum/ |
|
342 In []: cat pendulum.txt |
347 1.0000e-01 6.9004e-01 |
343 1.0000e-01 6.9004e-01 |
348 1.1000e-01 6.9497e-01 |
344 1.1000e-01 6.9497e-01 |
349 1.2000e-01 7.4252e-01 |
345 1.2000e-01 7.4252e-01 |
350 1.3000e-01 7.5360e-01 |
346 1.3000e-01 7.5360e-01 |
351 1.4000e-01 8.3568e-01 |
|
352 1.5000e-01 8.6789e-01 |
|
353 \end{lstlisting} %$ |
347 \end{lstlisting} %$ |
354 \ldots |
348 \ldots |
355 \begin{block}{Windows users:} |
|
356 C:> type pendulum.txt |
|
357 \end{block} |
|
358 \end{frame} |
349 \end{frame} |
359 |
350 |
360 \begin{frame}[fragile] |
351 \begin{frame}[fragile] |
361 \frametitle{Reading \typ{pendulum.txt}} |
352 \frametitle{Reading \typ{pendulum.txt}} |
362 \begin{itemize} |
353 \begin{itemize} |
|
354 \item File contains L vs. T values |
|
355 \item First Column - L values |
|
356 \item Second Column - T values |
363 \item Let us generate a plot from the data file |
357 \item Let us generate a plot from the data file |
364 \item File contains L vs. T values |
|
365 \item L - Column1; T - Column2 |
|
366 \end{itemize} |
358 \end{itemize} |
367 \end{frame} |
359 \end{frame} |
368 |
360 |
369 \begin{frame}[fragile] |
361 \begin{frame}[fragile] |
370 \frametitle{Plotting from \typ{pendulum.txt}} |
362 \frametitle{Plotting from \typ{pendulum.txt}} |