Skip to content

[9.0] test: Pin histogram bins so plot references don't depend on numpy - #8754

Merged
fstagni merged 1 commit into
DIRACGrid:rel-v9r0from
chrisburr:fix/plot-tests-numpy-bins-v9r0
Aug 28, 2026
Merged

[9.0] test: Pin histogram bins so plot references don't depend on numpy#8754
fstagni merged 1 commit into
DIRACGrid:rel-v9r0from
chrisburr:fix/plot-tests-numpy-bins-v9r0

Conversation

@chrisburr

Copy link
Copy Markdown
Member

Forward port of #8753

The number of bins chosen by the default "bins=auto" comes from numpy,
and numpy 2.1 changed the heuristic: [2, 2, 3, 4, 5, 5] is split into 4
bins by numpy 1.x but 3 bins by numpy >= 2.1. The matplotlib 3.11
reference images for histogram1 and histogram2 were generated with numpy
2, so they could never match DIRACOS, which pins numpy < 2 for
elasticsearch < 7.14.

Ask for an explicit number of bins for those two plots instead. The
values are the ones "auto" picks with numpy 1.x, so the plots are
unchanged and the existing pre-3.11 references stay valid; only the two
matplotlib 3.11 references needed regenerating. histogram3 keeps "auto":
it is the only shape used in production (see
JobPlotter._plotHistogramCPUUsed) and it bins identically under both
numpy versions.

Test_Plots.py passes 8/8 on numpy 1.26.4 + matplotlib 3.11.1 (the
DIRACOS stack), numpy 2.4.6 + matplotlib 3.11.1, and numpy 1.26.4 +
matplotlib 3.10.9.
@chrisburr
chrisburr marked this pull request as ready for review August 27, 2026 13:41
@chrisburr
chrisburr requested a review from fstagni as a code owner August 27, 2026 13:41
@fstagni
fstagni merged commit 1db5692 into DIRACGrid:rel-v9r0 Aug 28, 2026
32 of 33 checks passed
@DIRACGridBot DIRACGridBot added the sweep:ignore Prevent sweeping from being ran for this PR label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sweep:ignore Prevent sweeping from being ran for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants