pynbody.plot.stars.sfh

Contents

pynbody.plot.stars.sfh#

pynbody.plot.stars.sfh(sim, massform=True, trange=None, bins=100, **kwargs)[source]#

Make a star formation history plot.

By default, sfh will use the formation mass of the star. In tipsy, this will be taken from the starlog file. Set massform=False if you want the final (observed) star formation history

Changed in version 2.0: The subplot, filename, legend and clear arguments have been removed. Set up axes as needed using the standard matplotlib commands.

The return arrays have been swapped (i.e. time bins are now the first return value), to be consistent with other histogram routines.

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

  • massform (bool, default True) – Decides whether to use original star mass (massform) or final star mass. Default is True. If True and the massform array cannot be found, the final star mass is used instead (and a warning issued).

  • trange (list, array, or tuple, optional) – Specifies the time range over which to plot the SFH in Gyr. Default is the full range of the simulation.

  • bins (int, default 100) – Number of bins to use for the SFH. Default is 100.

  • **kwargs – Additional keyword arguments are passed to the matplotlib hist function.

Returns:

  • tbins (array.SimArray) – Array of time bin edges in Gyr

  • sfh (array.SimArray) – Array of star formation rates in Msol/yr