Skip to content

Unify logic for computing vmin and vmax in ribs.visualize - #725

Merged
btjanaka merged 15 commits into
masterfrom
vmin-vmax
Jul 17, 2026
Merged

Unify logic for computing vmin and vmax in ribs.visualize#725
btjanaka merged 15 commits into
masterfrom
vmin-vmax

Conversation

@btjanaka

@btjanaka btjanaka commented Jul 16, 2026

Copy link
Copy Markdown
Member

Description

The logic for computing vmin and vmax for an archive is not trivial. The logic for computing each of vmin and vmax depends on factors including:

  1. Whether vmin is None or passed in
  2. Whether vmax is None or passed in
  3. Whether the objectives array extracted from the archive has len(0) (i.e., is empty) or has values

Currently, the logic for handling vmin and vmax is repeated across all the functions in ribs/visualize, and there are gaps for the cases where vmin is None and vmax is not None, and vice versa. This PR fills in that logic and moves it into a common utility in ribs/visualize/_utils.py.

TODO

  • Add compute_vmin_vmax util in ribs/visualize/_utils.py
  • Add tests in tests/utils/utils_test.py
  • Update visualize functions under ribs/visualize/ to use the new util
    • Update cvt_archive_heatmap and cvt_archive_3d_plot -- they seem to have more involved logic -> It turns out they had a default separation of 0.01 when the objectives were equal, while we use 0.1 -- hence, the baseline images for test_vmin_equals_vmax changed for both these functions
  • Ensure that existing tests pass -> Some baseline images changed slightly
  • Add tests for 1-2 visualize functions that test various settings of vmin and vmax when the archive is empty -> cvt_archive_heatmap

Status

  • I have read the guidelines in
    CONTRIBUTING.md
  • I have linted and formatted my code with ruff and pylint
  • I have tested my code by running pytest
  • I have added a description of my change to the changelog in HISTORY.md
  • This PR is ready to go

@btjanaka
btjanaka merged commit be33071 into master Jul 17, 2026
18 checks passed
@btjanaka
btjanaka deleted the vmin-vmax branch July 17, 2026 09:08
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