Skip to content

Commit

Permalink
always use spaces after commas
Browse files Browse the repository at this point in the history
  • Loading branch information
edbennett committed Jul 27, 2023
1 parent 9990f6d commit d5b36a0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions episodes/02-numpy.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ It takes a bit of getting used to,
but one way to remember the rule is that
the index is how many steps we have to take from the start to get the item we want.

![](fig/python-zero-index.svg){alt="'data' is a 3 by 3 numpy array containing row 0: \['A', 'B', 'C'\], row 1: \['D', 'E', 'F'\], androw 2: \['G', 'H', 'I'\]. Starting in the upper left hand corner, data\[0, 0\] = 'A', data\[0, 1\] = 'B',data\[0, 2\] = 'C', data\[1, 0\] = 'D', data\[1, 1\] = 'E', data\[1, 2\] = 'F', data\[2, 0\] = 'G',data\[2, 1\] = 'H', and data\[2, 2\] = 'I',in the bottom right hand corner."}
![](fig/python-zero-index.svg){alt="'data' is a 3 by 3 numpy array containing row 0: \['A', 'B', 'C'\], row 1: \['D', 'E', 'F'\], androw 2: \['G', 'H', 'I'\]. Starting in the upper left hand corner, data\[0, 0\] = 'A', data\[0, 1\] = 'B',data\[0, 2\] = 'C', data\[1, 0\] = 'D', data\[1, 1\] = 'E', data\[1, 2\] = 'F', data\[2, 0\] = 'G',data\[2, 1\] = 'H', and data\[2, 2\] = 'I', in the bottom right hand corner."}

::::::::::::::::::::::::::::::::::::::::: callout

Expand Down Expand Up @@ -585,7 +585,7 @@ using NumPy's `vstack` and `hstack` functions for vertical and horizontal stacki
```python
import numpy

A = numpy.array([[1,2,3], [4,5,6], [7, 8, 9]])
A = numpy.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
print('A = ')
print(A)

Expand Down
4 changes: 2 additions & 2 deletions episodes/03-matplotlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ If we want to change this, we can use the `set_ylim(min, max)` method of each 'a
for example:

```python
axes3.set_ylim(0,6)
axes3.set_ylim(0, 6)
```

Update your plotting code to automatically set a more appropriate scale.
Expand All @@ -216,7 +216,7 @@ Update your plotting code to automatically set a more appropriate scale.
# One method
axes3.set_ylabel('min')
axes3.plot(numpy.amin(data, axis=0))
axes3.set_ylim(0,6)
axes3.set_ylim(0, 6)
```

:::::::::::::::::::::::::
Expand Down
2 changes: 1 addition & 1 deletion episodes/04-lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ print(repeats)

1. `[2, 4, 6, 8, 10, 2, 4, 6, 8, 10]`
2. `[4, 8, 12, 16, 20]`
3. `[[2, 4, 6, 8, 10],[2, 4, 6, 8, 10]]`
3. `[[2, 4, 6, 8, 10], [2, 4, 6, 8, 10]]`
4. `[2, 4, 6, 8, 10, 4, 8, 12, 16, 20]`

The technical term for this is *operator overloading*:
Expand Down
10 changes: 5 additions & 5 deletions episodes/06-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ for filename in filenames:
inflammation-01.csv
```

![](fig/03-loop_49_1.png){alt='Output from the first iteration of the for loop. Three line graphs showing the daily average,maximum and minimum inflammation over a 40-day period for all patients in the first dataset.'}
![](fig/03-loop_49_1.png){alt='Output from the first iteration of the for loop. Three line graphs showing the daily average, maximum and minimum inflammation over a 40-day period for all patients in the first dataset.'}

```output
inflammation-02.csv
```

![](fig/03-loop_49_3.png){alt='Output from the second iteration of the for loop. Three line graphs showing the daily average,maximum and minimum inflammation over a 40-day period for all patients in the seconddataset.'}
![](fig/03-loop_49_3.png){alt='Output from the second iteration of the for loop. Three line graphs showing the daily average, maximum and minimum inflammation over a 40-day period for all patients in the seconddataset.'}

```output
inflammation-03.csv
```

![](fig/03-loop_49_5.png){alt='Output from the third iteration of the for loop. Three line graphs showing the daily average,maximum and minimum inflammation over a 40-day period for all patients in the thirddataset.'}
![](fig/03-loop_49_5.png){alt='Output from the third iteration of the for loop. Three line graphs showing the daily average, maximum and minimum inflammation over a 40-day period for all patients in the thirddataset.'}

The plots generated for the second clinical trial file look very similar to the plots for
the first file: their average plots show similar "noisy" rises and falls; their maxima plots
Expand Down Expand Up @@ -161,7 +161,7 @@ Use each of the files once to generate a dataset containing values averaged over

```python
filenames = glob.glob('inflammation*.csv')
composite_data = numpy.zeros((60,40))
composite_data = numpy.zeros((60, 40))
for filename in filenames:
# sum each new file's data into composite_data as it's read
#
Expand All @@ -181,7 +181,7 @@ import numpy
import matplotlib.pyplot

filenames = glob.glob('inflammation*.csv')
composite_data = numpy.zeros((60,40))
composite_data = numpy.zeros((60, 40))

for filename in filenames:
data = numpy.loadtxt(fname = filename, delimiter=',')
Expand Down
2 changes: 1 addition & 1 deletion episodes/08-func.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ let's use NumPy to create a matrix of 0's
and then offset its values to have a mean value of 3:

```python
z = numpy.zeros((2,2))
z = numpy.zeros((2, 2))
print(offset_mean(z, 3))
```

Expand Down
2 changes: 1 addition & 1 deletion episodes/10-defensive.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ The range of each time series is represented as a pair of numbers,
which are the time the interval started and ended.
The output is the largest range that they all include:

![](fig/python-overlapping-ranges.svg){alt='Graph showing three number lines and, at the bottom,the interval that they overlap.'}
![](fig/python-overlapping-ranges.svg){alt='Graph showing three number lines and, at the bottom, the interval that they overlap.'}

Most novice programmers would solve this problem like this:

Expand Down
2 changes: 1 addition & 1 deletion episodes/12-cmdline.md
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ def main():

def count_file(filename):
"""count the number of lines in a file"""
f = open(filename,'r')
f = open(filename, 'r')
nlines = len(f.readlines())
f.close()
return(nlines)
Expand Down

0 comments on commit d5b36a0

Please sign in to comment.