Releases: mjuez/baycomp_plotting
v1.2.1
Bug fixes
Two bugs in dens() surfaced while diagnosing a confusing LOOCV plot reported by a user.
dens() now honours p.rope for the ROPE axvlines
Before, the orange ROPE lines were drawn at hardcoded ±0.01 regardless of the rope parameter passed to CorrelatedTTest. If you used a non-conventional rope (e.g. 0.001 or 0.05), the lines on screen did not match the rope used by the test — silently misleading. They now sit at exactly ±p.rope.
dens() now fails loudly on degenerate posteriors
Before, calling dens() on a posterior with var = 0 (typical when the two input score arrays are identical) produced an unhelpful ValueError: Axis limits cannot be NaN or Inf from inside matplotlib. It now raises an explicit ValueError describing the cause.
```python
ValueError: Cannot draw density: posterior variance is np.float64(0.0).
The two classifiers likely produced identical scores;
the posterior is degenerate and has no density to plot.
```
The check covers var = 0, var < 0, and var = NaN.
Compatibility
- No public API changes.
Color,dens,ternkeep the same signatures. - The fix is a no-op for callers using the default
rope=0.01. - New behaviour is strictly an improvement: correct visual output for non-default ropes, clear error message for degenerate posteriors.
Tests
Four new tests added to the suite (now 23/23):
- Parametrised over
rope ∈ {0.001, 0.01, 0.05}, asserts the two ROPE axvlines fall at exactly±rope. - Asserts
ValueErrorwith"degenerate"in the message when the posterior hasvar=0.
Install
```
pip install -U baycomp_plotting
```
Full diff: v1.2.0...v1.2.1
v1.2.0
Highlights
- Fixes the dependency-resolver failure on Python 3.10+. The strict
==pins onnumpy,scipy,matplotlibanditeroundare gone; runtime deps are now declared with lower bounds only (matplotlib>=3.5,numpy>=1.21,scipy>=1.7).pip install baycomp_plottingnow resolves cleanly on Python 3.9 through 3.13 with modern numpy 2.x. - No public API changes.
Color,dens,ternkeep the same signatures and behaviour; existing code continues to work onpip install -U baycomp_plotting. - New
baycomp_plotting.__version__attribute.
Internal modernisation
- Migrated from
setup.pyto PEP 621pyproject.toml(hatchling backend). - Moved package to
src/layout. - Dropped
iteroundas a runtime dependency (largest-remainder rounding inlined). - Refactored
_add_posteriorout of nested closure scope; minor code cleanup.
Quality and CI
- New pytest suite (19 tests) covering pure helpers + image-regression of
dens/ternviapytest-mpl. - Strict deprecation/future-warning filters in
pyproject.tomlto catch future upstream breakage early. - GitHub Actions matrix: Python 3.9 / 3.10 / 3.11 / 3.12 / 3.13 on Ubuntu, plus macOS and Windows on 3.12. Weekly cron run flags upstream regressions.
- Release workflow with PyPI / TestPyPI trusted publishing.
Compatibility
Tested with numpy 2.4, scipy 1.17, matplotlib 3.10 on Python 3.13 — and across the full matrix in CI.
Install
pip install -U baycomp_plotting
Full diff: v1_1_1...v1.2.0