Skip to content

fix: Life wrap, raster Fire neighborhood and SolidDiffusion - #21

Merged
profsergiocosta merged 1 commit into
mainfrom
fix/terrame-goldens
Oct 22, 2026
Merged

profsergiocosta merged 1 commit into
mainfrom
fix/terrame-goldens

Conversation

@profsergiocosta

Copy link
Copy Markdown
Member

Compared with TerraME 2.0.1 runs of the ca package (terrame-goldens v0.1.0), three models differed:

  • GameOfLife (vector and raster) did not wrap around the edges; TerraME's Life uses createNeighborhood{wrap = true}. New wrap parameter, default True.
  • FireModelRaster passed no neighborhood to focal_sum_mask, which counts the eight Moore neighbors, so the fire spread diagonally; it now uses self.dirs (Von Neumann), as TerraME and the vector version.
  • SolidDiffusion drew only among atoms and could move a vacancy several times per step. It now follows TerraME: each vacancy draws one of all its neighbors, reads the state at the start of the step and moves at most once; cells in TerraME's order, on NumPy arrays.

With these fixes, the 14 deterministic cases match TerraME cell by cell at every step, and SolidDiffusion mixes as in TerraME (26.5 vs 27 atoms past the middle column at t = 400; 35.9 before).

tests/test_goldens.py (marker golden) runs the comparisons from an extract of the goldens in tests/goldens (with SHA-256 provenance and the script that makes it): grids cell by cell, ensembles by Kolmogorov-Smirnov and mean tests. About a minute by default; DISSMODEL_GOLDEN_FULL=1 for every step and the slow ensembles.

 as in TerraME; tests against TerraME runs

Compared with TerraME 2.0.1 runs of the ca package (terrame-goldens v0.1.0),
three models differed:

- GameOfLife (vector and raster) did not wrap around the edges; TerraME's
  Life uses createNeighborhood{wrap = true}. New wrap parameter, default
  True.
- FireModelRaster passed no neighborhood to focal_sum_mask, which counts
  the eight Moore neighbors, so the fire spread diagonally; it now uses
  self.dirs (Von Neumann), as TerraME and the vector version.
- SolidDiffusion drew only among atoms and could move a vacancy several
  times per step. It now follows TerraME: each vacancy draws one of all its
  neighbors, reads the state at the start of the step and moves at most
  once; cells in TerraME's order, on NumPy arrays.

With these fixes, the 14 deterministic cases match TerraME cell by cell at
every step, and SolidDiffusion mixes as in TerraME (26.5 vs 27 atoms past
the middle column at t = 400; 35.9 before).

tests/test_goldens.py (marker golden) runs the comparisons from an extract
of the goldens in tests/goldens (with SHA-256 provenance and the script
that makes it): grids cell by cell, ensembles by Kolmogorov-Smirnov and
mean tests. About a minute by default; DISSMODEL_GOLDEN_FULL=1 for every
step and the slow ensembles.
@profsergiocosta
profsergiocosta merged commit 2d794cb into main Oct 22, 2026
2 checks passed
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.

1 participant