Skip to content

Fix NaN-unsafe vmax computation in log-scale LogNorm#237

Closed
Copilot wants to merge 2 commits intoclaude/refactor-plotting-module-s6Zq1from
copilot/sub-pr-236
Closed

Fix NaN-unsafe vmax computation in log-scale LogNorm#237
Copilot wants to merge 2 commits intoclaude/refactor-plotting-module-s6Zq1from
copilot/sub-pr-236

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

When an array contains NaNs (e.g., masked pixels), clipped.max() propagates nan into vmax, silently breaking LogNorm and imshow. The existing MatWrap path already uses np.nanmin/np.nanmax for this reason.

Change

  • autoarray/plot/plots/array.py: replace clipped.max() with np.nanmax(clipped) when computing vmax for LogNorm in the log-scale branch.
# Before
norm = LogNorm(vmin=vmin or log10_min, vmax=vmax or clipped.max())

# After
norm = LogNorm(vmin=vmin or log10_min, vmax=vmax or np.nanmax(clipped))

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…max()

Co-authored-by: Jammy2211 <23455639+Jammy2211@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on plotting module refactor in PR #236 Fix NaN-unsafe vmax computation in log-scale LogNorm Mar 17, 2026
Copilot AI requested a review from Jammy2211 March 17, 2026 13:59
@Jammy2211 Jammy2211 closed this Mar 24, 2026
@Jammy2211 Jammy2211 deleted the copilot/sub-pr-236 branch April 2, 2026 11: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.

2 participants