You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/Users/robcleme/dev/yt-project/yt/ttt.py", line 6, in <module>
p.save()
File "/Users/robcleme/dev/yt-project/yt/yt/visualization/_commons.py", line 167, in newfuncself._recreate_frb()
File "/Users/robcleme/dev/yt-project/yt/yt/visualization/plot_window.py", line 333, in _recreate_frbself._frb.render(key)
File "/Users/robcleme/dev/yt-project/yt/yt/visualization/fixed_resolution.py", line 204, in renderreturnself[item]
~~~~^^^^^^
File "/Users/robcleme/dev/yt-project/yt/yt/visualization/fixed_resolution.py", line 776, in __getitem__
add_points_to_greyscale_image(
File "yt/utilities/lib/image_utilities.pyx", line 28, in yt.utilities.lib.image_utilities.add_points_to_greyscale_image
buffer[i, j] += pv[pi]
IndexError: Out of bounds on buffer access (axis 0)
Expected outcome
no error
Version Information
Operating System: macOS
Python Version: 3.11.4
yt version: 4.3.dev0
Other Libraries (if applicable): numpy 1.25.0, matplotlib 3.7.1
yt installed from source
The text was updated successfully, but these errors were encountered:
Probably worth clamping it and also seeing if the difference between the initial and clamped values is > 1. If we're looking at edge effects (which we might be since it's zooming in) then perhaps we just need a better system than calling <int>. It's possible that some particles may be included that are technically centered outside the bounds of the image.
I think that's exactly what's happening. The following patch resolves the issue
diff --git a/yt/utilities/lib/image_utilities.pyx b/yt/utilities/lib/image_utilities.pyx
index 7dc939ac4..5360ccf4e 100644
--- a/yt/utilities/lib/image_utilities.pyx+++ b/yt/utilities/lib/image_utilities.pyx@@ -25,6 +25,11 @@ def add_points_to_greyscale_image(
for pi in range(npx):
j = <int> (xs * px[pi])
i = <int> (ys * py[pi])
+ if (i >= buffer.shape[0]) or (j >= buffer.shape[1]):+ # some particles might intersect the image buffer+ # but actually be centered out of bounds. Skip those.+ continue+
buffer[i, j] += pv[pi]
buffer_mask[i, j] = 1
return
note that it's not expected to have much of a performance cost since the branching should be very well predicted (even in the reproduction script I've given, only one particle falls into the if clause)
neutrinoceros
changed the title
BUG: out-of-bounds memory access when trying to zoom on a ParticleProjectionPlot (AREPO)
BUG: out-of-bounds memory access when trying to zoom on a ParticleProjectionPlot
Jul 27, 2023
Bug report
Bug summary
Zooming may produce out-of-bounds errors. I'm not sure if this is specific to "SPH" datasets or to AREPO (or, none of the above).
Code for reproduction
Actual outcome
Expected outcome
no error
Version Information
yt installed from source
The text was updated successfully, but these errors were encountered: