Adaptive grid on by default; finer auto cell size under it

ADAPTIVE_CELLS defaults to True (dialog checkbox stays; untick or
--no-adaptive for the uniform reference grid). With the adaptive grid
the auto cell sizer targets TARGET_CELLS_ADAPTIVE (8M fine cells,
~2x finer h) since unknowns no longer scale with the fine cell count -
memory of the masks/field arrays is the new bound.

The test suite pins ADAPTIVE_CELLS off via an autouse conftest fixture:
the exact-value tests define the uniform reference grid; adaptive tests
opt in per test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
janik
2026-07-15 17:57:12 +07:00
parent a2a8a9d702
commit 07ab59baad
7 changed files with 56 additions and 16 deletions
+5 -1
View File
@@ -97,7 +97,11 @@ def choose_cell_size(bbox_nm: tuple[int, int, int, int], nlayers: int) -> float:
)
h = config.CELL_UM_OVERRIDE * 1000.0
else:
h = math.sqrt(w * ht * nlayers / config.TARGET_CELLS)
# the adaptive grid decouples unknowns from the fine cell count,
# so its auto sizing affords a larger fine-cell budget (finer h)
target = (config.TARGET_CELLS_ADAPTIVE if config.ADAPTIVE_CELLS
else config.TARGET_CELLS)
h = math.sqrt(w * ht * nlayers / target)
h = min(max(h, config.MIN_CELL_UM * 1000.0), config.MAX_CELL_UM * 1000.0)
ncells = math.ceil(w / h) * math.ceil(ht / h) * nlayers