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

BUG: fix indexing error in fill_region_float #4970

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

chrishavlin
Copy link
Contributor

I was trying to figure out why the final row of pixels in the following plot seem to have elevated values:

import yt 
import matplotlib.pyplot as plt 
import numpy as np
ds = yt.load_sample("DeeplyNestedZoom")

le = ds.domain_left_edge
re = ds.arr([0.1,]*3, 'code_length')
res = (100,)*3
reg = ds.r[le[0]:re[0]:res[0]*1j, 
           le[1]:re[1]:res[1]*1j, 
           le[2]:re[2]:res[2]*1j,]
dens = reg['gas', 'density']
plt.imshow(np.log10(dens[:,50,:]), origin='lower')

fill_region_main

The elevated values are not super obvious here... but i've been doing some experiments stitching together arbitrary grid objects into zarr files (over in yt-project/yt_experiments#10) and found some artifacts aligned with the boundaries of my chunks:

tiled_grids

In any case, reading through fill_region_float, I noticed this line where there seems to be an indexing error. With the change on this branch, the above plots become

fill_region_new
fixed_tiles

@chrishavlin
Copy link
Contributor Author

wouldn't be surprised if an answer test or two fails...

@@ -921,7 +921,7 @@ def fill_region_float(np.ndarray[np.float64_t, ndim=2] fcoords,
if (sp[1] + odsp[1] < LE[1]) or (sp[1] - odsp[1] > RE[1]): continue
for zi in range(2):
if diter[2][zi] == 999: continue
sp[2] = osp[2] + diterv[2][yi]
sp[2] = osp[2] + diterv[2][zi]
Copy link
Member

Choose a reason for hiding this comment

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

wow. This is definitely a correction. Thank you.

@neutrinoceros neutrinoceros added this to the 4.4.0 milestone Aug 28, 2024
@neutrinoceros neutrinoceros merged commit 8ea4823 into yt-project:main Aug 28, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants