Repository navigation
f3dasm v2.4.1
A bug-fix release for two samplers that gave different designs than requested. The grid sampler left out the upper bound of continuous parameters, and the Sobol sampler ignored its seed. No function signatures change, but both samplers now return different points than in 2.4.0; see Upgrading below.
Highlights
Fix: the grid sampler includes the upper bound (#360, closes #357)
A 2-level grid on [0, 1], i.e. the corners of the domain, could not be built for continuous parameters. Whether the upper bound appeared at all depended on floating-point rounding: [1, 1.3] with step 0.1 included 1.3, but [0, 1] with step 0.25 stopped at 0.75. Integer parameters already included their upper bound.
- Every continuous parameter's grid now runs from its lower bound to its upper bound.
stepsize_continuous_parameters=0.5on[0, 1]gives0, 0.5, 1. - A step that does not divide the range evenly is rounded to the nearest step that does, and a
UserWarningnames the step actually used. For example,0.3on[0, 1]becomes three steps of1/3. On an exact tie the smaller step wins. - A step of zero or less raises a
ValueError. Before, it gave an empty grid or aZeroDivisionError.
Behaviour change: grids gain one value per continuous parameter. For expensive simulations this means more runs.
Fix: the Sobol sampler uses its seed (#360, closes #358)
create_sampler("sobol_sampler", seed=0) and seed=123 returned the same points, so a "test" set drawn with another seed repeated the "training" set. The design was the raw, unscrambled sequence, starting at the lower corner and then the centre. Array parameters got rows of SALib's sensitivity-analysis design, which repeats coordinates across rows and so is not space-filling.
- Continuous and array parameters now come from one scrambled
scipy.stats.qmc.Sobolsequence, seeded withseed. Different seeds give different designs, andseed=Nonegives a fresh design on every call. - All dimensions share one sequence, so two parameters of the same size never receive identical coordinates.
- scipy warns when
n_samplesis not a power of 2, since that is when Sobol points are best balanced.
Behaviour change: seeded Sobol designs differ from those in 2.4.0.
Dependencies
- The Sobol sampler uses scipy, which stays an optional dependency (#301). A plain install still has it, because SALib depends on it. The sampler raises a clear
ImportErrorif scipy is missing or older than 1.15. - The
scipyandallextras now requirescipy>=1.15, up from>=1.10.1. - The
docsextra capspymdown-extensions<12(#361). Version 12 breaks mkdocstrings 1.0.6, which had made the docs build fail in CI.
Upgrading
pip install --upgrade f3dasm (2.4.0 → 2.4.1). Three things to know:
- Grids are larger. If the step divides the range, lowering each continuous parameter's upper bound by one step gives the old grid back.
- Seeded Sobol designs change. If you compare against designs saved with 2.4.0, regenerate them or stay on 2.4.0 for that comparison.
- Sobol needs scipy 1.15 or newer. If you see the
ImportError, runpip install --upgrade "f3dasm[scipy]".
What's Changed
- Cap pymdown-extensions below 12 to fix the docs build in CI by @mpvanderschelling in #361
- Grid sampler includes the upper bound; Sobol sampler uses its seed (#357, #358) by @mpvanderschelling in #360
- Bump version to 2.4.1 by @mpvanderschelling in #362
- Release 2.4.1: grid and Sobol sampler fixes by @mpvanderschelling in #363
Full Changelog: v2.4.0...v2.4.1