summaryrefslogtreecommitdiff
path: root/plotting_data
diff options
context:
space:
mode:
Diffstat (limited to 'plotting_data')
-rw-r--r--plotting_data/quickref.tex15
-rw-r--r--plotting_data/script.rst218
-rw-r--r--plotting_data/slides.org200
-rw-r--r--plotting_data/slides.tex313
4 files changed, 746 insertions, 0 deletions
diff --git a/plotting_data/quickref.tex b/plotting_data/quickref.tex
new file mode 100644
index 0000000..39ede52
--- /dev/null
+++ b/plotting_data/quickref.tex
@@ -0,0 +1,15 @@
+Creating a Sequence:\\
+{\ex \lstinline| L = [0.1, 0.2, 0.3] |}
+
+Squaring a sequence:\\
+{\ex \lstinline| tsquare=square(t) |}
+
+Plotting two list using small dots:\\
+{\ex \lstinline| plot(L,tsquare,'.') |}
+
+Plotting two list using big dots:\\
+{\ex \lstinline| plot(L,tsquare,'o') |}
+
+Plotting an errorbar in blue color:\\
+{\ex \lstinline| errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='b.') |}
+
diff --git a/plotting_data/script.rst b/plotting_data/script.rst
new file mode 100644
index 0000000..f2a0a29
--- /dev/null
+++ b/plotting_data/script.rst
@@ -0,0 +1,218 @@
+.. 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 : Anoop Jacob Thomas<anoop@fossee.in>
+ External Reviewer :
+ Checklist OK? : <put date stamp here, if OK> [2010-10-05]
+
+.. #[[Anoop: Add quickref]]
+.. #[[Anoop: Slides are incomplete, add summary slide, thank you slide
+ etc.]]
+
+===============================
+Plotting Experimental Data
+===============================
+
+{{{ Show the slide containing title }}}
+
+Hello and welcome , this tutorial on Plotting Experimental data is
+presented by the fossee team.
+
+{{{ Show the Outline Slide }}}
+
+.. #[[Anoop: outline slide is missing]]
+
+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 familiar with elementwise squaring of such a
+sequence.
+
+3. How to plot data points using python.
+
+4. We will also see how we can use our graph to indicate Error.
+
+One needs to be familiar with the concepts of plotting
+mathematical functions in Python.
+
+We will use data from a Simple Pendulum Experiment to illustrate.
+
+.. #[[Anoop: what do you mean by points here? if you mean the
+ points/numbered list in outline slide, then remove the usage point
+ from here.]]
+
+{{{ Simple Pendulum data Slide }}}
+
+.. #[[Anoop: slides are incomplete, work on slides and context
+ switches]]
+
+
+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. We define a sequence by comma seperated values inside two square brackets.
+This is also called List.Lets create two sequences L and t.
+
+.. #[[Anoop: instead of saying "to tell ipython a sequence of values"
+ and make it complicated, we can tell, we define a sequence as]]
+
+.. #[[Anoop: sentence is incomplete, can be removed]]
+
+{{{ Show the initializing L&T slide }}}
+
+Type in ipython shell ::
+
+ L = [0.1, 0.2, 0.3, 0.4, 0.5,0.6, 0.7, 0.8, 0.9]
+
+ 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.::
+
+ tsquare=square(t)
+ tsqaure
+ array([ 0.4761, 0.81 , 1.4161, 1.69 , 2.1609, 2.4964, 3.1329,
+ 3.3489, 3.7636])
+
+.. #[[Anoop: how do you get the array([ 0.4761 ....]) output?]]
+
+
+Now to plot L vs T^2 we will simply type ::
+
+ plot(L,tsquare,'.')
+
+.. #[[Anoop: be consistent with the spacing and all.]]
+
+'.' here represents to plot use small dots for the point. ::
+
+ clf()
+
+You can also specify 'o' for big dots.::
+
+ plot(L,tsquare,'o')
+
+ clf()
+
+
+Following are exercises that you must do.
+
+%% %% Plot the given experimental data with large dots.The data is
+on your screen.
+
+%% %% Plot the given experimental data with small dots.
+The data is on your screen
+
+
+Please, pause the video here. Do the exercises and then continue.
+
+
+
+
+
+.. #[[Anoop: Make sure code is correct, corrected plot(L,t,o) to
+ plot(L,t,'o')]]
+
+
+
+.. #[[Anoop: again slides are incomplete.]]
+
+For any experimental there is always an error in measurements due to
+instrumental and human constaraints.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
+
+The error data we will use is on your screen.
+
+{{{ Show the Adding Error Slide }}}
+.. #[[Anoop: give introduction to error and say what we are going to
+ do]]
+
+::
+
+ delta_L= [0.08,0.09,0.07,0.05,0.06,0.00,0.06,0.06,0.01]
+ delta_T= [0.04,0.08,0.03,0.05,0.03,0.03,0.04,0.07,0.08]
+
+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. ::
+
+
+ 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'. ::
+
+ clf()
+ 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.::
+
+ errorbar?
+
+Following is an exercise that you must do.
+
+%% %% Plot the given experimental data with large green dots.Also include
+the error in your plot.
+
+Please, pause the video here. Do the exercise and then continue.
+
+
+
+
+
+
+
+{{{ Show Summary Slide }}}
+
+In this tutorial we have learnt :
+
+
+
+1. How to declare a sequence of numbers.
+
+2. Plotting experimental data.
+
+#. The various options available for plotting dots instead of lines.
+
+#. Plotting experimental data such that we can also represent error.
+
+
+
+ {{{ Show the "sponsored by FOSSEE" slide }}}
+
+.. #[[Anoop: again slides are incomplete]]
+
+This tutorial was created as a part of FOSSEE project.
+
+Hope you have enjoyed and found it useful.
+
+Thank You!
+
diff --git a/plotting_data/slides.org b/plotting_data/slides.org
new file mode 100644
index 0000000..e0daeaa
--- /dev/null
+++ b/plotting_data/slides.org
@@ -0,0 +1,200 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Plotting Experimental Data
+#+AUTHOR: FOSSEE
+#+DATE: 2010-09-14 Tue
+#+EMAIL: info@fossee.in
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Defining sequence of numbers
+ - Squaring sequence of numbers
+ - Plotting Data Points
+ - Indicating Error through Errorbars
+
+* Simple Pendulum Data
+
+#+ORGTBL: L vs T^2 orgtbl-to-latex
+
+ | 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 |
+
+
+* Initializing L & T
+ : L = [0.1, 0.2, 0.3, 0.4, 0.5,
+ : 0.6, 0.7, 0.8, 0.9]
+ : t = [0.69, 0.90, 1.19,
+ : 1.30, 1.47, 1.58,
+ : 1.77, 1.83, 1.94]
+
+
+
+* Question 1
+ - Plot the given experimental data with large dots.
+ The data is on your screen.
+
+
+* Question 1 Data
+
+#+ORGTBL: L vs T^2 orgtbl-to-latex
+
+
+ | S | n |
+ | 0.19 | 10.74 |
+ | 0.38 | 14.01 |
+ | 0.57 | 18.52 |
+ | 0.77 | 20.23 |
+ | 0.96 | 22.88 |
+ | 1.15 | 24.59 |
+ | 1.34 | 27.55 |
+ | 1.54 | 28.48 |
+ | 1.73 | 30.20 |
+
+
+* Solution 1
+
+ : S=[0.19,0.38,0.57,0.77,0.96,
+ : 1.15,1.34,1.54,1.73]
+ : n=[10.74,14.01,18.52,20.23,
+ : 22.88,24.59,27.55,28.48,30.20]
+ : plot(S,n,'o')
+
+* Question 2
+ - Plot the given experimental data with small dots.
+ The data is on your screen.
+
+* Question 2 Data
+
+#+ORGTBL: L vs T^2 orgtbl-to-latex
+
+ | P | D |
+ | 1.48 | 0.68 |
+ | 2.96 | 0.89 |
+ | 4.44 | 1.18 |
+ | 5.92 | 1.29 |
+ | 7.40 | 1.46 |
+ | 8.88 | 1.57 |
+ | 10.3 | 1.76 |
+ | 11.8 | 1.82 |
+ | 13.3 | 1.93 |
+
+* Solution 2
+
+ : P=[1.48,2.96,4.44,5.92,7.40,
+ : 8.88,10.3,11.8,13.3]
+ : D=[0.68,0.89,1.18,1.29,1.46,
+ : 1.57,1.76,1.82,1.93]
+ : plot(P,D,'.')
+
+* Adding Error
+
+#+ORGTBL: L vs T^2 orgtbl-to-latex
+
+ | 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.03 |
+ | 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.04 |
+ | 0.8 | 1.83 | 0.06 | 0.07 |
+ | 0.9 | 1.94 | 0.01 | 0.08 |
+
+
+* Plotting Error bar
+
+ : errorbar(L,tsquare,xerr=delta_L, yerr=delta_T,
+ : fmt='b.')
+
+
+* Question 1
+
+ - Plot the given experimental data with large green dots.Also include
+ the error in your plot.
+
+
+* Question 1 Data
+
+ #+ORGTBL: L vs T^2 orgtbl-to-latex
+
+ | S | n | \delta S | \delta n |
+ | 0.19 | 10.74 | 0.006 | 0.61 |
+ | 0.38 | 14.01 | 0.006 | 0.69 |
+ | 0.57 | 18.52 | 0.005 | 0.53 |
+ | 0.77 | 20.23 | 0.003 | 0.38 |
+ | 0.96 | 22.88 | 0.004 | 0.46 |
+ | 1.15 | 24.59 | 0.007 | 0.37 |
+ | 1.34 | 27.55 | 0.004 | 0.46 |
+ | 1.54 | 28.48 | 0.004 | 0.46 |
+ | 1.73 | 30.20 | 0.007 | 0.37 |
+
+
+
+
+* Solution 1
+
+ : S=[0.19,0.38,0.57,0.77,0.96,
+ : 1.15,1.34,1.54,1.73]
+ : n=[10.74,14.01,18.52,20.23,
+ : 22.88,24.59,27.55,28.48,30.20]
+ : delta_S=[0.006,0.006,0.005,0.003,
+ : 0.004,0.007,0.004,0.004,0.007]
+ : delta_n=[0.61,0.69,0.53,0.38,0.46,
+ : 0.37,0.46,0.46,0.37]
+ : errorbar(S,n,xerr=delta_S, yerr=delta_n,
+ : fmt='go')
+
+* Summary
+ : L = [0.1, 0.2, 0.3, 0.4, 0.5,
+ : 0.6, 0.7, 0.8, 0.9]
+ : plot(x,y,'o')
+ : plot(x,y,'.')
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
+
diff --git a/plotting_data/slides.tex b/plotting_data/slides.tex
new file mode 100644
index 0000000..575632f
--- /dev/null
+++ b/plotting_data/slides.tex
@@ -0,0 +1,313 @@
+% Created 2010-11-10 Wed 02:09
+\documentclass[presentation]{beamer}
+\usepackage[latin1]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{t1enc}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
+
+\title{Plotting Experimental Data}
+\author{FOSSEE}
+\date{2010-09-14 Tue}
+
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+\begin{document}
+
+\maketitle
+
+
+
+
+
+
+
+
+
+\begin{frame}
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Defining sequence of numbers
+\item Squaring sequence of numbers
+\item Plotting Data Points
+\item Indicating Error through Errorbars
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Simple Pendulum Data}
+\label{sec-2}
+
+
+
+
+\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-3}
+
+\begin{verbatim}
+ L = [0.1, 0.2, 0.3, 0.4, 0.5,
+ 0.6, 0.7, 0.8, 0.9]
+ 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}
+\frametitle{Question 1}
+\label{sec-4}
+
+\begin{itemize}
+\item Plot the given experimental data with large dots.
+\end{itemize}
+
+ The data is on your screen.
+
+\end{frame}
+\begin{frame}
+\frametitle{Question 1 Data}
+\label{sec-5}
+
+
+
+
+
+\begin{center}
+\begin{tabular}{rr}
+ S & n \\
+ 0.19 & 10.74 \\
+ 0.38 & 14.01 \\
+ 0.57 & 18.52 \\
+ 0.77 & 20.23 \\
+ 0.96 & 22.88 \\
+ 1.15 & 24.59 \\
+ 1.34 & 27.55 \\
+ 1.54 & 28.48 \\
+ 1.73 & 30.20 \\
+\end{tabular}
+\end{center}
+
+
+
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 1}
+\label{sec-6}
+
+
+\begin{verbatim}
+ S=[0.19,0.38,0.57,0.77,0.96,
+ 1.15,1.34,1.54,1.73]
+ n=[10.74,14.01,18.52,20.23,
+ 22.88,24.59,27.55,28.48,30.20]
+ plot(S,n,'o')
+\end{verbatim}
+\end{frame}
+\begin{frame}
+\frametitle{Question 2}
+\label{sec-7}
+
+\begin{itemize}
+\item Plot the given experimental data with small dots.
+\end{itemize}
+
+ The data is on your screen.
+\end{frame}
+\begin{frame}
+\frametitle{Question 2 Data}
+\label{sec-8}
+
+
+
+
+\begin{center}
+\begin{tabular}{rr}
+ P & D \\
+ 1.48 & 0.68 \\
+ 2.96 & 0.89 \\
+ 4.44 & 1.18 \\
+ 5.92 & 1.29 \\
+ 7.40 & 1.46 \\
+ 8.88 & 1.57 \\
+ 10.3 & 1.76 \\
+ 11.8 & 1.82 \\
+ 13.3 & 1.93 \\
+\end{tabular}
+\end{center}
+
+
+
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 2}
+\label{sec-9}
+
+
+\begin{verbatim}
+ P=[1.48,2.96,4.44,5.92,7.40,
+ 8.88,10.3,11.8,13.3]
+ D=[0.68,0.89,1.18,1.29,1.46,
+ 1.57,1.76,1.82,1.93]
+ plot(P,D,'.')
+\end{verbatim}
+\end{frame}
+\begin{frame}
+\frametitle{Adding Error}
+\label{sec-10}
+
+
+
+
+\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.03 \\
+ 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.04 \\
+ 0.8 & 1.83 & 0.06 & 0.07 \\
+ 0.9 & 1.94 & 0.01 & 0.08 \\
+\end{tabular}
+\end{center}
+
+
+
+
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Plotting Error bar}
+\label{sec-11}
+
+
+\begin{verbatim}
+ errorbar(L,tsquare,xerr=delta_L, yerr=delta_T,
+ fmt='b.')
+\end{verbatim}
+\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-12}
+
+
+\begin{itemize}
+\item Plot the given experimental data with large green dots.Also include
+\end{itemize}
+
+ the error in your plot.
+
+
+\end{frame}
+\begin{frame}
+\frametitle{Question 1 Data}
+\label{sec-13}
+
+
+ \#+ORGTBL: L vs T$^2$ orgtbl-to-latex
+
+
+\begin{center}
+\begin{tabular}{rrrr}
+ S & n & $\delta$ S & $\delta$ n \\
+ 0.19 & 10.74 & 0.006 & 0.61 \\
+ 0.38 & 14.01 & 0.006 & 0.69 \\
+ 0.57 & 18.52 & 0.005 & 0.53 \\
+ 0.77 & 20.23 & 0.003 & 0.38 \\
+ 0.96 & 22.88 & 0.004 & 0.46 \\
+ 1.15 & 24.59 & 0.007 & 0.37 \\
+ 1.34 & 27.55 & 0.004 & 0.46 \\
+ 1.54 & 28.48 & 0.004 & 0.46 \\
+ 1.73 & 30.20 & 0.007 & 0.37 \\
+\end{tabular}
+\end{center}
+
+
+
+
+
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 1}
+\label{sec-14}
+
+
+\begin{verbatim}
+ S=[0.19,0.38,0.57,0.77,0.96,
+ 1.15,1.34,1.54,1.73]
+ n=[10.74,14.01,18.52,20.23,
+ 22.88,24.59,27.55,28.48,30.20]
+ delta_S=[0.006,0.006,0.005,0.003,
+ 0.004,0.007,0.004,0.004,0.007]
+ delta_n=[0.61,0.69,0.53,0.38,0.46,
+ 0.37,0.46,0.46,0.37]
+ errorbar(S,n,xerr=delta_S, yerr=delta_n,
+ fmt='go')
+\end{verbatim}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Summary}
+\label{sec-15}
+
+\begin{verbatim}
+ L = [0.1, 0.2, 0.3, 0.4, 0.5,
+ 0.6, 0.7, 0.8, 0.9]
+ plot(x,y,'o')
+ plot(x,y,'.')
+\end{verbatim}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-16}
+
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+\end{frame}
+
+\end{document}