# HG changeset patch # User amit # Date 1288259080 -19800 # Node ID 8e05616c410277ff99c4a96db26021b1eaac8551 # Parent d87828051c69f0c0cd5fe224a094b4a5241efe83 Added metadata to plotting-data script diff -r d87828051c69 -r 8e05616c4102 plotting-data/plotting-data.rst --- a/plotting-data/plotting-data.rst Thu Oct 28 13:19:28 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -Plotting Experimental Data -============================= -Hello and welcome , this tutorial on Plotting Experimental data is -presented by the fossee team. - -{{{ Show the slide containing title }}} - - -{{{ Show the Outline Slide }}} - -Here we will discuss plotting Experimental data. - -1. We will see how we can represent a sequence of numbers in Python. - -2. We will also become fimiliar with elementwise squaring of such a -sequence. - -3. We will also see how we can use our graph to indicate Error. - -One needs to be fimiliar with the concepts of plotting -mathematical functions in Python. - -We will use data from a Simple Pendulum Experiment to illustrate our -points. - -{{{ Simple Pendulum data Slide }}} - - - - -As we know for a simple pendulum length,L is directly proportional to -the square of time,T. We shall be plotting L and T^2 values. - - -First we will have to initiate L and T values. We initiate them as sequence -of values. To tell ipython a sequence of values we write the sequence in -comma seperated values inside two square brackets. This is also called List -so to create two sequences - -L,t type in ipython shell. :: - - In []: L = [0.1, 0.2, 0.3, 0.4, 0.5,0.6, 0.7, 0.8, 0.9] - - In []: t= [0.69, 0.90, 1.19,1.30, 1.47, 1.58, 1.77, 1.83, 1.94] - - - -To obtain the square of sequence t we will use the function square -with argument t.This is saved into the variable tsquare.:: - - In []: tsquare=square(t) - - array([ 0.4761, 0.81 , 1.4161, 1.69 , 2.1609, 2.4964, 3.1329, - 3.3489, 3.7636]) - - -Now to plot L vs T^2 we will simply type :: - - In []: plot(L,t,.) - -'.' here represents to plot use small dots for the point. :: - - In []: clf() - -You can also specify 'o' for big dots.:: - - In []: plot(L,t,o) - - In []: clf() - - -{{{ Slide with Error data included }}} - - -Now we shall try and take into account error into our plots . The -Error values for L and T are on your screen.We shall again intialize -the sequence values in the same manner as we did for L and t :: - - In []: delta_L= [0.08,0.09,0.07,0.05,0.06,0.00,0.06,0.06,0.01] - - In []: delta_T= [0.04,0.08,0.11,0.05,0.03,0.03,0.01,0.07,0.01] - - - -Now to plot L vs T^2 with an error bar we use the function errorbar() - -The syntax of the command is as given on the screen. :: - - - In []: errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='b.') - -This gives a plot with error bar for x and y axis. The dots are of blue color. The parameters xerr and yerr are error on x and y axis and fmt is the format of the plot. - - -similarly we can draw the same error bar with big red dots just change -the parameters to fmt to 'ro'. :: - - In []: clf() - In []: errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='ro') - - - -thats it. you can explore other options to errorbar using the documentation -of errorbar.:: - - In []: errorbar? - - -{{{ Summary Slides }}} - -In this tutorial we have learnt : - -1. How to declare a sequence of number , specifically the kind of sequence we learned was a list. - -2. Plotting experimental data extending our knowledge from mathematical functions. - -3. The various options available for plotting dots instead of lines. - -4. Plotting experimental data such that we can also represent error. We did this using the errorbar() function. - - - {{{ Show the "sponsored by FOSSEE" slide }}} - - - -This tutorial was created as a part of FOSSEE project. - -Hope you have enjoyed and found it useful. - - Thankyou - - - -Author : Amit Sethi -Internal Reviewer : -Internal Reviewer 2 : diff -r d87828051c69 -r 8e05616c4102 plotting-data/questions.rst --- a/plotting-data/questions.rst Thu Oct 28 13:19:28 2010 +0530 +++ b/plotting-data/questions.rst Thu Oct 28 15:14:40 2010 +0530 @@ -52,5 +52,14 @@ .. A minimum of 2 questions here (along with answers) -1. Question 1 -2. Question 2 +1. Plot an errorbar for following experimental data. + + | X | Y | Xerr | Yerr | + | 154.9 | 8106 | 8.51 | 165.8 | + | 154.3 | 8138 | 8.50 | 166.3 | + | 148.7 | 8148 | 7.78 | 161.2 | + | 149.6 | 8171 | 7.81 | 162.6 | + +in red colour with large dots + +2. List the parameters for errorbar and their function? diff -r d87828051c69 -r 8e05616c4102 plotting-data/script.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plotting-data/script.rst Thu Oct 28 15:14:40 2010 +0530 @@ -0,0 +1,158 @@ +.. Objectives +.. ---------- + +.. By the end of this tutorial, you will be able to + +.. 1. Defining a list of numbers +.. 2. Squaring a list of numbers +.. 3. Plotting data points. +.. 4. Plotting errorbars. + + +.. Prerequisites +.. ------------- + +.. 1. getting started with plotting + + +.. Author : Amit + Internal Reviewer : + External Reviewer : + Checklist OK? : [2010-10-05] + +Plotting Experimental Data +============================= +Hello and welcome , this tutorial on Plotting Experimental data is +presented by the fossee team. + +{{{ Show the slide containing title }}} + + +{{{ Show the Outline Slide }}} + +Here we will discuss plotting Experimental data. + +1. We will see how we can represent a sequence of numbers in Python. + +2. We will also become fimiliar with elementwise squaring of such a +sequence. + +3. We will also see how we can use our graph to indicate Error. + +One needs to be fimiliar with the concepts of plotting +mathematical functions in Python. + +We will use data from a Simple Pendulum Experiment to illustrate our +points. + +{{{ Simple Pendulum data Slide }}} + + + + +As we know for a simple pendulum length,L is directly proportional to +the square of time,T. We shall be plotting L and T^2 values. + + +First we will have to initiate L and T values. We initiate them as sequence +of values. To tell ipython a sequence of values we write the sequence in +comma seperated values inside two square brackets. This is also called List +so to create two sequences + +L,t type in ipython shell. :: + + In []: L = [0.1, 0.2, 0.3, 0.4, 0.5,0.6, 0.7, 0.8, 0.9] + + In []: t= [0.69, 0.90, 1.19,1.30, 1.47, 1.58, 1.77, 1.83, 1.94] + + + +To obtain the square of sequence t we will use the function square +with argument t.This is saved into the variable tsquare.:: + + In []: tsquare=square(t) + + array([ 0.4761, 0.81 , 1.4161, 1.69 , 2.1609, 2.4964, 3.1329, + 3.3489, 3.7636]) + + +Now to plot L vs T^2 we will simply type :: + + In []: plot(L,t,.) + +'.' here represents to plot use small dots for the point. :: + + In []: clf() + +You can also specify 'o' for big dots.:: + + In []: plot(L,t,o) + + In []: clf() + + +{{{ Slide with Error data included }}} + + +Now we shall try and take into account error into our plots . The +Error values for L and T are on your screen.We shall again intialize +the sequence values in the same manner as we did for L and t :: + + In []: delta_L= [0.08,0.09,0.07,0.05,0.06,0.00,0.06,0.06,0.01] + + In []: delta_T= [0.04,0.08,0.11,0.05,0.03,0.03,0.01,0.07,0.01] + + + +Now to plot L vs T^2 with an error bar we use the function errorbar() + +The syntax of the command is as given on the screen. :: + + + In []: errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='b.') + +This gives a plot with error bar for x and y axis. The dots are of blue color. The parameters xerr and yerr are error on x and y axis and fmt is the format of the plot. + + +similarly we can draw the same error bar with big red dots just change +the parameters to fmt to 'ro'. :: + + In []: clf() + In []: errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='ro') + + + +thats it. you can explore other options to errorbar using the documentation +of errorbar.:: + + In []: errorbar? + + +{{{ Summary Slides }}} + +In this tutorial we have learnt : + +1. How to declare a sequence of number , specifically the kind of sequence we learned was a list. + +2. Plotting experimental data extending our knowledge from mathematical functions. + +3. The various options available for plotting dots instead of lines. + +4. Plotting experimental data such that we can also represent error. We did this using the errorbar() function. + + + {{{ Show the "sponsored by FOSSEE" slide }}} + + + +This tutorial was created as a part of FOSSEE project. + +Hope you have enjoyed and found it useful. + + Thankyou + + + +Author : Amit Sethi +Internal Reviewer : +Internal Reviewer 2 : diff -r d87828051c69 -r 8e05616c4102 plotting-data/slides.org --- a/plotting-data/slides.org Thu Oct 28 13:19:28 2010 +0530 +++ b/plotting-data/slides.org Thu Oct 28 15:14:40 2010 +0530 @@ -58,7 +58,7 @@ : In[]: plot(L,t,o) -* Adding an Error Column +* Adding Error | L | T | /Delta L | /Delta T | @@ -75,10 +75,7 @@ * Plotting Error bar - : In[]: delta_L= [0.08,0.09,0.07,0.05,0.16, - : 0.00,0.06,0.06,0.01] - : In[]: delta_T= [0.04,0.08,0.11,0.05,0.03, - : 0.03,0.01,0.07,0.01] + : In[]: errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, + : fmt='b.') - diff -r d87828051c69 -r 8e05616c4102 plotting-data/slides.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plotting-data/slides.tex Thu Oct 28 15:14:40 2010 +0530 @@ -0,0 +1,152 @@ +% Created 2010-10-28 Thu 15:05 +\documentclass[presentation]{beamer} +\usetheme{Warsaw}\useoutertheme{infolines}\usecolortheme{default}\setbeamercovered{transparent} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{soul} +\usepackage{amssymb} +\usepackage{hyperref} + + +\title{Plotting Experimental Data} +\author{FOSSEE} +\date{2010-09-14 Tue} + +\begin{document} + +\maketitle + + + + + + +\begin{frame} +\frametitle{Tutorial Plan} +\label{sec-1} +\begin{itemize} + +\item Plotting Experiment Data and Error Bars\\ +\label{sec-1.1}% +\end{itemize} % ends low level +\end{frame} +\begin{frame} +\frametitle{Pre-requisites} +\label{sec-2} +\begin{itemize} + +\item Plotting simple analytical Functions\\ +\label{sec-2.1}% +\end{itemize} % ends low level +\end{frame} +\begin{frame} +\frametitle{plot L vs. T$^2$} +\label{sec-3} + + + + +\begin{center} +\begin{tabular}{rr} + L & T \\ + 0.1 & 0.69 \\ + 0.2 & 0.90 \\ + 0.3 & 1.19 \\ + 0.4 & 1.30 \\ + 0.5 & 1.47 \\ + 0.6 & 1.58 \\ + 0.7 & 1.77 \\ + 0.8 & 1.83 \\ + 0.9 & 1.94 \\ +\end{tabular} +\end{center} + + + + +\end{frame} +\begin{frame}[fragile] +\frametitle{Initializing L \& T} +\label{sec-4} + +\begin{verbatim} + In []: L = [0.1, 0.2, 0.3, 0.4, 0.5, + 0.6, 0.7, 0.8, 0.9] + In []: t = [0.69, 0.90, 1.19, + 1.30, 1.47, 1.58, + 1.77, 1.83, 1.94] +\end{verbatim} +\end{frame} +\begin{frame}[fragile] +\frametitle{square()} +\label{sec-5} + +\begin{verbatim} + In []: tsquare=square(t) +\end{verbatim} + + +\begin{verbatim} + array([ 0.4761, 0.81 , 1.4161, 1.69 , 2.1609, 2.4964, 3.1329, + 3.3489, 3.7636]) +\end{verbatim} + + + +\end{frame} +\begin{frame}[fragile] +\frametitle{Plotting} +\label{sec-6} + +\begin{verbatim} + In[]: plot(L,t,.) +\end{verbatim} + + + +\begin{verbatim} + In[]: plot(L,t,o) +\end{verbatim} +\end{frame} +\begin{frame} +\frametitle{Adding Error} +\label{sec-7} + + + + +\begin{center} +\begin{tabular}{rrrr} + L & T & /Delta L & /Delta T \\ + 0.1 & 0.69 & 0.08 & 0.04 \\ + 0.2 & 0.90 & 0.09 & 0.08 \\ + 0.3 & 1.19 & 0.07 & 0.11 \\ + 0.4 & 1.30 & 0.05 & 0.05 \\ + 0.5 & 1.47 & 0.06 & 0.03 \\ + 0.6 & 1.58 & 0.00 & 0.03 \\ + 0.7 & 1.77 & 0.06 & 0.01 \\ + 0.8 & 1.83 & 0.06 & 0.07 \\ + 0.9 & 1.94 & 0.01 & 0.01 \\ +\end{tabular} +\end{center} + + + + +\end{frame} +\begin{frame}[fragile] +\frametitle{Plotting Error bar} +\label{sec-8} + + +\begin{verbatim} + In[]: errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, + fmt='b.') +\end{verbatim} +\end{frame} + +\end{document}