pynbody.sph.renderers.make_render_pipeline

pynbody.sph.renderers.make_render_pipeline#

pynbody.sph.renderers.make_render_pipeline(sim: SimSnap, /, quantity: str | ndarray = 'rho', width: float | str | UnitBase = 10.0, resolution: int = None, nx: int = None, ny: int = None, nz: int = None, nside: int = None, out_units: str | UnitBase = None, weight: bool | str | ndarray | None = None, restrict_depth: bool = False, kernel: None | str | KernelBase = None, smooth_floor: float = 0.0, z_camera: float | None = None, threaded: bool | None = None, approximate_fast: bool | None = None, denoise: bool | None = None, target: str = 'image') ImageRendererBase[source]#

Generate a renderer object for rendering images of a simulation snapshot.

Parameters:
  • sim (snapshot.SimSnap) – The simulation snapshot to be rendered.

  • quantity (str, numpy.ndarray) – The quantity to be rendered. If a string, the quantity is taken from the simulation snapshot. Default is ‘rho’.

  • width (float, str, units.UnitBase) – The width of the image to be rendered. If a string or unit, the value will be converted to the units of the simulation snapshot.

  • resolution (int, optional) – The resolution of the image to be rendered, in pixels. The default is None, in which case the default resolution from the configuration file is used.

  • nx (int, optional) – The x resolution of the image to be rendered, in pixels. The default is None, in which case the the resolution keyword is used instead.

  • ny (int, optional) – The y resolution of the image to be rendered, in pixels. The default is None, in which case the the resolution keyword is used instead.

  • nz (int, optional) – The z resolution of the image to be rendered, in pixels (for 3d-grid renderers only). The default is None, in which case the the resolution keyword is used instead.

  • nside (int, optional) – The nside of the image to be rendered, for healpix images (target=’healpix’). The default is None, in which case a default nside is adopted.

  • out_units (str, units.UnitBase, optional) – The units to be used for the output image. These are checked for compatibility with the array to be rendered, either in projection or in slice. If None, the output units are set to the units of the array to be rendered.

  • weight (bool, str, numpy.ndarray, optional) – If True, the image is rendered as a volume-weighted projection. If a string or numpy array, the image is rendered as a weighted projection using the specified quantity. If None, the image is rendered as a simple slice or projection. The default is None.

  • restrict_depth (bool, optional) – Whether to restrict the z range of the image to the same as the x range. The default is False.

  • kernel (str, kernels.KernelBase, optional) – The kernel to be used for the image rendering. If None, the default kernel is assigned. For more information see pynbody.sph.kernels.create_kernel().

  • smooth_floor (float, str, units.UnitBase, optional) – The minimum smoothing length to be used in the image rendering, specified in units of the position array. Smoothing lengths below this will be boosted to this value. The default is 0.0, i.e. no manipulation of the smoothing takes place. This option is most useful for contour rendering, where excessive small-scale detail may be undesirable.

  • smooth_min (float, str, units.UnitBase, optional) – The minimum smoothing length to be used in the image rendering, specified in units of the position array or as a unit. Smoothing lengths below this will be boosted to this value. The default is 0.0, i.e. no manipulation of the smoothing takes place. This option is most useful for contour rendering, where excessive small-scale detail may be undesirable.

  • z_camera (float, optional) – The z position of the camera for the image to be rendered. The default is None. For more information on perspective rendering see ImageGeometry.set_camera_z().

  • threaded (bool, optional) – Whether to render the image across multiple threads. Yes if true; no if false. The number of threads to be used is determined by the configuration file. If None, the use of threading is also determined by the configuration file.

  • approximate_fast (bool, optional) – Whether to render the image using a lower-resolution approximation for large smoothing lengths. The default is None, in which case the use of approximation is determined by the configuration file.

  • denoise (bool, optional) – Whether to include denoising in the rendering process. If None, denoising is applied only if the image is likely to benefit from it. If True, denoising is to be forced on the image; if that is actually impossible, this routine raises an exception. If False, denoising is never applied.

  • target (str, optional) –

    The type of output to generate. Options are:
    • ’image’: a 2d image (default)

    • ’volume’: a 3d cuboid

    • ’healpix’: a healpix map