Repository navigation
Bug fixes - #1
Open
seananderson wants to merge 7 commits into
Open
seananderson wants to merge 7 commits into
seananderson wants to merge 7 commits into
Conversation
…n CI
Refits in sdmTMB_retro(), compare_meshes(), sdmTMB_mesh_cv() and
compare_surveys() rebuilt the sdmTMB() call from a few fields, silently
dropping spatial_varying, time_varying, extra_time, weights, priors,
share_range, anisotropy, reml, etc. (and the offset in sdmTMB_mesh_cv()).
They now refit from object$call via new internal .refit_args()/.refit()
helpers, evaluating arguments on the main process so they reach future
workers and subsetting numeric offset/weights to the retained rows.
Also:
- Use object$spde$xy_cols instead of hard-coded X/Y; add xy_cols to
compare_surveys().
- Stop build-ignoring tests/ and vignettes/ and set NOT_CRAN on CI so
R CMD check actually runs them; add refit-reproduces-original-fit tests.
- Move ggOceanMaps to Suggests with a plain-map fallback; drop plyr,
magrittr (and the %>% re-export) and viridis.
- sdmTMB_retro(): require `cutoff` when refit_meshes = TRUE; default
n_workers = 1. Respect the user's future::plan() when n_workers = 1 and
restore future.globals.maxSize on exit.
- Report actual fit errors and flag fits failing sanity().
- Untrack memory/, CLAUDE.md, AGENTS.md and docs/ (pkgdown deploys to
gh-pages); start a development NEWS section.
- Keep the sanity table's shape when a survey model fails to fit - Always draw the reference model in black; no NA colours for many series - Keep non-integer mesh cutoffs; handle a failed reference refit - Subset a numeric `area` vector with the prediction grid - Support time columns not named `year` (index output always uses `year`) - Add `coord_multiplier` to the comparison functions and spatial maps - sdmTMB_mesh_cv(): default xy_cols from the mesh; catch an NA CRS - Keep barrier meshes in retro peels; warn when new meshes drop them - plot_variance_partitioning(): only use link-scale SDs - Relabel the terminal-year difference in model/mesh comparison plots - plot_prediction_histogram(): put offset models on the density scale - Pass sdmTMB_retro(predict_args) to get_index_split(); keep peel order - Use `transform` instead of the deprecated ggplot2 `trans` argument Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Combine upstream model-selection functions and plot_mesh options with the refit/xy_cols fixes. Keep AGENTS.md, CLAUDE.md and memory/ deleted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
All three are already listed in .Rbuildignore. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- sdmTMB_selection(): restore the future plan with .restore_parallel(); passing the .setup_parallel() list to future::plan() corrupted the plan and broke later parallel calls. - test-refit: compare against get_index_split(bias_correct = FALSE), matching the function defaults. - NEWS: number the development section so R CMD check can parse it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for working on this package! This PR was Claude assisted. Summary below:
This branch fixes several places where the comparison and retrospective functions silently changed the model they were meant to reproduce. It also makes the helpers independent of the
X/Ycolumn names and of an attached ggOceanMaps, and turns on tests and the vignette inR CMD check. It is merged up to currentmain(0.1.3), so it includes the model-selection functions.Main fixes
sdmTMB_retro(),compare_meshes(),sdmTMB_mesh_cv()andcompare_surveys()(withcompiled_model) now refit from the originalsdmTMB()call, asupdate.sdmTMB()does. Before, settings such asspatial_varying,time_varying,extra_time,weights,priors,share_range,anisotropyandremlwere dropped.sdmTMB_mesh_cv()also dropped the offset. The call's arguments are evaluated on the main process so they reach parallel workers.object$spde$xy_cols.compare_surveys()gainsxy_cols, and the comparison functions gaincoord_multiplier. Time columns not namedyearnow work.NAcolours with more than seven series.predict_argsnow reachesget_index_split().plot_variance_partitioning()only uses link-scale SDs.areavector can be subset per row.sanity()are flagged.sdmTMB_selection()passed the list returned by.setup_parallel()tofuture::plan(), which corrupted the plan for later parallel calls. It now uses.restore_parallel().Breaking changes
sdmTMB_retro(refit_meshes = TRUE)now requirescutoff.sdmTMB_retro()'sn_workersdefaults to1(wasnyears). Withn_workers = 1the user's currentfuture::plan()is used.%>%re-export is removed.Dependencies and data
plyr,magrittrandviridisare dropped.sebastes_bathydataset andsebastes_depth()let examples, the vignette and tests avoid the ~85 MB bathymetry download.CI and tests
tests/andvignettes/are no longer build-ignored, so CI runs the tests and builds the vignette.test-refit.Rchecks that refits reproduce the original fit and index.devtools::check()gives 0 errors, 0 warnings and 0 notes locally.