plotting-files.txt
changeset 27 5712cc7589f9
parent 21 cc33c97ed034
child 32 74bf7904691d
--- a/plotting-files.txt	Wed Apr 07 22:11:33 2010 +0530
+++ b/plotting-files.txt	Thu Apr 08 14:32:43 2010 +0530
@@ -1,39 +1,30 @@
 **********************************************************************************
 Hello and welcome, this is the second tutorial in the series of spoken tutorials on Python for Scientific computing. 
 
-Here we will teach you how to plot experimental data, with two variables.  
-
-You could input the data either as a list or read from a plain text/binary file. 
+Here we will teach you how to plot experimental data.
 
-# Before going through this video, you should have a working knowledge of
-#   - Lists
-#   - How to initialize them
-#   - How to append elements to the lists
-#   - ??? for command
-#   - How to iterate over a list
-#   - How to split a command
-#   - The plot command
-#   - How to plot two variables
+You can input the data either as a list or read from a plain text/binary file. We will cover both one by one.
+Please make sure you have pendulum.txt file, as mentioned on requirement list of session
  
 So let's begin.  First we will input the data as lists and then we will plot it. 
-So on the IPython Interpreter we will type
+So on the Interpreter we will type
 x = [0, 1, 2.1, 3.1, 4.2, 5.2]
 here x is a list. In python, list is a container that holds a number of objects. Various functions related to lists will be covered in more detail later. 
 
 Now for the corresponding Y values type
 y = [0, 0.8, 0.9, 0, -0.9, -0.8]
  
-Now we have x and y in two separate lists and we plot x vs. y.
+Now we have x and y in two separate lists and we plot x vs. y via:
 plot (x, y, 'o')
 
 Here, we have our plot! 
 [We close the plot window. ] 
 
-Now, that we know how to plot data from lists, we will look at plotting data from a text file. Essentially, we read the data from the file and massage it into lists again. Then we can easily plot it, as we already did before. 
+Now, that we know how to plot data from lists, we will look at plotting data from a text file. Essentially, we read the data from the file and fit them into lists again. Then we can easily plot it, as we already did before. 
 
-As an example we will use the data collected from a simple pendulum experiment. Please make sure you have pendulum.txt file, as mentioned on requirement page(link)
+As an example we will use the data collected from a simple pendulum experiment. 
 
-In []: cat pendulum.txt (windows?)
+In []: cat pendulum.txt (windows wont work!)
 The cat command shows the file content.
 The first column is the length of the pendulum and the second column is the time. We read the file line-by-line, collect the data into lists and plot them.
 
@@ -65,12 +56,6 @@
 for time in t:
     tsq.append(time*time) 
 
-# We also calculate the squares of the time-period and append to the
-# end of the tsq list.
-#     tsq.append(t[-1]*t[-1])
-# For any given list to access the last element python provides '-1'
-# index, so we use t[-1].
-
 Now lists l(en) and tsq have the required data. We can simply plot them, as we did earlier. 
 plot(l, tsq, 'o')