pynbody.plot.stars.render

Contents

pynbody.plot.stars.render#

pynbody.plot.stars.render(sim, r_band='I', g_band='V', b_band='U', width=50, r_scale=0.5, g_scale=1.0, b_scale=1.0, with_dust=False, dynamic_range=2.0, mag_range=None, resolution=None, noplot=False, axes=None, return_image=False, clear=True, return_range=False)[source]#

Make a 3-color image of stars.

For information about how surface brightnesses are calculated, see the documentation for pynbody.analysis.luminosity.

If with_dust is True, a simple dust screening is applied; see below for important notes on the dust screening.

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

  • r_band (str) – The filter bands to use for R, G and B image channels. Default is ‘I’, ‘V’, ‘U’. These bands are as defined in pynbody.analysis.luminosity, or overriden using the pynbody.analysis.luminosity.use_custom_ssp_table() function.

  • g_band (str) – The filter bands to use for R, G and B image channels. Default is ‘I’, ‘V’, ‘U’. These bands are as defined in pynbody.analysis.luminosity, or overriden using the pynbody.analysis.luminosity.use_custom_ssp_table() function.

  • b_band (str) – The filter bands to use for R, G and B image channels. Default is ‘I’, ‘V’, ‘U’. These bands are as defined in pynbody.analysis.luminosity, or overriden using the pynbody.analysis.luminosity.use_custom_ssp_table() function.

  • width (float | str, optional) – The width of the image to produce, either as a float or a unit string.

  • r_scale (float, optional) – The scaling of the red, green and blue channels before they are combined.

  • g_scale (float, optional) – The scaling of the red, green and blue channels before they are combined.

  • b_scale (float, optional) – The scaling of the red, green and blue channels before they are combined.

  • dynamic_range (float, optional) – The number of dex in luminosity over which the image brightness ranges, if mag_range is not provided.

  • with_dust (bool, optional) – If True, the image is rendered with a simple dust screening model. See important notes below.

  • mag_range (tuple, optional) – The brightest and faintest surface brightnesses in the final image, in mag arcsec^-2.

  • resolution (int, optional) – The resolution of the image to produce. The default is determined by the configuration option image-default-resolution.

  • noplot (bool, optional) – If True, the image is not plotted; most useful alongside return_image, if you want to save the image to a file.

  • axes (matplotlib.axes.Axes, optional) – If not None, the axes object to plot to.

  • return_image (bool, optional) – If True, the image is returned as an array (N x N x 3) for the RGB channels. Default is False.

  • return_range (bool, optional) – If True, a tuple with the range of the image in mag arcsec^-2 is returned. Default is False.

  • clear (bool, optional) – If True, the current figure is cleared before plotting. Default is True.

Returns:

  • If return_image is True, an array (N x N x 3) representing the RGB image is returned.

  • If return_range is True, a tuple with the range of the image in mag arcsec^-2 is returned.

Notes

The dust screening model is exceptionally simple and can only be used for indicative purposes. For more accurate results, radiative transfer is essential and is provided by other packages such as skirt.

The model assumes that the dust is proportional to the metal density. It estimates a V-band extinction A_V using empirical data from Draine & Lee (1984, ApJ, 285, 89) and Savage and Mathis (1979, ARA&A, 17, 73). This is then converted to extinction in the given bands using the Calzetti law.

The model furthermore assumes that half the dust is in front of the stars and half behind, because there is no radiative transfer to account for the actual distribution of dust in the 3d space.