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, return_image=False, 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_dustis True, a simple dust screening is applied; see below for important notes on the dust screening.Changed in version 2.0: For consistency with other plotting routines, the axes and clear arguments have been removed. Set up axes as needed using the standard matplotlib commands.
ret_im has been renamed to return_image for consistency with other plotting routines, and ret_range has been renamed to return_range.
The dust screening model has been improved (though see important notes below on limitations), and SSP tables are also considerably improved (see
pynbody.analysis.luminosity).- 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 thepynbody.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 thepynbody.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 thepynbody.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_rangeis 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.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.
- Returns:
If
return_imageis True, an array (N x N x 3) representing the RGB image is returned.If
return_rangeis 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 (2000, ApJ, 533, 682) with an R_V of 3.1.
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.