Skip to content

Fix plot_intensities for data on very large grids #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2025
Merged

Fix plot_intensities for data on very large grids #379

merged 3 commits into from
May 15, 2025

Conversation

kbarros
Copy link
Member

@kbarros kbarros commented May 9, 2025

A very large grid passed to Makie.image or Makie.heatmap causes certain OpenGL backends to fail. Consequently, plot_intensities will not render certain data.

As discussed in MakieOrg/Makie.jl#4950, a workaround is to convert all uses of Makie.image to Makie.heatmap, and then wrap the grid data inside a Makie.Resampler object. That is implemented here.

Notes:

  • Apart from this bug, Makie.image could be preferable over Makie.heatmap in other ways, e.g., data on a regular grid is faster to render. However, the two have some subtle rendering differences: axis ranges may change slightly, and heatmap does not interpolate between grid points like image seems to.
  • No attempt is made to determine what grid sizes will cause rendering to fail for the given graphics hardware. We pick a conservative number, 2000 pixels along any axis, and create a Makie.Resampler if that threshold is reached.
  • Caution is required around the ylims argument. With this PR, it is interpreted to apply after any energy units conversions are performed.
  • Conversion in the opposite direction (heatmap to image) happened in Powder averaging of static intensities #374, which this PR partially undoes.

This allows to use Makie.Resampler as a workaround to MakieOrg/Makie.jl#4950.
@kbarros kbarros merged commit 14aef14 into main May 15, 2025
4 checks passed
@kbarros kbarros deleted the heatmap branch May 15, 2025 01:49
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