Using Bridges with RAMSES data

20 views
Skip to first unread message

Eliza Diggins

unread,
Jan 29, 2023, 1:32:53 PM1/29/23
to pynbody-users
Hey all,

I'm wondering if I can get some assistance utilizing bridges between RAMSES snapshots. At current, I encounter errors when I run anything like the following:

------------------------------------------------------------------------------------------------------------------------------
import pynbody as pyn
import numpy as np

# Loading the snapshots
o1,o2= pyn.load('output_00001'),pyn.load("output_00200")

# creating the bridge #
bridge = pyn.bridge.Bridge(o1.dm,o2.dm)

# filtering first ouput #
s = pyn.filt.Sphere(radius, center)

o2_filt = bridge(o1.dm[s])

----------------------------------------------------------------------------------------------------------
This returns the following odd error: 

RuntimeError: Stale reference to start or endpoint

The RAMSES outputs do include AMR gas particles, but I'm restricting the bridge to the DM particles, so I don't think that should be the issue!

Hopefully this is a relatively simple fix. Additionally, this might be an example worth adding to documentation as its likely one of the more useful cases that users might encounter!

Thanks for any insight you can lend!

Best,
Eliza Diggins

Pontzen, Andrew

unread,
Jan 29, 2023, 2:41:40 PM1/29/23
to pynbody-users
Yes this is a strange case. The rather hidden problem is that o1.dm is a transitory object that has been deleted by the time it’s actually needed by the bridge.

To fix this, you must store and use it consistently, something like this:

o1_dm = o1.dm
o2_dm = o2.dm

bridge = pyn.bridge.Bridge(o1_dm, o2_dm)

s = pyn.filt.Sphere(radius, center)

o2_filt = bridge(o1_dm[s])

I agree it would be good to explain somewhere in the documentation, or at least make the error message a bit more explanatory, if anyone has time to do so

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/61737a4f-1af3-4cf5-a38d-f8445a7454dcn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages