You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: episodes/01-introduction.md
+13-14Lines changed: 13 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Course introduction"
2
+
title: "Course Introduction"
3
3
teaching: 10
4
4
exercises: 10
5
5
---
@@ -34,21 +34,20 @@ That is, enabling others to run our code and obtain the same results we did.
34
34
## Why should I care about reproducibility?
35
35
36
36
Scientific transparency and rigor are key factors in research.
37
-
Scientific methodology and results need to be published openly and replicated and confirmed by several independent parties.
38
-
However, research papers often lack the full details required for independent reproduction or replication.
39
-
Many attempts at reproducing or replicating the results of scientific studies have failed in a variety of disciplines ranging from psychology ([The Open Science Collaboration (2015)][replication-crisis-osc]) to cancer sciences ([Errington et al (2021)][replication-crisis-errington]).
40
-
These are called [**the reproducibility and replicability crises**][reproducibility-crisis] - ongoing methodological crises in which the results of many scientific studies are difficult or impossible to repeat.
37
+
Scientific methodology and results need to be published openly, replicated and confirmed by several independent parties.
38
+
However, research papers often lack the full details required for independent reproduction (reaching the same results with the same data) or replication (reaching the same results with new data).
39
+
Across many disciplines, the failure of attempts to reproduce or replicate scientific conclusions have resulted in [**reproducibility and replicability crises**][reproducibility-crisis], leading to reduced confidence in the scientific conclusions of fields as diverse as psychology ([The Open Science Collaboration (2015)][replication-crisis-osc]) and cancer sciences ([Errington et al (2021)][replication-crisis-errington]).
41
40
42
41
Reproducible research is a practice that ensures that researchers can repeat the same analysis multiple times with the same results.
43
42
It offers many benefits to those who practice it:
44
43
45
-
* Reproducible research helps researchers remember how and why they performed specific tasks and analyses; this enables easier explanation of work to collaborators and reviewers.
46
-
* Reproducible research enables researchers to quickly modify analyses and figures - this is often required at all stages of research and automating this process saves loads of time.
47
-
* Reproducible research enables reusability of previously conducted tasks so that new projects that require the same or similar tasks become much easier and efficient by reusing or reconfiguring previous work.
48
-
* Reproducible research supports researchers' career development by facilitating the reuse and citation of all research outputs - including both code and data.
44
+
* Reproducible research helps researchers remember how and why they performed specific tasks and analyses; this makes work easier to explain to collaborators and reviewers.
45
+
* Reproducible research enables researchers to quickly modify analyses and figures, saving time and effort when datasets or methods change.
46
+
* Reproducible research is reusable; tasks can be recycled or reconfigured in future work.
47
+
* Reproducible research supports researchers' career development by facilitating the citation of all research outputs, including both code and data.
49
48
* Reproducible research is a strong indicator of rigor, trustworthiness, and transparency in scientific research.
50
49
This can increase the quality and speed of peer review, because reviewers can directly access the analytical process described in a manuscript.
51
-
It increases the probability that errors are caught early on - by collaborators or during the peer-review process, helping alleviate the reproducibility crisis.
50
+
It increases the probability that errors are caught early on, by collaborators or during the peer-review process, helping alleviate the reproducibility crisis.
52
51
53
52
However, reproducible research often requires that researchers implement new practices and learn new tools.
54
53
This course aims to teach some of these practices and tools pertaining to the use of software to conduct reproducible research.
@@ -57,7 +56,7 @@ Review [the Reproducible Research Discussion](./reproducible-research-discussion
57
56
58
57
::::::::::::::::::::::::::::::
59
58
60
-
## Practices for building better research software
59
+
## Practices for Building Better Research Software
61
60
62
61
The practices we will cover for building better research software fall into three areas.
63
62
@@ -92,7 +91,7 @@ Write your reflections in the shared collaborative document.
92
91
93
92
::::::::::::::::::
94
93
95
-
## Our research software project
94
+
## Our Research Software Project
96
95
97
96
You are going to follow a fairly typical experience of a new researcher (e.g. a PhD student or a postdoc) joining a research group.
98
97
You were emailed some spacewalks data and analysis code bundled in the `spacewalks.zip` archive, written by another group
@@ -245,7 +244,7 @@ So, we cannot even run the code on our machines.
245
244
There is also a number of issues we identified with the software project that could do with improving.
246
245
For the rest of this course, we will work on fixing these issues and applying some good software engineering practices.
247
246
248
-
## Further reading
247
+
## Further Reading
249
248
250
249
We recommend the following resources for some additional reading on reproducible research:
251
250
@@ -259,6 +258,6 @@ We recommend the following resources for some additional reading on reproducible
259
258
*[Training materials on different aspects of research software engineering][intersect-rse-training] (including open source, reproducibility, research software testing, engineering, design, continuous integration, collaboration, version control, packaging, etc.), compiled by the [INTERSECT project](https://intersect-training.org/)
260
259
*[Curated resources][forrt-resources] by the [Framework for Open and Reproducible Research Training](https://forrt.org/) (FORRT)
261
260
262
-
## Acknowledgements and references
261
+
## Acknowledgements and References
263
262
264
263
The content of this course borrows from or references [various work](learners/reference.md#litref), especially the [original version of this course with python examples][bbrs-py].
Copy file name to clipboardExpand all lines: episodes/02-better-start-version-control.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Better start with a software project
2
+
title: Better Start With a Software Project
3
3
teaching: 30
4
4
exercises: 30
5
5
---
@@ -32,7 +32,7 @@ produces can be trusted and others can build upon it with confidence.
32
32
Let's begin by creating a new software project from our existing code,
33
33
and start tracking changes to it with version control.
34
34
35
-
## From script to software project
35
+
## From Script to Software Project
36
36
37
37
In the previous episode you have unzipped `spacewalks.zip` into a directory `spacewalks` in your home directory.
38
38
@@ -70,7 +70,7 @@ Over the rest of the course, we will transform a collection of these files into
70
70
The first thing you may notice that our software project contains folder `astronaut-data-analysis-old` which presumably tries to keep track of older versions of the code. There is a better way to do that using version control tool, such as Git, and we can delete this folder but will wait until after we set up our version control with git.
71
71
This way we can keep that version in our history and can delete it so it isn't currently in our folder.
72
72
73
-
## Version control
73
+
## Version Control
74
74
75
75
Before we do any further changes to our software, we want to make sure we can keep a history of what changes we have done since we inherited the code from our colleague.
76
76
@@ -729,7 +729,7 @@ On branch main
729
729
nothing to commit, working tree clean
730
730
```
731
731
732
-
## Interacting with a remote Git server
732
+
## Interacting With a Remote Git Server
733
733
734
734
Git is distributed version control system and lets us synchronise work between multiple copies of the same repository -
735
735
which may not be on your machine (called **remote repositories**).
@@ -830,7 +830,7 @@ This command tells Git to update the "main" branch on the "origin" remote.
830
830
The `-u` flag (short for `--set-upstream`) sets the 'tracking reference' for the current branch,
831
831
so that in future `git push` will default to sending to `origin main`.
832
832
833
-
## Software project in GitHub
833
+
## Software Project in GitHub
834
834
835
835
We now have our software project in GitHub and have linked it to our local working copy.
836
836
We are ready to start more work on software development and publishing and backing up that work on GitHub.
@@ -903,7 +903,7 @@ At this point, the code in your local software project's directory should be as
903
903
904
904
:::
905
905
906
-
## Further reading
906
+
## Further Reading
907
907
908
908
We recommend the following resources for some additional reading on the topic of this episode:
Copy file name to clipboardExpand all lines: episodes/03-reproducible-dev-environment.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Reproducible software environments
2
+
title: Reproducible Software Environments
3
3
teaching: 30
4
4
exercises: 0
5
5
---
@@ -59,7 +59,7 @@ If you run into problems not mentioned here, please open an [issue in the lesson
59
59
60
60
::::::::::::::::::::::::::::::::::::::::::::::::
61
61
62
-
## Software dependencies
62
+
## Software Dependencies
63
63
64
64
If we have a look at our script, we may notice a few library calls such as `library("tidyverse")` throughout the code.
65
65
@@ -74,7 +74,7 @@ As a result, each R project you work on may require a different setup and set of
74
74
To prevent conflicts and maintain reproducibility across projects, it’s helpful to keep these configurations isolated.
75
75
The typical solution is to create a project-specific environment using tools like {renv}, which maintains its own library of packages and records exact versions in a lockfile—ensuring that the project always runs with the same package set it was developed with.
76
76
77
-
## What are virtual software environments?
77
+
## What Are Virtual Software Environments?
78
78
79
79
So what exactly are virtual software environments, and why use them?
80
80
@@ -119,7 +119,7 @@ We should not let the difficulty of attaining "perfect" reproducibility prevent
119
119
120
120
::::::::::::::::::::::::::::::
121
121
122
-
## Managing virtual environments R-style
122
+
## Managing Virtual Environments R-Style
123
123
124
124
Instantiating virtual environments in R is multi-step, multi-tool process.
125
125
@@ -375,7 +375,7 @@ Furthermore, your expertise will develop as you get more practice with managing
375
375
376
376
::::::::::::::::::::::::::::::
377
377
378
-
## Running the code and reproducing results
378
+
## Running the Code and Reproducing Results
379
379
380
380
We are now setup to run our code from the newly created R project
381
381
@@ -452,7 +452,7 @@ At this point, the code in your local software project's directory should be as
452
452
453
453
::::::
454
454
455
-
## Further reading
455
+
## Further Reading
456
456
457
457
We recommend the following resources for some additional reading on the topic of this episode:
Copy file name to clipboardExpand all lines: episodes/04-code-readability.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Code readability
2
+
title: Code Readability
3
3
teaching: 60
4
4
exercises: 30
5
5
---
@@ -62,7 +62,7 @@ renv::restore()
62
62
63
63
:::
64
64
65
-
## Place `library`functions at the top
65
+
## Place `library`Functions at the Top
66
66
67
67
Let’s look at our code again. One thing that stands out is that we’re calling library() in multiple places throughout the script. By convention, all libraries should be loaded at the top so dependencies are easy to see and not buried in the code. This improves readability and makes the code easier to reuse and maintain.
68
68
@@ -152,7 +152,7 @@ Let's make sure we commit our changes.
152
152
$ git add eva_data_analysis.R
153
153
$ git commit -m "Move library calls to the top of the script"
154
154
```
155
-
## Rules for variable names in R
155
+
## Rules for Variable Names in R
156
156
157
157
$ git add eva_data_analysis.R
158
158
$ git commit -m "Move library calls to the top of the script"
@@ -318,7 +318,7 @@ As we have now updated all the variable names to be more descriptive, we can now
318
318
To do so, we open our repository in GitHub, switch to the Issues tab, find the issue to "improve variable names" we created earlier.
319
319
There are more automated ways to close issues based on a commit/pull request that we will learn later, for now we will click the "Close issue" button at the bottom of the discussion.
320
320
321
-
## Remove unused variables and imports
321
+
## Remove Unused Variables and Imports
322
322
323
323
Unused variables or import statements can cause confusion about what the code is doing, making it harder to read and easier to introduce mistakes. Such things may seem harmless as they do not cause immediate syntax errors - but they can potentially lead to subtle program logic errors, unexpected behavior, wrong results and issues later on making them especially tricky to detect and fix. Over time, this makes the codebase more fragile and harder to maintain and extend.
324
324
@@ -437,7 +437,7 @@ The IDE understands the underlying structure of the code, which makes these comp
437
437
438
438
439
439
440
-
## Use existing packages from known developers
440
+
## Use Existing Packages From Known Developers
441
441
442
442
Our script currently reads the data line-by-line from the JSON data file and uses custom code to manipulate the data. Variables of interest are stored in lists but there are more suitable data structures (e.g. dataframes or tibbles) to store data in our case.
443
443
@@ -520,7 +520,7 @@ print(p)
520
520
521
521
We have committed the code and the environment changes together since they are related and form one logical unit of change.
522
522
523
-
## Use comments to explain functionality
523
+
## Use Comments to Explain Functionality
524
524
525
525
Commenting is a very useful practice to help convey the context of the code. It can be helpful as a reminder for your future self or your collaborators as to why code is written in a certain way, how it is achieving a specific task, or the real-world implications of your code.
526
526
@@ -655,7 +655,7 @@ Commit changes:
655
655
$ git push origin main
656
656
```
657
657
658
-
## Separate units of functionality
658
+
## Separate Units of Functionality
659
659
660
660
Functions are a fundamental concept in writing software and are one of the core ways you can organize your code to improve its readability. A function is an isolated section of code that performs a single, *specific* task that can be simple or complex.
Now that we’ve written a few functions, it’s time to document them so we can quickly remember what they do. That way, someone reading this code later can understand the intent without having to reverse-engineer the implementation.
854
854
@@ -1171,7 +1171,7 @@ At this point, the code in your local software project's directory should be as
1171
1171
1172
1172
:::
1173
1173
1174
-
## Further reading
1174
+
## Further Reading
1175
1175
1176
1176
We recommend the following resources for some additional reading on the topic of this episode:
Copy file name to clipboardExpand all lines: episodes/05-code-structure.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Code structure
2
+
title: Code Structure
3
3
teaching: 60
4
4
exercises: 30
5
5
---
@@ -52,7 +52,7 @@ $ source venv_spacewalks/Scripts/activate # Windows
52
52
53
53
:::
54
54
55
-
## Functions for modular and reusable code
55
+
## Functions for Modular and Reusable Code
56
56
57
57
As we have already seen in the previous episode - functions play a key role in creating modular and reusable code.
58
58
After extracting units of functionality into separate functions, the main part of our code became much simpler and more readable, only containing the invocation of the following three functions:
@@ -211,7 +211,7 @@ print("--END--")
211
211
212
212
Even though our code became a bit longer than previously, it is more readable and new functions we added can potentially be reused elsewhere too.
213
213
214
-
## Creating a main function
214
+
## Creating a Main Function
215
215
216
216
Now we also want to move the main functionality into a main function.
217
217
There is a common code structure (pattern) for writing a main function in Python:
@@ -405,7 +405,7 @@ if __name__ == "__main__":
405
405
main(input_file, output_file, graph_file)
406
406
```
407
407
408
-
## Command-line interface to code
408
+
## Command-Line Interface to Code
409
409
410
410
A common way to structure code is to have a command-line interface to allow the passing of various parameters.
411
411
For example, we can pass the input data file to be read and the output file
@@ -576,7 +576,7 @@ Remember to commit our changes.
576
576
(venv_spacewalks) $ git commit -m "Add command line functionality to script"
577
577
```
578
578
579
-
## Directory structure for software projects
579
+
## Directory Structure for Software Projects
580
580
581
581
Expanding on the code structure theme, following conventions on consistent and informative directory structure
582
582
for your projects will ensure people will immediately know where to find things within your project, especially helpful
@@ -823,7 +823,7 @@ At this point, the code in your local software project's directory should be as
823
823
824
824
::::::
825
825
826
-
## Further reading
826
+
## Further Reading
827
827
828
828
We recommend the following resources for some additional reading on the topic of this episode:
Copy file name to clipboardExpand all lines: episodes/06-code-correctness.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Code correctness & testing"
2
+
title: "Code Correctness & Testing"
3
3
teaching: 60
4
4
exercises: 30
5
5
---
@@ -55,7 +55,7 @@ $ source venv_spacewalks/Scripts/activate # Windows
55
55
56
56
:::
57
57
58
-
## Why use software testing?
58
+
## Why Use Software Testing?
59
59
60
60
Including testing in our research workflow helps us to produce **better software** and conduct **better research**:
61
61
@@ -74,7 +74,7 @@ Including testing in our research workflow helps us to produce **better software
74
74
step-by-step approach that we can apply to verify that our code is
75
75
correct.
76
76
77
-
## Types of software tests
77
+
## Types of Software Tests
78
78
79
79
There are many different types of software tests, including:
80
80
@@ -125,7 +125,7 @@ Fill in the blanks in the sentences below:
125
125
:::
126
126
:::
127
127
128
-
## Informal testing
128
+
## Informal Testing
129
129
130
130
How should we test our code? One approach is to copy/paste the code or a function into a Python terminal - *different from a command line terminal* - which allows you to interact with the Python interpreter more directly.
131
131
From the Python terminal we can then run one function or a piece of code at a time and check that they behave as expected.
@@ -224,7 +224,7 @@ However, there are limitations to this approach:
224
224
:::
225
225
::::::
226
226
227
-
## Formal testing
227
+
## Formal Testing
228
228
229
229
We can overcome some of these limitations by formalising our testing process.
230
230
A formal approach to testing our code is to write dedicated test functions to check it.
@@ -397,7 +397,7 @@ To run our remaining tests we would have to manually comment out our failing tes
397
397
As our code base grows, testing in this way becomes cumbersome and error-prone.
398
398
These limitations can be overcome by automating our tests using a **testing framework**.
399
399
400
-
## Testing frameworks
400
+
## Testing Frameworks
401
401
402
402
Testing frameworks can automatically find all the tests in our code base, run all of them (so we do not have to invoke
403
403
them explicitly or, even worse, forget to invoke them), and present the test results as a readable summary.
@@ -644,7 +644,7 @@ As a result, running the function raises a `NameError` rather than returning a c
644
644
:::
645
645
:::
646
646
647
-
## Test suite design
647
+
## Test Suite Design
648
648
649
649
We now have the tools in place to automatically run tests.
650
650
However, that alone isnot enough to properly test code.
@@ -1187,7 +1187,7 @@ if __name__ == "__main__":
1187
1187
1188
1188
There is an [optional exercise](../learners/test-suite-exercise.md) to implement additional tests and practice writing tests some more.
1189
1189
1190
-
## Continuous Integration for automated testing
1190
+
## Continuous Integration for Automated Testing
1191
1191
1192
1192
Continuous Integration (CI) services provide the infrastructure to automatically run every test function in
1193
1193
the test code suite every time changes are pushed to a remote repository.
0 commit comments