feat(uncertainty): outdir opt-in for get.parameter.samples wrapper (Modularity Part 3)#4016
Conversation
|
One note on the description: it says the wrapper “previously returned If you meant “it still returns invisibly (not Also currently there is another |
Replace the save_to_disk flag from PecanProject#3860 with an outdir parameter (default settings$outdir): samples.Rdata is saved when outdir is non-NULL and skipped when outdir = NULL. Existing callers keep writing to settings$outdir unchanged. The wrapper stays deprecated, delegates to get_parameter_samples(), and now returns the result list invisibly instead of NULL. Adds wrapper-level tests for outdir behaviour, the 5-object samples.Rdata contract, invisible return, and delegation.
005e21c to
23ca6c0
Compare
|
thanks @S1DDHEY. |
6aec657
Third PR in the trait → meta-analysis → parameter-sampling modularity series (after #3860 Part 1, #4010 Part 2). Cleans up the
get.parameter.samples()wrapper now that the pureget_parameter_samples()from #3860 does the computation.What changed
save_to_diskflag (added in feat: extract pure parameter sampling logic + tests (Modularity Part 1) #3860) with anoutdirparameter, defaultsettings$outdir.samples.Rdatais written whenoutdiris non-NULL (the default) and skipped whenoutdir = NULL. This matches theoutdir-as-opt-in-provenance convention used across the rest of the refactor..Deprecatedand still delegates toget_parameter_samples(). The return value is unchanged from develop — it returns the samples list invisibly (the switch frominvisible(NULL)to the list landed in feat: extract pure parameter sampling logic + tests (Modularity Part 1) #3860); this PR just adds a test that locks that contract in.Backward compatibility
No behavior change for existing callers — none of them pass the new argument, so
outdirdefaults tosettings$outdirandsamples.Rdatais written exactly as before. The only removal issave_to_disk: grepped the repo, it appears only insideget.parameter.samples.Rand nothing passes it, so dropping it is safe (it was never in a release).Per the Slack discussion with @mdietze and @infotroph: nothing changes for disk-writing workflows in this PR. The
ensemble.samples.*.Rdata/sensitivity.samples.*.Rdatafiles that workflows like the SIPNET segmented restart (#3919 / #4008) rely on are written byrun.write.configs(), which this PR does not touch, andsamples.Rdatastill writes by default. Migrating thegenerate_*_design()and SDA callers to the dash function is deferred to Phase 2/3.Tests
Adds
test-get.parameter.samples.Rin the correct package path (modules/uncertainty/): default save tosettings$outdir, explicitoutdiroverride,outdir = NULLskip, the 5-objectsamples.Rdataname contract, invisible return, and delegation toget_parameter_samples().load.posteriors()andget_parameter_samples()are stubbed withmockery, so it runs with no database. Local run for this file:[ FAIL 0 | SKIP 0 | PASS 10 ].Also relocates the misplaced
test-get.parameter.samples.Rundermodules/meta.analysis/tests/testthat/(added in #3858): renamed totest-p.point.in.prior.Rsince its remaining tests cover thePEcAn.MAhelperp.point.in.prior(), and dropped the obsoleteget.parameter.samplesskip-test (stale since #3860, superseded by the test added here).