From 16f3ea4d77905aaf2b24b34df51d937fc37ba3da Mon Sep 17 00:00:00 2001
From: Frank Sauerburger <frank@sauerburger.com>
Date: Thu, 19 Jul 2018 11:17:07 +0200
Subject: [PATCH] Fix typos

---
 README.md | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/README.md b/README.md
index 8360e83..23d3923 100644
--- a/README.md
+++ b/README.md
@@ -46,8 +46,8 @@ good solution for windows users since it provides all required packages.
 # Prerequisites and About the Tutorial
 
 This tutorial assumes that you have some experience with python, which
-includes variable assignment, function calling and function definition, if statements and
-for loops. The tutorial uses only the very basics, such as variable assignments
+includes variable assignment, function calling and function definition, `if` statements and
+`for` loops. The tutorial uses only the very basics, such as variable assignments
 and function calls, but it is certainly advisable to know about control
 structures.
 
@@ -58,14 +58,14 @@ switch to python.
 
 This tutorial is divided into several examples, which might depend on each
 other. The examples show code snippets which you are supposed to copy to a text
-editor. The scripts can then be executed in a terminal. Besides this modus
+editor and save to a file. The scripts can then be executed in a terminal. Besides this modus
 operandi, you are invited to use
 the interactive mode of python or ipython instead and copy the code directly
 to the python interpreter. Recently [jupyter](http://jupyter.org/) notebooks have 
 become very popular. I recommend you to try out these different options and
 choose the one most suited for you.
 
-This repository does not contain ready-made python example scripts or plots. The
+*Side remark: This repository does not contain ready-made python example scripts or plots. The
 only code resource is this README file. The idea behind this is, that there
 shouldn't be duplications of code snippets, which will be out-of-sync eventually.
 The repository is set up, such that
@@ -74,7 +74,7 @@ the README and executes them with the
 [doxec](https://gitlab.sauerburger.com/frank/doxec) package. This means you can
 download [ready-made scripts and
 plots](https://gitlab.sauerburger.com/frank/FP-python-examples/-/jobs/artifacts/master/download?job=doxec_test)
-produced by the continues integration task.
+produced by the continues integration task.*
 
 Let's get going!
 
@@ -91,7 +91,7 @@ import math
 print("Example 1:")
 
 # Strings can be formatted with the % operator. The placeholder %g prints a
-# floating point numbers as decimal or with exponent depending on its
+# floating point numbers as decimal or in exponent notation(3e9) depending on its
 # magnitude.
 print("  Square root of 2 = %g" % math.sqrt(2))
 ```
@@ -113,14 +113,14 @@ The standard data structure to store numerical data is a numpy array. Numpy
 arrays are defined in the numpy package and are implemented in a very
 efficient way. 
 
-To get stared with numpy arrays create a file `np_arrays.py` and add all lines
+To get stared with numpy arrays, create a file `np_arrays.py` and add all lines
 listed in this section. The first line should be an import statement.
 <!-- write np_arrays.py -->
 ```python
 # Import the numpy library.
 import numpy as np
 ```
-In this example, we create a numpy array `numbers` containing my favorite numbers from
+In this example, we create the numpy array `numbers` containing my favorite numbers from
 the python list `[4, 9, 16, 36, 49]`.
 <!-- append np_arrays.py -->
 ```python
@@ -141,7 +141,7 @@ Since the resulting variable `roots` is also a numpy array, we can perform
 similar operations on this variable.
 <!-- append np_arrays.py -->
 ```python
-# Perform other calucaltions for each element separately.
+# Execute other computations for each element separately.
 something_else = 1.5 * roots - 4
 ```
 Numpy arrays overload the typical arithmetic operations, such that the above
@@ -149,7 +149,7 @@ statement benefits from numpys efficient, vectorized (i.e. performing the same
 operation on may values) implementation. You should always think about a way to
 use such vectorized statements, and try to avoid manually looping over all the
 values. Using a python loop to run over $`10^3`$ values is probably fine, but you
-don't want to wait for a python loop iterating over 10^6 or 10^9 values.
+don't want to wait for a python loop iterating over 10^8 or 10^9 values.
 
 Finally, add a print statement to check that all the calculations have been
 carried out as expected. 
@@ -172,7 +172,7 @@ introduction. It is definitely worth glancing at the
 
 # Plotting Functions
 One major aspect of data analysis is the visualization of data. This includes the
-generation of diagrams and plots. You can use the powerful library matplotlib to
+generation of diagrams and plots. You can use the powerful matplotlib library to
 create high-quality plots in a python environment. The goal of this example is to plot
 the cropped parabola
 
@@ -184,6 +184,7 @@ the cropped parabola
 ```
 
 which looks like this:
+
 ![Plot of cropped parabola](https://gitlab.sauerburger.com/frank/FP-python-examples/-/jobs/artifacts/master/raw/cropped_parabola.png?job=doxec_test)
 
 Create the file `func_plot.py` and add the following lines.
@@ -214,7 +215,7 @@ x = np.linspace(-2.5, 3, 200)
 ```
 
 We can easily calculate the square of all these values with `x**2`. Cropping the
-right part is a bit more complex. First we create an index array of `1`'s and
+right part is a bit more tricky. First we create an index array of `1`'s and
 `0`'s, which
 indicate whether $`x \geq 2`$. This index array has the same length as our
 $`x`$-grid. The first elements of the index array are `0`'s, since the
@@ -278,10 +279,10 @@ cropped_parabola.png
 -->
 
 # Plotting Data Points
-A typical task in the advanced laboratory might be to compare measured data
+A typical task in the advanced laboratory is to compare measured data
 points to an expected function. Let's assume the expected function is the cropped
 parabola $`f(x)`$ from the previous example. We will use random data points in
-this example since we haven't actually measured real data, which is expected to
+this example since we haven't actually measured real data which is expected to
 follow $`f(x)`$.
 
 This example is based on the code from the previous example. Copy the file from
@@ -365,11 +366,13 @@ After running `data_plot.py`, you should have a plot similar to this.
 # Reading, Plotting and Fitting Experimental Data
 We are given with experimental data from a radioactive decay in this example.
 The experimental setup consisted of a radioactive probe, a detector, and a
-multi-channel-analyzer. The recorded data in `decay.txt` consist of two
+multi-channel-analyzer. The recorded data in
+[`decay.txt`](https://gitlab.sauerburger.com/frank/FP-python-examples/blob/master/decay.txt)
+consist of two
 tab-separated columns. The first column is called channel. Each channel
 corresponds to a certain energy range. The multi-channel-analyzer maintains a
 counter for each channel. A detected decay causes the multi-channel-analyzer to increment the internal counter which
-corresponds to the energy of the measured decay. The second column stored
+corresponds to the energy of the measured decay. The second column stores
 these counts. Open the file with your favorite text editor and have a look at the
 data.
 
@@ -399,7 +402,7 @@ import matplotlib.pyplot as plt
 ```
 
 To inspect the provided data, we can plot the raw data points first. Numpy
-provides the function `loadtxt`, which reads a whitespace-separated file into a
+provides the function `genfromtxt`, which reads a whitespace-separated file into a
 numpy array. The function returns a two-dimensional array. The outer array has
 one entry for each line in the text file. The inner array has two entries in our
 case, one for the
@@ -413,7 +416,7 @@ the square roots of the number of events.
 <!-- append decay.py -->
 ```python
 # Read both columns from the text file.
-channel, count = np.loadtxt("decay.txt").transpose()
+channel, count = np.genfromtxt("decay.txt").transpose()
 
 # Calculate the uncertainty on the number of events per channel.
 s_count = np.sqrt(count)
@@ -438,6 +441,7 @@ The plot of the raw data is shown below. The plot shows the channel on the
 $`x`$-axis and the number of events per bin on the $`y`$-axis. From the
 experimental setup, we expect a
 linearly rising background plus a Gaussian peak.
+
 ![Data only for the decay](https://gitlab.sauerburger.com/frank/FP-python-examples/-/jobs/artifacts/master/raw/decay_raw.png?job=doxec_test)
 
 Judging from the plot, it looks like the assumed model could describe the data. We
@@ -534,6 +538,7 @@ $ python3 decay.py
 ```
 -->
 The result should look like this.
+
 ![Data and fit for the decay](https://gitlab.sauerburger.com/frank/FP-python-examples/-/jobs/artifacts/master/raw/decay.png?job=doxec_test)
 
 Usually, we want to measure some quantity with an experimental setup. For this,
@@ -557,12 +562,13 @@ print()  # print blank line
 A $`\chi^2`$-test can be performed to assess the goodness of this fit. In
 a counting experiment like this one, we can rely on scipy's `chisquare`, which
 returns the $`\chi^2`$ and the $`p`$-value. The `chisquare` method assumes, that
-the uncertainties are the square root of the expected number of events. If this is not the
+the uncertainties are the square roots of the expected number of events. If this is not the
 case, we have to compute the $`\chi^2`$ manually. The following example shows
 both, the usage of `chisquare` and the manual computation. The print statements
 for both methods produce the same output. Please note that
-we have five degrees of freedom since we have five free parameters in our
-model.
+our model has five degrees of freedom since we have five free parameters. The
+total number of degrees of freedom is the number of data points reduced by the
+number of degrees of freedom of our model.
 
 <!-- append decay.py -->
 ```python
-- 
GitLab