Skip to content
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

Test picking #4459

Merged
merged 26 commits into from
Oct 15, 2024
Merged

Test picking #4459

merged 26 commits into from
Oct 15, 2024

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Oct 7, 2024

Description

This will add picking tests for all primitives in GLMakie and WGLMakie and probably fix a few issues on the side.
TODO:

  • GLMakie picking tests
  • WGLMakie picking tests
  • make sure heatmap actually tests a heatmap path
  • consider reworking image, heatmap and surface so that the index relates to the given matrix
    • GLMakie
    • WGLMakie

Other fixes/Changes:

  • fixed edge case of voxel picking indices going out of bounds
  • changed strict equality in clip planes modelinv check to isapprox, matching GLMakie
  • fixed arg based voxel placement & scaling in WGLMakie
  • DataInspector now relies on heatmap picking index instead of manually calculating it

closes #3265

Type of change

  • Bug fix: Voxel indices
  • New feature: useful image, heatmap & surface picking indices
  • testing: picking tests for GLMakie & WGLMakie

Checklist

  • Added an entry in CHANGELOG.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@MakieBot
Copy link
Collaborator

MakieBot commented Oct 7, 2024

Compile Times benchmark

Note, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running:

using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(fig)
using create display create display
GLMakie 5.24s (5.18, 5.27) 0.03+- 112.94ms (109.84, 118.04) 2.95+- 425.83ms (414.66, 437.77) 8.34+- 9.42ms (8.51, 9.81) 0.43+- 26.31ms (26.13, 26.78) 0.23+-
master 5.15s (5.12, 5.21) 0.03+- 110.73ms (108.36, 113.71) 1.70+- 418.21ms (412.04, 424.92) 4.46+- 9.31ms (8.38, 9.69) 0.43+- 26.31ms (25.95, 27.30) 0.46+-
evaluation 0.98x slower X, 0.09s (2.66d, 0.00p, 0.03std) 0.98x invariant, 2.21ms (0.92d, 0.12p, 2.33std) 0.98x invariant, 7.61ms (1.14d, 0.06p, 6.40std) 0.99x invariant, 0.11ms (0.26d, 0.64p, 0.43std) 1.00x invariant, 0.0ms (0.01d, 0.98p, 0.35std)
CairoMakie 5.16s (5.03, 5.26) 0.08+- 125.59ms (116.73, 130.59) 4.77+- 189.59ms (179.66, 195.99) 5.66+- 9.98ms (9.64, 10.53) 0.35+- 1.21ms (1.16, 1.27) 0.04+-
master 5.15s (5.03, 5.23) 0.09+- 129.09ms (115.87, 149.68) 12.74+- 186.75ms (172.13, 205.00) 11.12+- 9.94ms (9.33, 10.54) 0.47+- 1.21ms (1.17, 1.28) 0.03+-
evaluation 1.00x invariant, 0.01s (0.16d, 0.77p, 0.08std) 1.03x invariant, -3.51ms (-0.36d, 0.52p, 8.75std) 0.98x invariant, 2.85ms (0.32d, 0.56p, 8.39std) 1.00x invariant, 0.04ms (0.10d, 0.85p, 0.41std) 1.00x invariant, -0.0ms (-0.05d, 0.93p, 0.03std)
WGLMakie 5.60s (5.54, 5.69) 0.05+- 108.56ms (107.31, 109.89) 0.78+- 4.69s (4.63, 4.91) 0.10+- 12.05ms (11.91, 12.33) 0.13+- 132.30ms (121.04, 139.13) 5.62+-
master 5.59s (5.53, 5.64) 0.04+- 109.18ms (107.45, 111.72) 1.60+- 5.05s (4.87, 5.21) 0.14+- 11.73ms (11.48, 12.53) 0.37+- 117.54ms (112.47, 122.40) 3.54+-
evaluation 1.00x invariant, 0.02s (0.41d, 0.46p, 0.04std) 1.01x invariant, -0.62ms (-0.49d, 0.38p, 1.19std) 1.08x faster✅, -0.36s (-3.00d, 0.00p, 0.12std) 0.97x invariant, 0.32ms (1.15d, 0.07p, 0.25std) 0.89x slower❌, 14.76ms (3.14d, 0.00p, 4.58std)

vol = volume!(scene, 80..110, 320..350, -1..1, rand(2,2,2))

# render one frame to generate picking texture
colorbuffer(scene);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so this was the trick for rendering a frame in CI.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might also depend on where the file is included. I (now) have it after the refimg tests since those need to work the same for every backend, and it seems to work

@ffreyer ffreyer added the skip-changelog Skips changelog enforcer label Oct 7, 2024
@ffreyer ffreyer removed the skip-changelog Skips changelog enforcer label Oct 8, 2024
@ffreyer
Copy link
Collaborator Author

ffreyer commented Oct 9, 2024

Test failures are caused by scatter(f[2, 1], -1..1, x -> x^2) calls generating a different distribution of points. I don't know what exactly is causing this, but between master and this pr the julia version updated from 1.10.5 to 1.11.0 and a bunch of base packages got Versions now. I assume something changed there to cause this...

After some more investigation:
PlotUtils relies on Base.rand with rng = MersenneTwister(1337), which produces different results:

begin
    using Random
    rng = MersenneTwister(1337)
    rand(rng)
end
0.22658190197881312 # 1.10.5
0.8834931857854444 # 1.11.0

@ffreyer ffreyer marked this pull request as ready for review October 10, 2024 15:36
@ffreyer ffreyer merged commit 0033b7d into master Oct 15, 2024
18 checks passed
@ffreyer ffreyer deleted the ff/test-picking branch October 15, 2024 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

heatmap and pick
3 participants