Hi,
From the outset I just want to emphasise what a neat package Pynbody is.
I've been using it ever since I discovered it a few years back and it does not stop to amaze ;) So thanks for that, Andrew and collaborators!
Anyway, I was looking into some of its plotting capabilities to create 2D maps, specifically: hist2d, gauss_kde, and sph.render_image. The latter has - at least for my purposes - by far the best performance. Attached an example: three plots, each displaying the mean vertical velocity <vz> of a gas disk on a face-on projection, using each of these three methods.
As you can see, render_image works extremely well in this case, and also in other cases, e.g. when averaging any other velocity (radial, azimuthal) and of course it works extremely well when projecting the gas density.
However, when I repeat the same experiment with, say, the z coordinate, it does something weird. Attached an example, similar to <vz>, but now showing the mean z. While hist2d and gauss_kde yield comparable (and expected) results, render_image does not.
My question is: Is it fundamentally impossible to calculate maps of z, or of any *spatial coordinate* in general, with render_image? Or am I doing something wrong?
I'm sure (I think) I'm setting all the arguments (e.g. out_units, kernel) to sensible values, as demonstrated by the <vz> maps. For reference, these are the function calls in each case:
s = pynbody.load('path to Ramses output file')
# mean vz
sph.render_image(s.gas,
qty='vz',
x2=30.,
xy_units='kpc',
out_units='km s^-1',
kernel=sph.Kernel()
)
# mean z
sph.render_image(s.gas,
qty='z',
x2=30.,
xy_units='kpc',
out_units='kpc',
kernel=sph.Kernel()
)
The former works as expected, judging by comparing to hist2d and gauss_kde, but with superior quality. The latter doesn't.
Note that I'm referring here to the gas cells in a Ramses simulation.
Any hint as to why this is the case and, ideally, how to solve will be much appreciated!
Cheers
Thor