diff --git a/_config.yml b/_config.yml index bedf1bfc5..69eadf1aa 100644 --- a/_config.yml +++ b/_config.yml @@ -11,11 +11,12 @@ kind: "lesson" # Overall title for pages. title: "Programming with Python" -# Account (without slashes). -account: "swcarpentry" +# Repository URL (without trailing slash). +repo: https://github.com/swcarpentry/python-novice-inflammation -# Root URL below account (without slashes). -project: "python-novice-gapminder" +# Root URL below username.github.io domain, with leading slash but no trailing slash. +# For example, for 'https://swcarpentry.github.io/lesson-example', use '/lesson-example'. +root: "/python-novice-inflammation" # Contact email address. email: lessons@software-carpentry.org diff --git a/_episodes/01-numpy.md b/_episodes/01-numpy.md index dd81fd049..254b690c3 100644 --- a/_episodes/01-numpy.md +++ b/_episodes/01-numpy.md @@ -143,7 +143,7 @@ weight in kilograms is now: 57.5 If we imagine the variable as a sticky note with a name written on it, assignment is like putting the sticky note on a particular value: -![Variables as Sticky Notes]({{ site.github.url }}/fig/python-sticky-note-variables-01.svg) +![Variables as Sticky Notes]({{ site.root }}/fig/python-sticky-note-variables-01.svg) This means that assigning a value to one variable does *not* change the values of other variables. For example, @@ -160,7 +160,7 @@ weight in kilograms: 57.5 and in pounds: 126.5 ~~~ {: .output} -![Creating Another Variable]({{ site.github.url }}/fig/python-sticky-note-variables-02.svg) +![Creating Another Variable]({{ site.root }}/fig/python-sticky-note-variables-02.svg) and then change `weight_kg`: @@ -175,7 +175,7 @@ weight in kilograms is now: 100.0 and weight in pounds is still: 126.5 ~~~ {: .output} -![Updating a Variable]({{ site.github.url }}/fig/python-sticky-note-variables-03.svg) +![Updating a Variable]({{ site.root }}/fig/python-sticky-note-variables-03.svg) Since `weight_lb` doesn't "remember" where its value came from, it isn't automatically updated when `weight_kg` changes. @@ -591,7 +591,7 @@ next diagram on the left), or the average for each day (as in the diagram on the right)? As the diagram below shows, we want to perform the operation across an axis: -![Operations Across Axes]({{ site.github.url }}/fig/python-operations-across-axes.png) +![Operations Across Axes]({{ site.root }}/fig/python-operations-across-axes.png) To support this, most array functions allow us to specify the axis we want to work on. @@ -667,7 +667,7 @@ matplotlib.pyplot.show() ~~~ {: .python} -![Heatmap of the Data]({{ site.github.url }}/fig/01-numpy_71_0.png) +![Heatmap of the Data]({{ site.root }}/fig/01-numpy_71_0.png) Blue regions in this heat map are low values, while red shows high values. As we can see, @@ -699,7 +699,7 @@ matplotlib.pyplot.show() ~~~ {: .python} -![Average Inflammation Over Time]({{ site.github.url }}/fig/01-numpy_73_0.png) +![Average Inflammation Over Time]({{ site.root }}/fig/01-numpy_73_0.png) Here, we have put the average per day across all patients in the variable `ave_inflammation`, @@ -716,7 +716,7 @@ matplotlib.pyplot.show() ~~~ {: .python} -![Maximum Value Along The First Axis]({{ site.github.url }}/fig/01-numpy_75_1.png) +![Maximum Value Along The First Axis]({{ site.root }}/fig/01-numpy_75_1.png) ~~~ min_plot = matplotlib.pyplot.plot(numpy.min(data, axis=0)) @@ -724,7 +724,7 @@ matplotlib.pyplot.show() ~~~ {: .python} -![Minimum Value Along The First Axis]({{ site.github.url }}/fig/01-numpy_75_3.png) +![Minimum Value Along The First Axis]({{ site.root }}/fig/01-numpy_75_3.png) The maximum value rises and falls perfectly smoothly, while the minimum seems to be a step function. @@ -773,7 +773,7 @@ matplotlib.pyplot.show() ~~~ {: .python} -![The Previous Plots as Subplots]({{ site.github.url }}/fig/01-numpy_80_0.png) +![The Previous Plots as Subplots]({{ site.root }}/fig/01-numpy_80_0.png) The [call](reference.html#function-call) to `loadtxt` reads our data, and the rest of the program tells the plotting library diff --git a/_episodes/02-loop.md b/_episodes/02-loop.md index 03d1f1acd..a9cb6b11e 100644 --- a/_episodes/02-loop.md +++ b/_episodes/02-loop.md @@ -17,7 +17,7 @@ In the last lesson, we wrote some code that plots some values of interest from our first inflammation dataset, and reveals some suspicious features in it, such as from `inflammation-01.csv` -![Analysis of inflammation-01.csv]({{ site.github.url }}/fig/03-loop_2_0.png) +![Analysis of inflammation-01.csv]({{ site.root }}/fig/03-loop_2_0.png) We have a dozen data sets right now, though, and more on the way. We want to create plots for all of our data sets with a single statement. @@ -142,7 +142,7 @@ for variable in collection: Using the oxygen example above, the loop might look like this: -![loop_image]({{ site.github.url }}/fig/loops_image.png) +![loop_image]({{ site.root }}/fig/loops_image.png) where each character (`char`) in the variable `word` is looped through and printed one character after another. The numbers in the diagram denote which loop cycle the character was printed in (1 being the first loop, and 6 being the final loop). diff --git a/_episodes/03-lists.md b/_episodes/03-lists.md index 203bb5808..97e85b6d9 100644 --- a/_episodes/03-lists.md +++ b/_episodes/03-lists.md @@ -135,7 +135,7 @@ does not. > Here is a visual example of how indexing a list of lists `x` works: > > -> ![The first element of a list. Adapted from @hadleywickham's tweet about R lists.]({{ site.github.url }}/fig/indexing_lists_python.png) +> ![The first element of a list. Adapted from @hadleywickham's tweet about R lists.]({{ site.root }}/fig/indexing_lists_python.png) > > Using the previously declared list `x`, these would be the results of the > index operations shown in the image: diff --git a/_episodes/04-files.md b/_episodes/04-files.md index d8a12b04c..16cda62fb 100644 --- a/_episodes/04-files.md +++ b/_episodes/04-files.md @@ -80,21 +80,21 @@ inflammation-01.csv ~~~ {: .output} -![Analysis of inflammation-01.csv]({{ site.github.url }}/fig/03-loop_49_1.png) +![Analysis of inflammation-01.csv]({{ site.root }}/fig/03-loop_49_1.png) ~~~ inflammation-02.csv ~~~ {: .output} -![Analysis of inflammation-02.csv]({{ site.github.url }}/fig/03-loop_49_3.png) +![Analysis of inflammation-02.csv]({{ site.root }}/fig/03-loop_49_3.png) ~~~ inflammation-03.csv ~~~ {: .output} -![Analysis of inflammation-03.csv]({{ site.github.url }}/fig/03-loop_49_5.png) +![Analysis of inflammation-03.csv]({{ site.root }}/fig/03-loop_49_5.png) Sure enough, the maxima of the first two data sets show exactly the same ramp as the first, diff --git a/_episodes/05-cond.md b/_episodes/05-cond.md index f56bca5e7..f5afddc8c 100644 --- a/_episodes/05-cond.md +++ b/_episodes/05-cond.md @@ -45,7 +45,7 @@ If the test is false, the body of the `else` is executed instead. Only one or the other is ever executed: -![Executing a Conditional]({{ site.github.url }}/fig/python-flowchart-conditional.png) +![Executing a Conditional]({{ site.root }}/fig/python-flowchart-conditional.png) Conditional statements don't have to include an `else`. If there isn't one, diff --git a/_episodes/06-func.md b/_episodes/06-func.md index d1f66f94b..7f410ffc4 100644 --- a/_episodes/06-func.md +++ b/_episodes/06-func.md @@ -38,7 +38,7 @@ def fahr_to_kelvin(temp): ~~~ {: .python} -![The Blueprint for a Python Function]({{ site.github.url }}/fig/python-function.svg) +![The Blueprint for a Python Function]({{ site.root }}/fig/python-function.svg) diff --git a/_episodes/08-defensive.md b/_episodes/08-defensive.md index 5906e4f55..ec0d0f065 100644 --- a/_episodes/08-defensive.md +++ b/_episodes/08-defensive.md @@ -259,7 +259,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: -![Overlapping Ranges]({{ site.github.url }}/fig/python-overlapping-ranges.svg) +![Overlapping Ranges]({{ site.root }}/fig/python-overlapping-ranges.svg) Most novice programmers would solve this problem like this: diff --git a/_extras/discuss.md b/_extras/discuss.md index a35028ff8..3c31835de 100644 --- a/_extras/discuss.md +++ b/_extras/discuss.md @@ -33,7 +33,7 @@ final = fahr_to_celsius(original) The diagram below shows what memory looks like after the first line has been executed: -![Call Stack (Initial State)]({{ site.github.url }}/fig/python-call-stack-01.svg) +![Call Stack (Initial State)]({{ site.root }}/fig/python-call-stack-01.svg) When we call `fahr_to_celsius`, Python *doesn't* create the variable `temp` right away. @@ -43,12 +43,12 @@ to keep track of the variables defined by `fahr_to_kelvin`. Initially, this stack frame only holds the value of `temp`: -![Call Stack Immediately After First Function Call]({{ site.github.url }}/fig/python-call-stack-02.svg) +![Call Stack Immediately After First Function Call]({{ site.root }}/fig/python-call-stack-02.svg) When we call `fahr_to_kelvin` inside `fahr_to_celsius`, Python creates another stack frame to hold `fahr_to_kelvin`'s variables: -![Call Stack During First Nested Function Call]({{ site.github.url }}/fig/python-call-stack-03.svg) +![Call Stack During First Nested Function Call]({{ site.root }}/fig/python-call-stack-03.svg) It does this because there are now two variables in play called `temp`: the parameter to `fahr_to_celsius`, @@ -61,18 +61,18 @@ When the call to `fahr_to_kelvin` returns a value, Python throws away `fahr_to_kelvin`'s stack frame and creates a new variable in the stack frame for `fahr_to_celsius` to hold the temperature in Kelvin: -![Call Stack After Return From First Nested Function Call]({{ site.github.url }}/fig/python-call-stack-04.svg) +![Call Stack After Return From First Nested Function Call]({{ site.root }}/fig/python-call-stack-04.svg) It then calls `kelvin_to_celsius`, which means it creates a stack frame to hold that function's variables: -![Call Stack During Call to Second Nested Function]({{ site.github.url }}/fig/python-call-stack-05.svg) +![Call Stack During Call to Second Nested Function]({{ site.root }}/fig/python-call-stack-05.svg) Once again, Python throws away that stack frame when `kelvin_to_celsius` is done and creates the variable `result` in the stack frame for `fahr_to_celsius`: -![Call Stack After Second Nested Function Returns]({{ site.github.url }}/fig/python-call-stack-06.svg) +![Call Stack After Second Nested Function Returns]({{ site.root }}/fig/python-call-stack-06.svg) Finally, when `fahr_to_celsius` is done, @@ -80,7 +80,7 @@ Python throws away *its* stack frame and puts its result in a new variable called `final` that lives in the stack frame we started with: -![Call Stack After All Functions Have Finished]({{ site.github.url }}/fig/python-call-stack-07.svg) +![Call Stack After All Functions Have Finished]({{ site.root }}/fig/python-call-stack-07.svg) This final stack frame is always there; it holds the variables we defined outside the functions in our code. @@ -200,7 +200,7 @@ grid.show() ~~~ {: .python} -![]({{ site.github.url }}/fig/grid-01.png) +![]({{ site.root }}/fig/grid-01.png) Just like a NumPy array, an `ImageGrid` has some properties that hold information about it: @@ -228,7 +228,7 @@ RGB is an [additive color model](reference.html#additive-color-model): every shade is some combination of red, green, and blue intensities. We can think of these three values as being the axes in a cube: -![RGB Color Cube]({{ site.github.url }}/fig/color-cube.png) +![RGB Color Cube]({{ site.root }}/fig/color-cube.png) An RGB color is an example of a multi-part value: like a Cartesian coordinate, @@ -310,7 +310,7 @@ row.show() ~~~ {: .python} -![]({{ site.github.url }}/fig/grid-02.png) +![]({{ site.root }}/fig/grid-02.png) Simple color values like `(0,255,0)` are easy enough to decipher with a bit of practice, but what color is `(214,90,127)`? @@ -323,7 +323,7 @@ show_color(214, 90, 127) ~~~ {: .python} -![]({{ site.github.url }}/fig/ipythonblocks_show_color_example.png) +![]({{ site.root }}/fig/ipythonblocks_show_color_example.png) It also provides a table of standard colors: @@ -340,7 +340,7 @@ c.show() ~~~ {: .python} -![]({{ site.github.url }}/fig/grid-03.png) +![]({{ site.root }}/fig/grid-03.png) > ## Making a Colorbar > diff --git a/_includes/all_figures.html b/_includes/all_figures.html index 231c81344..be0ee39b7 100644 --- a/_includes/all_figures.html +++ b/_includes/all_figures.html @@ -1,35 +1,35 @@ -

Variables as Sticky Notes

+

Variables as Sticky Notes


-

Creating Another Variable

+

Creating Another Variable


-

Updating a Variable

+

Updating a Variable


-

Operations Across Axes

+

Operations Across Axes


-

Heatmap of the Data

+

Heatmap of the Data


-

Average Inflammation Over Time

+

Average Inflammation Over Time


-

Maximum Value Along The First Axis

+

Maximum Value Along The First Axis


-

Minimum Value Along The First Axis

+

Minimum Value Along The First Axis


-

The Previous Plots as Subplots

+

The Previous Plots as Subplots


-

Analysis of inflammation-01.csv

+

Analysis of inflammation-01.csv


-

loop_image

+

loop_image


-

The first element of a list. Adapted from @hadleywickham's tweet about R lists.

+

The first element of a list. Adapted from @hadleywickham's tweet about R lists.


-

Analysis of inflammation-01.csv

+

Analysis of inflammation-01.csv


-

Analysis of inflammation-02.csv

+

Analysis of inflammation-02.csv


-

Analysis of inflammation-03.csv

+

Analysis of inflammation-03.csv


-

Executing a Conditional

+

Executing a Conditional


-

The Blueprint for a Python Function

+

The Blueprint for a Python Function


-

Overlapping Ranges

+

Overlapping Ranges