Skip to content

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

Open
chrisburr wants to merge 1 commit into
DIRACGrid:rel-v8r0from
chrisburr:fix/plot-tests-numpy-bins-v8r0
Open

[8.0] test: Pin histogram bins so plot references don't depend on numpy#8753
chrisburr wants to merge 1 commit into
DIRACGrid:rel-v8r0from
chrisburr:fix/plot-tests-numpy-bins-v8r0

Conversation

@chrisburr

Copy link
Copy Markdown
Member

Fix test references for numpy 1.x with matplotlib 3.11.x

No need for release notes.

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 changed the title [v8r0] test: Pin histogram bins so plot references don't depend on numpy [8.0] test: Pin histogram bins so plot references don't depend on numpy Aug 27, 2026
@chrisburr
chrisburr marked this pull request as ready for review August 27, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant