What's really going on when ValueError: The particles span a region larger than the specified boxsize?

32 views
Skip to first unread message

Eliza Diggins

unread,
Jan 6, 2023, 10:50:33 PM1/6/23
to pynbody-users
For context, I'm running RAMSES simulations of galaxy clusters. In one very specific circumstance in my analysis system, I get the following error while plotting.

ValueError: The particles span a region larger than the specified boxsize 

This problem is easily solved (apparently) by changing the simulation boxsize using

data = pyn.load("output_something")
data.properties["boxsize"] = 2*data.properties["boxsize"]

My question then is:
1. does changing the boxsize like this cause further problems? (I have a bad suspicion that it will)
    a. If so, what exactly is using the boxsize that would be impeded?
2. What would be the preferred work around? Should I always limit snapshots to particles within the boxsize when loading them?

Error Reproducing Code (With my snapshot):
data = pyn.load("output_something")

# Aligning data to the axes.
data["pos"] -= data.properties["boxsize"]/2
data.physical_units()

# Plotting
pyn.plot.sph.image(data.dm,qty="rho",**kwargs)

Pontzen, Andrew

unread,
Jan 28, 2023, 9:37:40 AM1/28/23
to pynbody-users
Dear Eliza

Apologies for the very slow reply

Enlarging the boxsize will have the adverse effect of making your softening lengths and densities incorrect when you are near the boundaries of the fundamental domain.  If none of your clusters ‘wrap’ around the box, it won’t be a big problem. But if they do, you could get spurious results in those particular clusters.

I have never seen this happen with RAMSES, so I am a bit puzzled and wonder whether something is a bit wrong with the snapshots. However, if it is just a machine precision error or something, then you should find calling data.wrap() (right after you load it) will sort it out. 

Alternatively, it may point to the wrong boxsize being stored (I have no idea why that would happen), or some data corruption or a variant on the ramses format that pynbody wasn’t expecting. Without actually seeing the file it’s a bit hard to advise further.

Hope this is of some help...

All the best

Andrew




--
You received this message because you are subscribed to the Google Groups "pynbody-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynbody-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pynbody-users/7db3a9d4-745e-44e2-b22b-5e4732c7abefn%40googlegroups.com.

Eliza Diggins

unread,
Jan 29, 2023, 1:22:23 PM1/29/23
to pynbody-users
I see! Thanks for the details! I think for my use-case its fine to just extend the boxsize. I use RAMSES with outflow boundaries, which I think is likely the issue at hand, but I seem to get very reasonable results by just doubling the boxsize.

Thanks for your help,
Eliza

Reply all
Reply to author
Forward
0 new messages