Skip to content

Add chapter on floating point data#12

Open
LiamPattinson wants to merge 3 commits intomainfrom
floating_point
Open

Add chapter on floating point data#12
LiamPattinson wants to merge 3 commits intomainfrom
floating_point

Conversation

@LiamPattinson
Copy link
Collaborator

@LiamPattinson LiamPattinson commented Feb 14, 2026

Resolves #7
Resolves #9

Changes data structures chapter to one about handling floating point numbers.

  • Introduces absolute/relative tolerances
  • Mentions the built-in math.isclose, then goes straight to NumPy routines (skips np.isclose for simplicity)
  • Adds a callout stating that direct equality checks are a bad idea in an earlier chapter
  • Adds $\pi$ estimation routine as an example.
  • Removes all content on comparing lists/dicts. Could add this earlier in the course, but I don't think it needs to be a focus, especially given the numpy routines can be used for lists.
  • Strips all pandas material for simplicity, replaces it with a simple callout so interested people know it exists.

Additionally includes some edits to the setup doc.

@github-actions
Copy link

github-actions bot commented Feb 14, 2026

Thank you!

Thank you for your pull request 😃

🤖 This automated message can help you check the rendered files in your submission for clarity. If you have any questions, please feel free to open an issue in {sandpaper}.

If you have files that automatically render output (e.g. R Markdown), then you should check for the following:

  • 🎯 correct output
  • 🖼️ correct figures
  • ❓ new warnings
  • ‼️ new errors

Rendered Changes

🔍 Inspect the changes: https://github.com/ResearchCodingClub/python-testing-for-research/compare/md-outputs..md-outputs-PR-12

The following changes were observed in the rendered markdown documents:

 04-unit-tests-best-practices.md                    |  70 +--
 06-floating-point-data.md (new)                    | 282 ++++++++++++
 06-testing-data-structures.md (gone)               | 471 ---------------------
 .../advanced/advanced_calculator.py (new)          |   6 +
 .../advanced/test_advanced_calculator.py (new)     |   7 +
 files/06-floating-point-data/calculator.py (new)   |  15 +
 files/06-floating-point-data/estimate_pi.py (new)  |  10 +
 files/06-floating-point-data/scripts.py (new)      |  21 +
 .../statistics/stats.py (new)                      |  34 ++
 .../statistics/test_stats.py (new)                 |  82 ++++
 .../test_calculator.py (new)                       |  29 ++
 .../test_estimate_pi.py (new)                      |  15 +
 .../test_floating_point.py (new)                   |  12 +
 files/06-floating-point-data/test_numpy.py (new)   |  27 ++
 files/07-fixtures/statistics/stats.py              | 104 -----
 files/07-fixtures/statistics/test_stats.py         |  54 ---
 files/07-fixtures/test_numpy.py (new)              |  27 ++
 files/08-parametrization/statistics/stats.py       | 104 -----
 files/08-parametrization/statistics/test_stats.py  |  54 ---
 files/08-parametrization/test_numpy.py (new)       |  27 ++
 files/09-testing-output-files/statistics/stats.py  | 104 -----
 .../statistics/test_stats.py                       |  55 ---
 files/09-testing-output-files/test_numpy.py (new)  |  27 ++
 md5sum.txt                                         |  42 +-
 setup.md                                           |  43 +-
 25 files changed, 713 insertions(+), 1009 deletions(-)
What does this mean?

If you have source files that require output and figures to be generated (e.g. R Markdown), then it is important to make sure the generated figures and output are reproducible.

This output provides a way for you to inspect the output in a diff-friendly manner so that it's easy to see the changes that occur due to new software versions or randomisation.

⏱️ Updated at 2026-02-14 13:51:43 +0000

github-actions bot pushed a commit that referenced this pull request Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flag that direct comparisons to floating point numbers is bad Replace data structures lesson with floating point comparisons

1 participant