pynbody.analysis.luminosity

pynbody.analysis.luminosity#

Routines and derived arrays for calculating luminosities and magnitudes.

Changed in version 2.0: Luminosity tables are now generated directly from the output of the STEV/CMD web interface. The default tables are updated to more modern stellar population tracks (May 2024). This will result in different magnitudes being calculated compared to pynbody v1. Furthermore, the default tables now include the AB-calibrated LSST bandpasses (ugrizy) in addition to the Vega-calibrated Johnson-Cousins bandpasses (UBVRIJHK). As a result, the bandpass names are now case-sensitive.

To obtain pynbody v1 behaviour, you can use the ‘v1’ table. See use_custom_ssp_table().

This module provides a number of routines for calculating luminosities and magnitudes starting from the stellar populations in a simulation.

Two sets of derived arrays are programmatically generated. The first set is the magnitude of a stellar particle in a given bandpass, e.g. V_mag. The second set is the luminosity density, encoded as \(10^{-0.4 * {\rm mag}}\) per unit volume, e.g. V_lum_den. The purpose of the luminosity density array is that, when integrated over a line of sight, it becomes a number of magnitudes per unit area (e.g. mag/kpc^2), which can then be turned into an astronomical surface brightness (mag/arcsec^2) – this approach is taken by the pynbody.plot.stars.render() routine.

The above arrays are generated for all known bandpasses in the CMD.

Origin of the luminosity tables#

Luminosities in pynbody are calculated by treating each star particle as a single stellar population (SSP) of a known age and metallicity, assuming a fixed initial mass function (IMF). Magntiudes for each star particle can then be interpolated from a table, for the known UBVRIJHK and ugrizy bandpasses. Note that lower-case ugrizy are LSST bandpasses with an AB calibration, while upper-case UBVRIJHK are Johnson-Cousins bandpasses with a Vega calibration. For many applications, the distinction is unimportant, but pynbody can also generate absolute fluxes from AB-calibrated bandpasses.

Customizing the SSP tables#

The SSP tables provided are computed using CMD 3.7 from the Padova group, via the web interface at http://stev.oapd.inaf.it/cgi-bin/cmd_3.7 . There are a number of reasons why you may wish to use a custom set of SSPs:

  • You wish to use a different set of stellar evolution assumptions;

  • You wish to use a different set of bandpasses;

  • You wish to assume a different IMF;

  • You wish to include interstellar dust extinctions (by default, only circumstellar dust is included, and dust extinction is optionally applied separately when rendering images; see the pynbody.plot.stars.render() documentation for more information).

If making your own tables using CMD, ensure that you opt for a grid of ages and metallicities and a single-burst stellar population for 1 Msol of stars. These crucial options are near the bottom of the web interface (as of May 2024). For the default table included with pynbody, the requested table has log(age/yr) between 6.6 and 10.2 dex in steps of 0.1 dex, and the metallicities between -2 and 0.0 dex solar in steps of 0.2 dex. Note that ages and metallicities lying outside the tabulated range are clamped to the edge of the table.

All other options are left as per the CMD 3.7 defaults in the default table.

To use your own table, you can use the use_custom_ssp_table() function. This can also be used as a context manager, so you can temporarily use a custom table for a specific calculation. See the documentation for use_custom_ssp_table() for more information.

Functions

calc_mags(simstars[, band, cmd_path])

Calculate the magnitude of stars in a simulation

get_current_ssp_table()

Get the current preferred SSP table for calculating magnitudes

half_light_r(sim[, band, cylindrical])

Calculate half-light radius

halo_lum(sim, band[, physical_units])

Calculate a total spectral density in a given bandpass for a halo.

halo_mag(sim[, band])

Calculate the absolute magnitude of the provided halo (or other collection of particles)

use_custom_cmd(path)

Deprecated alias for use_custom_ssp_table()

use_custom_ssp_table(path_or_table)

Specify a custom SSP table for calculating magnitudes.

Classes

ArchivedSSPTable(path)

An SSP table from a pynbody v1 archive

MultiSSPTable(*tables)

Combines multiple SSP tables, each of which must offer different bandpasses

SSPTable(ages, metallicities, magnitudes[, ...])

An SSP table for interpolating magnitudes from stellar populations

SSPTableContext(ssp_table)

Context manager for temporarily using a custom SSP table

StevSSPTable(path[, ignore_bands])

An SSP table from the output of the STEV/CMD web interface