Skip to content

Commit a638123

Browse files
committed
differences for PR #362
1 parent 830f8e6 commit a638123

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

07-thresholding.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ print("Found automatic threshold t = {}.".format(t))
383383
```
384384

385385
```output
386-
Found automatic threshold t = 0.4172454549881862.
386+
Found automatic threshold t = 0.4116003928683858.
387387
```
388388

389389
For this root image and a Gaussian blur with the chosen sigma of 1.0,
@@ -512,7 +512,7 @@ measure_root_mass(filename="data/trial-016.jpg", sigma=1.5)
512512
```
513513

514514
```output
515-
0.0482436835106383`
515+
0.04907247340425532
516516
```
517517

518518
Now we can use the function to process the series of four images shown above.
@@ -525,20 +525,28 @@ and the filenames all start with the **trial-** prefix and
525525
end with the **.jpg** suffix.
526526

527527
```python
528-
all_files = glob.glob("data/trial-*.jpg")
528+
all_files = sorted(glob.glob("data/trial-*.jpg"))
529529
for filename in all_files:
530530
density = measure_root_mass(filename=filename, sigma=1.5)
531531
# output in format suitable for .csv
532532
print(filename, density, sep=",")
533533
```
534534

535535
```output
536-
data/trial-016.jpg,0.0482436835106383
537-
data/trial-020.jpg,0.06346941489361702
538-
data/trial-216.jpg,0.14073969414893617
539-
data/trial-293.jpg,0.13607895611702128
536+
data/trial-016.jpg,0.04907247340425532
537+
data/trial-020.jpg,0.06381366356382978
538+
data/trial-216.jpg,0.14205152925531914
539+
data/trial-293.jpg,0.13665791223404256
540540
```
541541

542+
::::::::::::::::::::::::::::::::::::::::: callout
543+
544+
Compare your results with the values above. Do they match exactly? You may find that certain decimal values differ slightly, even when using identical input parameters.
545+
546+
This variation often stems from the specific versions of your installed packages (such as `numpy` or `scikit-image`). As these libraries evolve, updates can introduce subtle changes in numerical handling, underlying algorithms, or rounding logic. This highlights why reproducible environments, as well as reproducible code, are essential for consistent scientific computing.
547+
548+
:::::::::::::::::::::::::::::::::::::::::
549+
542550
::::::::::::::::::::::::::::::::::::::: challenge
543551

544552
## Ignoring more of the images -- brainstorming (10 min)
@@ -650,7 +658,7 @@ def enhanced_root_mass(filename, sigma):
650658
return density
651659

652660

653-
all_files = glob.glob("data/trial-*.jpg")
661+
all_files = sorted(glob.glob("data/trial-*.jpg"))
654662
for filename in all_files:
655663
density = enhanced_root_mass(filename=filename, sigma=1.5)
656664
# output in format suitable for .csv
@@ -661,10 +669,10 @@ The output of the improved program does illustrate that the white circles
661669
and labels were skewing our root mass ratios:
662670

663671
```output
664-
data/trial-016.jpg,0.046250166223404256
665-
data/trial-020.jpg,0.05886968085106383
666-
data/trial-216.jpg,0.13712117686170214
667-
data/trial-293.jpg,0.13190342420212767
672+
data/trial-016.jpg,0.046261136968085106
673+
data/trial-020.jpg,0.05887167553191489
674+
data/trial-216.jpg,0.13712067819148935
675+
data/trial-293.jpg,0.1319044215425532
668676
```
669677
:::::::::::::::::::::::::::::::::::::::::: spoiler
670678

md5sum.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"episodes/04-drawing.md" "d8c686bdf8b610fe5b66a669e3685fb5" "site/built/04-drawing.md" "2026-03-20"
1010
"episodes/05-creating-histograms.md" "309e406d538ff298286dd52175ec0692" "site/built/05-creating-histograms.md" "2026-03-20"
1111
"episodes/06-blurring.md" "3046847c190dd567652bb7cd0538ecd9" "site/built/06-blurring.md" "2026-03-20"
12-
"episodes/07-thresholding.md" "03bd0cd048d3b1d98aa9a8770517edfc" "site/built/07-thresholding.md" "2026-03-20"
12+
"episodes/07-thresholding.md" "9e83494d74ce543a2a4d3bcce90f2e52" "site/built/07-thresholding.md" "2026-03-24"
1313
"episodes/08-connected-components.md" "d8f4a9616c448bd8b72d3877305b8201" "site/built/08-connected-components.md" "2026-03-20"
1414
"episodes/09-challenges.md" "7665ef69e61f7ea2184a58162c53aef2" "site/built/09-challenges.md" "2026-03-23"
1515
"instructors/instructor-notes.md" "e8e378a5dfaec7b2873d788be85003ce" "site/built/instructor-notes.md" "2024-06-18"

0 commit comments

Comments
 (0)