equal
deleted
inserted
replaced
2 |
2 |
3 In the previous tutorial we learnt how to read data from a file and plot it. |
3 In the previous tutorial we learnt how to read data from a file and plot it. |
4 We used 'for' loops and lists to get data in the desired format. |
4 We used 'for' loops and lists to get data in the desired format. |
5 IPython -Pylab also provides a function called 'loadtxt' that can get us the same data in the desired format without much hustle. |
5 IPython -Pylab also provides a function called 'loadtxt' that can get us the same data in the desired format without much hustle. |
6 |
6 |
|
7 We shall use the same pendulum.txt file that we used in the previous session. |
7 We know that, pendulum.txt contains two columns, with length being first and time period is second column, so to get both columns in two separate variables we type |
8 We know that, pendulum.txt contains two columns, with length being first and time period is second column, so to get both columns in two separate variables we type |
8 |
9 |
9 l, t = loadtxt('pendulum.txt', unpack=True) |
10 l, t = loadtxt('pendulum.txt', unpack=True) |
10 |
11 |
11 (unpack = True) will give us all of first column(length) in l and second column(time) in t |
12 (unpack = True) will give us all of first column(length) in l and second column(time) in t |