pynbody.sph.render_image

Contents

pynbody.sph.render_image#

pynbody.sph.render_image(snap, qty='rho', x2=100, nx=500, y2=None, ny=None, x1=None, y1=None, z_plane=0.0, out_units=None, xy_units=None, kernel=<pynbody.sph.Kernel object>, z_camera=None, smooth='smooth', smooth_min=0.0, force_quiet=False, approximate_fast=True, threaded=None, denoise=None, z_range=None)[source]#

Render an SPH image using a typical (mass/rho)-weighted ‘scatter’ scheme.

Keyword arguments:

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

x2 (100.0): The x-coordinate of the right edge of the image

nx (500): The number of pixels wide to make the image

y2: The y-coordinate of the upper edge of the image (default x2,

or if ny is specified, x2*ny/nx)

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

x1 (-x2): The x-coordinate of the left edge of the image

y1 (-y2): The y-coordinate of the lower edge of the image

z_plane (0.0): The z-coordinate of the plane of the image

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

xy_units: The units for the x and y axes

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

z_camera: If this is set, a perspective image is rendered,

assuming the kernel is suitable (i.e. is a projecting kernel). The camera is at the specified z coordinate looking towards -ve z, and each pixel represents a line-of-sight radially outwards from the camera. The width then specifies the width of the image in the z=0 plane. Particles too close to the camera are also excluded.

z_range: If set, only particles with z between z_range[0] and z_range[1] will be included

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

(default ‘smooth’)

smooth_min: The minimum smoothing length; if smoothing lengths fall below

this, they are artificially inflated to this value

approximate_fast: if True, render high smoothing length particles at

progressively lower resolution, resample and sum

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.

verbose: if True, all text output suppressed

threaded: if False (or None), render on a single core. Otherwise,

the number of threads to use (defaults to a value specified in your configuration files).