-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Help Charlene to test her package (#25) (remember to commit after each step, if appropriate).
-
Choose who in your team is writing now! (make sure you've pulled the latest changes from your team's fork.)
-
Create a
tests
directory insidesagittal_average
so it looks likeDesktop/ # if you cloned it there └── sagittal_average/ ├── .git/ ├── pyproject.toml ├── sagittal_average/ └── tests/
-
Add a test to avoid the confusion between rows and columns
TEST_DIR = Path(__file__).parent def test_average(): # Creates input file data_input = np.zeros((20, 20)) data_input[-1, :] = 1 # The expeted result is all zeros, except the last one, it should be 1 expected = np.zeros(20) expected[-1] = 1 np.savetxt(TEST_DIR / "brain_sample.csv", data_input, fmt='%d', delimiter=',') # run python program run_averages(file_input=TEST_DIR / "brain_sample.csv", file_output=TEST_DIR / "brain_average.csv") # Check result result = np.loadtxt(TEST_DIR / "brain_average.csv", delimiter=',') np.testing.assert_array_equal(result, expected)
-
Fix
sagittal_brain.py
(the code wrongly averages over the columns, not the rows), make sure the test passes and commit these changes. -
Try to install it by running
pip install -e .
where thepyproject.toml
is, and then run the tests withpytest
. -
Share your solution as a pull request to Charlene's repository mentioning this issue (by including the text
Addresses UCL-ARC-RSEworkshop-summer-25/RSE-Classwork#26
in the pull request description), remember to mention your team members too! (with@github_username
)