interpreting the linear arrays for vel and other scalars

7 views
Skip to first unread message

Rick Sarmento

unread,
Feb 7, 2024, 4:41:26 PM2/7/24
to pynbody-users
I'm trying to export a velocity array from a RAMSES snap (and subsnap -- a pyn Cuboid)... I do:

zcoord = 70

subsnap = s[ pynbody.filt.Cuboid("0 kpc", "0 kpc", "{} kpc".format(zcoord-70),

                                         "1400 kpc", "1400 kpc", "{} kpc".format(zcoord+70)) ]


I realize that subsnap.gas['vx'] is a linear array ... at first, I thought doing

np.reshape(subsnap.gas['vx'],(20,20,2)) 

where I know that 20 cells cover 1400 kpc physical (hence 2 cover the 140 in the z coord) might give me a picture of the velocity in the slice. But the resulting data doesn't make sense since the ordering of the original linear array is not that straight forward. 

This data is from a large RAMSES cosmo sim where I've used ordering='hilbert'. Looking at the subnap.g['pos'] array, which is also a linear array of position tuples, made me realize the data in the vel arrays are matched up with these position coordinates... Is there a way to simply reorder the subsnap.g['vx'] data (And others) such that I can plot it with plt.pcolormesh??? i.e. - if I know the exported data should have 140,140,2 how can I map that linear array into a data cube representing my volume?

Thanks

Rick Sarmento
ASU

Reply all
Reply to author
Forward
0 new messages