Skip to content

saveFitTables: write the ignition and escape fit tables to disk - #119

Merged
eliotmcintire merged 1 commit into
developmentfrom
saveFitTables
Nov 28, 2026
Merged

eliotmcintire merged 1 commit into
developmentfrom
saveFitTables

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

A run can now save the exact ignition and escape tables its fits are trained on. Analyses outside the fit, such as spatial random effects, can then read them. Until now the tables lived only in the event cache.

Affects: nothing by default. With saveFitTables set, a run also writes one file per table to its output folder.

Technical details

Defect: prepIgnitionFitData and prepEscapeFitData (fireSense_dataPrepFit.R, prepare_IgnitionFit, prepare_EscapeFit) leave fireSense_ignitionCovariates and fireSense_escapeCovariates only in the simList and the event cache; nothing writes them.

Fix: new parameter saveFitTables (character, default character(0); "ignition", "escape"). A new event saveFitTables (R/saveFitTables.R, scheduled at priority 2 after the prep events at priority 1) writes <table>_<ELF>.qs2 to outputPath(sim) and registers each file. It only reads the tables from the simList, so a cache hit of prepIgnitionFitData still writes them. Cache keys do not change: the parameter has cacheKey = FALSE, and the event is in .neverCache (default now c("init", "saveFitTables")) because a cache hit would skip the write. A requested table the run did not build (skipUnusedFitPrep) gives a message, not an error.

Reuses: SpaDES.core::registerOutputs(), SpaDES.core::outputPath(), defineParameter(cacheKey = FALSE), .neverCache, qs2 (already in reqdPkgs), the scheduleEvent pattern of init; new: saveFitTables() and saveFitTablesEvents() (nothing in the module writes fit tables or registers outputs).

Tests: new test-saveFitTables.R (19 expectations: files appear and round-trip equal to the simList table, default writes nothing, only requested tables, tables unchanged, missing table skipped, unknown name refused, event never cached and scheduled after prep). test-metadata.R and test-neverCache.R list the new parameter and default. New test file on base: 4 failures, 5 errors, 1 pass (function absent). Full suite (convertToPackage() + test_local(), scratch library, BLAS/OMP threads 1): branch 0 failures, 0 errors, 677 pass, 1 skip; base 0 failures, 0 errors, 656 pass, 1 skip.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh

@eliotmcintire eliotmcintire added the enhancement New feature or request label Nov 28, 2026
@eliotmcintire
eliotmcintire merged commit 6ec225d into development Nov 28, 2026
9 checks passed
@eliotmcintire
eliotmcintire deleted the saveFitTables branch November 28, 2026 04:49
eliotmcintire added a commit that referenced this pull request Nov 28, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant