Skip to content

Instantly share code, notes, and snippets.

@matthewturk
Created January 24, 2022 16:31
Show Gist options
  • Save matthewturk/555124c31c389acfc95966cf1c073741 to your computer and use it in GitHub Desktop.
Save matthewturk/555124c31c389acfc95966cf1c073741 to your computer and use it in GitHub Desktop.
import sys
import os
import glob
import yt
for fn in sorted(glob.glob("*.ewah*")):
print(fn)
os.unlink(fn)
index_order = (int(sys.argv[-2]), int(sys.argv[-1]))
ds = yt.load("snapshot_250.hdf5", index_order=index_order)
_, c = ds.find_min(("PartType1","Potential"))
s = ds.r[:, :, c[2]]
shape = s["gas", "density"].shape
print(f"Index order {index_order[0]} {index_order[1]} with {shape} is {shape[0] == 332646}")
if 0:
slc = yt.SlicePlot(ds, "z", ("gas","density"), center=c, width=(1500.0,"kpc"))
print(slc.data_source["gas", "density"].shape)
print(slc.save(f"slice_{index_order[0]}_{index_order[1]}"))
# index 1 1 has shape 320476 and looks bad
# index 1 2 has shape 320476 and looks bad
# index 1 3 has shape 325971 and looks bad
# index 1 4 has shape 319261 and looks bad
# index 2 1 has shape 332646 and looks OK
# index 2 2 has shape 332646 and looks OK
# index 2 3 has shape 332646 and looks OK
# index 2 4 has shape 332646 and looks OK
# index 2 5 has shape 323369 and looks bad
# index 2 6 has shape 321762 and looks bad
# index 3 1 has shape 332646 and looks OK
# index 3 2 has shape 332646 and looks OK
# index 3 2 has shape 332646 and looks OK
# index 3 3 has shape 330492 and looks bad
# index 3 4 has shape 326398 and looks bad
# index 4 6 has shape 328018 and looks bad
# Turning on always colliding at refined level doesn't fix 1 1 (line 971 or so in ewah_bool_wrap.pyx)
# (doesn't seem to do ANYthing)
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment