pynbody.sph.to_3d_grid

Contents

pynbody.sph.to_3d_grid#

pynbody.sph.to_3d_grid(snap, qty='rho', nx=None, ny=None, nz=None, x2=None, out_units=None, xy_units=None, kernel=<pynbody.sph.Kernel object>, smooth='smooth', approximate_fast=True, threaded=None, snap_slice=None, denoise=None)[source]#

Project SPH onto a grid using a typical (mass/rho)-weighted ‘scatter’ scheme.

Keyword arguments:

qty (‘rho’): The name of the array within the simulation to render

nx (x2-x1 / soft): The number of pixels wide to make the grid

ny (nx): The number of pixels tall to make the grid

nz (nx): The number of pixels deep to make the grid

out_units (no conversion): The units to convert the output grid into

xy_units: The units for the x and y axes

kernel: The Kernel object to use (default Kernel(), a 3D spline kernel)

smooth: The name of the array which contains the smoothing lengths

(default ‘smooth’)

denoise: if True, divide through by an estimate of the discreteness noise.

The returned image is then not strictly an SPH estimate, but this option can be useful to reduce noise especially when rendering AMR grids which often introduce problematic edge effects.