Difference between revisions of "Python/C2/Plotting-the-data/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello Friends and Welcome to this tutorial on "Plotting Experimental data". |- | 0:05 | At the end of this tutorial, you will be a…')
 
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{| border=1
 
{| border=1
!Visual Cue
+
|'''Time'''
!Narration
+
|'''Narration'''
 
|-
 
|-
| 0:01
+
| 00:01
 
| Hello Friends and Welcome to this tutorial on "Plotting Experimental data".
 
| Hello Friends and Welcome to this tutorial on "Plotting Experimental data".
  
 
|-
 
|-
| 0:05
+
| 00:05
 
| At the end of this tutorial, you will be able to,
 
| At the end of this tutorial, you will be able to,
 
+
Define a list of numbers.
# Define a list of numbers.
+
perform element wise squaring of the list.
# perform element wise squaring of the list.
+
Plot data points.
# Plot data points.
+
plot errorbars.
# plot errorbars.
+
  
 
|-
 
|-
| 0:18
+
| 00:18
 
| One needs to be familiar with the concepts of plotting mathematical functions in Python.
 
| One needs to be familiar with the concepts of plotting mathematical functions in Python.
  
 
|-
 
|-
| 0:23
+
| 00:23
 
|We will use data from a Simple Pendulum Experiment to illustrate.
 
|We will use data from a Simple Pendulum Experiment to illustrate.
  
 
|-
 
|-
| 0:30
+
| 00:30
 
| As we know for a simple pendulum, length L is directly proportional to the square of time T.
 
| As we know for a simple pendulum, length L is directly proportional to the square of time T.
  
 
|-
 
|-
| 0:37
+
| 00:37
 
| We shall be plotting L and T square values.
 
| We shall be plotting L and T square values.
  
 
|-
 
|-
| 0:40
+
| 00:40
 
|First we will have to initiate L and T values.  
 
|First we will have to initiate L and T values.  
  
 
|-
 
|-
| 0:44
+
| 00:44
 
|We initiate them as sequence of values.
 
|We initiate them as sequence of values.
  
 
|-
 
|-
| 0:47
+
| 00:47
 
| We define a sequence by comma separated values inside two square brackets.
 
| We define a sequence by comma separated values inside two square brackets.
  
 
|-
 
|-
| 0:52
+
| 00:52
 
| This is also called a List.
 
| This is also called a List.
  
 
|-
 
|-
| 0:54
+
| 00:54
 
| Let's create two sequences L and t.
 
| Let's create two sequences L and t.
  
 
|-
 
|-
|0:58
+
|00:58
 
|L = [0.1, 0.2, 0.3, 0.4, 0.5,0.6, 0.7, 0.8, 0.9]  
 
|L = [0.1, 0.2, 0.3, 0.4, 0.5,0.6, 0.7, 0.8, 0.9]  
  
 
|-
 
|-
|1:10
+
|01:10
 
|T= [0.69, 0.90, 1.19,1.30, 1.47, 1.58, 1.77, 1.83, 1.94]
 
|T= [0.69, 0.90, 1.19,1.30, 1.47, 1.58, 1.77, 1.83, 1.94]
  
 
|-
 
|-
| 1:29
+
| 01:29
 
| To obtain the square of sequence T we will use the function square with argument T.
 
| To obtain the square of sequence T we will use the function square with argument T.
  
 
|-
 
|-
| 1:36
+
| 01:36
 
|This is saved into the variable Tsquare.
 
|This is saved into the variable Tsquare.
  
 
|-
 
|-
|1:38
+
|01:38
 
|So type Tsquare=square withinbracket T
 
|So type Tsquare=square withinbracket T
  
 
|-
 
|-
|1:55
+
|01:55
 
|Tsqaure enter
 
|Tsqaure enter
  
 
|-
 
|-
| 2:00
+
| 02:00
 
| Now to plot L versus T square, we will simply type
 
| Now to plot L versus T square, we will simply type
  
 
|-
 
|-
|2:07
+
|02:07
|plot within bracket L comma Tsquare comma dot in single quote  
+
|plot within bracket L comma Tsquare comma within single quote dot
 
+
 
|-
 
|-
| 2:21
+
| 02:21
| dot here displays the plot in a dot pattern.  
+
|Here single quote  dot displays the plot in a dot pattern.  
  
 
|-
 
|-
| 2:26
+
| 02:26
 
|You can also specify 'o' for big dots.
 
|You can also specify 'o' for big dots.
  
 
|-
 
|-
| 2:31  
+
| 02:31  
| For this let us clear the plot first.
+
| For this let us clear the first plot .
  
 
|-
 
|-
|2:34
+
|02:34
|Type clf bracket enter
+
|Type clf closing  bracket and hit enter
  
 
|-
 
|-
|2:39
+
|02:39
|Type plot within bracket L comma Tsquare comma o in single quote enter
+
|Then Type plot within bracket L comma Tsquare comma within single quote o hit  enter now to clear the bracket type clf closing bracket
  to clear the bracket type clf bracket
+
  
 
|-
 
|-
| 3:01
+
| 03:01
 
| Let us move further.
 
| Let us move further.
  
 
|-
 
|-
| 3.03
+
| 03:03
 
| For any experimental there is always an error in measurements due to instrumental and human constraints.
 
| For any experimental there is always an error in measurements due to instrumental and human constraints.
  
 
|-
 
|-
| 3:10
+
| 03:10
 
| Now we shall try and take these errors into account in our plots .
 
| Now we shall try and take these errors into account in our plots .
  
 
|-
 
|-
| 3:17
+
| 03:17
 
| Pause the video here, try out the following exercise and resume the video.
 
| Pause the video here, try out the following exercise and resume the video.
  
 
|-
 
|-
| 3:21
+
| 03:21
 
|Plot the given experimental data with large dots.
 
|Plot the given experimental data with large dots.
  
 
|-
 
|-
| 3:25
+
| 03:25
 
| The data is on your screen.
 
| The data is on your screen.
  
 
|-
 
|-
|3:29
+
|03:29
| Its given in delta underscore L and delta underscore T
+
| Its given in delta underscore delta L and delta underscore T
  
 
|-
 
|-
| 3:37
+
| 03:37
 
| We shall again initialize the sequence values in the same manner as we did for L and T.
 
| We shall again initialize the sequence values in the same manner as we did for L and T.
  
 
|-
 
|-
3:48
+
03:48
| Now to plot L vs T square with an error bar we use the function <tt>errorbar()</tt>.
+
| Now to plot L vs T square with an error bar we use the function errorbar() .
  
 
|-
 
|-
|4:00
+
|04:00
|Before plotting the data we need to get the data of delta underscore L and delta underscore T
+
|Before plotting the data we need to get the data of delta L and delta T
  
 
|-
 
|-
|4:05
+
|04:05
|delta underscore L= within square bracket 0.08,0.09,0.07,0.05,0.06,0.00,0.06,0.06,0.01
+
|delta L= within square bracket 0.08,0.09,0.07,0.05,0.06,0.00,0.06,0.06,0.01
  
 
|-
 
|-
|4:25
+
|04:25
|delta underscore T= [0.04,0.08,0.03,0.05,0.03,0.03,0.04,0.07,0.08]
+
|delta T= [0.04,0.08,0.03,0.05,0.03,0.03,0.04,0.07,0.08]
  
 
|-
 
|-
|4:40
+
|04:40
 
|Now use the error function
 
|Now use the error function
  
 
|-
 
|-
|4:44
+
|04:44
|Type errorbar within bracket L comma Tsquare comma xerr=delta underscore L comma yerr=delta underscore T comma fmt=bo in single quote  
+
|Type errorbar within bracket L comma Tsquare comma xerr=delta underscore L comma yerr=delta underscore T comma fmt= in single quote bo
  
 
|-
 
|-
5:32
+
05:32
| This gives a plot with error bar for x and y axis.
+
| This gives a plot with error bar of x and y axis.
  
 
|-
 
|-
| 5:36
+
| 05:36
 
| The dots are of blue color.
 
| The dots are of blue color.
  
 
|-
 
|-
| 5:38
+
| 05:38
 
| The parameters xerr and yerr are error on x and y axis and fmt is the format of the plot.
 
| The parameters xerr and yerr are error on x and y axis and fmt is the format of the plot.
  
 
|-
 
|-
| 5:46
+
| 05:46
|similarly we can draw the same error bar with small red dots just change the parameters of fmt to with in single quote r dot.
+
|similarly we can draw the same error bar with small red dots just change the parameters of fmt to r dot.
  
 
|-
 
|-
|5:59
+
|05:59
|Type clf()
+
|Type clf() to clear the plot errorbar within bracket L comma Tsquare comma xerr=delta underscore L comma yerr=delta underscore T comma fmt=in single quote  r and hit enter.
errorbar within bracket L comma Tsquare comma xerr=delta underscore L comma yerr=delta underscore T comma fmt=within r.
+
  
 
|-
 
|-
| 6:24
+
| 06:24
 
| you can explore other options to errorbar using the documentation of errorbar.
 
| you can explore other options to errorbar using the documentation of errorbar.
  
 
|-
 
|-
|6:30
+
|06:30
 
|errorbar? on terminal
 
|errorbar? on terminal
 +
 
|-
 
|-
| 6:38
+
| 06:38
 
| Pause the video here, try out the following exercise and resume the video.
 
| Pause the video here, try out the following exercise and resume the video.
  
 
|-
 
|-
| 6:44
+
| 06:44
 
|Plot the given experimental data with small dots and also include the error in your plot.
 
|Plot the given experimental data with small dots and also include the error in your plot.
  
 
|-
 
|-
| 6:51
+
| 06:51
| The data is on your screen delta s delta n
+
| The data is on your screen for  delta s delta n
  
 
|-
 
|-
| 7:00  
+
| 07:00  
 
| This brings us to the end of the end of this tutorial.
 
| This brings us to the end of the end of this tutorial.
  
 
|-
 
|-
| 7:03
+
| 07:03
| In this tutorial, we have learnt to,
+
| In this tutorial, we have learnt to, to declare a sequence of numbers using the function array.
1. to declare a sequence of numbers using the function <tt>array</tt>.
+
  
 
|-
 
|-
| 7:09
+
| 07:09
| 2. to perform elementwise squaring using the <tt>square</tt> function.
+
| to perform elementwise squaring using the square function.
  
 
|-
 
|-
| 7:14
+
| 07:14
| 3. to use the various options available for plotting like dots,lines.
+
| to use the various options available for plotting like dots,lines.
  
 
|-
 
|-
| 7:20
+
| 07:20
| 4. to Plot experimental data such that we can also represent error by using the <tt>errorbar()</tt> function.
+
| to Plot experimental data such that we can also represent error by using the errorbar() function.
  
 
|-
 
|-
| 7:28
+
| 07:28
 
| Here are some self assessment questions for you to solve
 
| Here are some self assessment questions for you to solve
  
 
|-
 
|-
| 7:32
+
| 07:32
| 1. Square the following sequence.<br/> <nowiki>distance underscore values=wthin square bracket 2.1 comma 4.6 comma 8.72 comma 9.03 </nowiki>
+
|Square the following sequence.br distance underscore values=within square bracket 2.1 comma 4.6 comma 8.72 comma 9.03  
  
 
|-
 
|-
| 7:44
+
| 07:44
| 2. Plot L versus T in red pluses.
+
| Plot L versus T in red pluses.
  
 
|-
 
|-
| 7:52
+
| 07:52
 
| And the answers,
 
| And the answers,
  
 
|-
 
|-
| 7:55
+
| 07:55
|1. To square a sequence of values, we use the function <tt>square</tt>
+
| To square a sequence of values, we use the function square
  
 
|-
 
|-
| 8:02
+
| 08:02
| Type square within bracket distance underscore values
+
|So that we have to Type square within bracket distance underscore values
  
 
|-
 
|-
| 8:09
+
| 08:09
|2. We pass an additional argument stating the desired parameter
+
| We pass an additional argument stating the desired parameter
  
 
|-
 
|-
| 8:14
+
| 08:14
 
| Type plot within bracket L comma T comma within single quote r+
 
| Type plot within bracket L comma T comma within single quote r+
  
 
|-
 
|-
| 8:24
+
| 08:24
 
| Hope you have enjoyed this tutorial and found it useful.
 
| Hope you have enjoyed this tutorial and found it useful.
  
 
|-
 
|-
|8:27
+
|08:27
 
|Thank You!
 
|Thank You!

Latest revision as of 10:48, 27 March 2017

Time Narration
00:01 Hello Friends and Welcome to this tutorial on "Plotting Experimental data".
00:05 At the end of this tutorial, you will be able to,

Define a list of numbers. perform element wise squaring of the list. Plot data points. plot errorbars.

00:18 One needs to be familiar with the concepts of plotting mathematical functions in Python.
00:23 We will use data from a Simple Pendulum Experiment to illustrate.
00:30 As we know for a simple pendulum, length L is directly proportional to the square of time T.
00:37 We shall be plotting L and T square values.
00:40 First we will have to initiate L and T values.
00:44 We initiate them as sequence of values.
00:47 We define a sequence by comma separated values inside two square brackets.
00:52 This is also called a List.
00:54 Let's create two sequences L and t.
00:58 L = [0.1, 0.2, 0.3, 0.4, 0.5,0.6, 0.7, 0.8, 0.9]
01:10 T= [0.69, 0.90, 1.19,1.30, 1.47, 1.58, 1.77, 1.83, 1.94]
01:29 To obtain the square of sequence T we will use the function square with argument T.
01:36 This is saved into the variable Tsquare.
01:38 So type Tsquare=square withinbracket T
01:55 Tsqaure enter
02:00 Now to plot L versus T square, we will simply type
02:07 plot within bracket L comma Tsquare comma within single quote dot
02:21 Here single quote dot displays the plot in a dot pattern.
02:26 You can also specify 'o' for big dots.
02:31 For this let us clear the first plot .
02:34 Type clf closing bracket and hit enter
02:39 Then Type plot within bracket L comma Tsquare comma within single quote o hit enter now to clear the bracket type clf closing bracket
03:01 Let us move further.
03:03 For any experimental there is always an error in measurements due to instrumental and human constraints.
03:10 Now we shall try and take these errors into account in our plots .
03:17 Pause the video here, try out the following exercise and resume the video.
03:21 Plot the given experimental data with large dots.
03:25 The data is on your screen.
03:29 Its given in delta underscore delta L and delta underscore T
03:37 We shall again initialize the sequence values in the same manner as we did for L and T.
03:48 Now to plot L vs T square with an error bar we use the function errorbar() .
04:00 Before plotting the data we need to get the data of delta L and delta T
04:05 delta L= within square bracket 0.08,0.09,0.07,0.05,0.06,0.00,0.06,0.06,0.01
04:25 delta T= [0.04,0.08,0.03,0.05,0.03,0.03,0.04,0.07,0.08]
04:40 Now use the error function
04:44 Type errorbar within bracket L comma Tsquare comma xerr=delta underscore L comma yerr=delta underscore T comma fmt= in single quote bo
05:32 This gives a plot with error bar of x and y axis.
05:36 The dots are of blue color.
05:38 The parameters xerr and yerr are error on x and y axis and fmt is the format of the plot.
05:46 similarly we can draw the same error bar with small red dots just change the parameters of fmt to r dot.
05:59 Type clf() to clear the plot errorbar within bracket L comma Tsquare comma xerr=delta underscore L comma yerr=delta underscore T comma fmt=in single quote r and hit enter.
06:24 you can explore other options to errorbar using the documentation of errorbar.
06:30 errorbar? on terminal
06:38 Pause the video here, try out the following exercise and resume the video.
06:44 Plot the given experimental data with small dots and also include the error in your plot.
06:51 The data is on your screen for delta s delta n
07:00 This brings us to the end of the end of this tutorial.
07:03 In this tutorial, we have learnt to, to declare a sequence of numbers using the function array.
07:09 to perform elementwise squaring using the square function.
07:14 to use the various options available for plotting like dots,lines.
07:20 to Plot experimental data such that we can also represent error by using the errorbar() function.
07:28 Here are some self assessment questions for you to solve
07:32 Square the following sequence.br distance underscore values=within square bracket 2.1 comma 4.6 comma 8.72 comma 9.03
07:44 Plot L versus T in red pluses.
07:52 And the answers,
07:55 To square a sequence of values, we use the function square
08:02 So that we have to Type square within bracket distance underscore values
08:09 We pass an additional argument stating the desired parameter
08:14 Type plot within bracket L comma T comma within single quote r+
08:24 Hope you have enjoyed this tutorial and found it useful.
08:27 Thank You!

Contributors and Content Editors

Gaurav, Minal, PoojaMoolya, Sneha