Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions episodes/07-thresholding.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ measure_root_mass(filename="data/trial-016.jpg", sigma=1.5)
```

```output
0.0482436835106383`
0.04907247340425532
```

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

```python
all_files = glob.glob("data/trial-*.jpg")
all_files = sorted(glob.glob("data/trial-*.jpg"))
for filename in all_files:
density = measure_root_mass(filename=filename, sigma=1.5)
# output in format suitable for .csv
print(filename, density, sep=",")
```

```output
data/trial-016.jpg,0.0482436835106383
data/trial-020.jpg,0.06346941489361702
data/trial-216.jpg,0.14073969414893617
data/trial-293.jpg,0.13607895611702128
data/trial-016.jpg,0.04907247340425532
data/trial-020.jpg,0.06381366356382978
data/trial-216.jpg,0.14205152925531914
data/trial-293.jpg,0.13665791223404256
```

::::::::::::::::::::::::::::::::::::::::: callout

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.

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.

:::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::: challenge

## Ignoring more of the images -- brainstorming (10 min)
Expand Down
Loading