velociraptor.tools.luminosity_functions module

Tools for creating luminosity functions!

velociraptor.tools.luminosity_functions.create_luminosity_function_given_bins(luminosities: unyt.array.unyt_array, bins: unyt.array.unyt_array, box_volume: unyt.array.unyt_quantity, minimum_in_bin: int = 3)[source]

Creates a luminosity function (with equal width bins magnitudes) for you to plot.

Parameters:
  • luminosities (unyt.unyt_array) – The array that you want to create a luminosity function of (usually this is for example the stellar luminosities).
  • bins (unyt.unyt_array) – The magnitude bin edges to use.
  • unyt.unyt_quantity (box_volume) – The volume of the box such that we can return n / volume.
  • minimum_in_bin (int, optional) – The number of objects in a bin for it to be classed as valid. Bins with a number of objects smaller than this are not returned. By default this parameter takes a value of 3.
Returns:

  • bin_centers (unyt.unyt_array) – The centers of the bins (taken to be the linear mean of the bin edges).
  • luminosity_function (unyt.unyt_array) – The value of the luminosity function at the bin centers.
  • error (unyt.unyt_array) – Scatter in the luminosity function (Poisson errors).

velociraptor.tools.luminosity_functions.create_luminosity_function(luminosities: unyt.array.unyt_array, lowest_magnitude: unyt.array.unyt_quantity, highest_magnitude: unyt.array.unyt_quantity, box_volume: unyt.array.unyt_quantity, n_bins: int = 25, minimum_in_bin: int = 3, return_bin_edges: bool = False)[source]

Creates a luminosity function (with equal width bins in log M) for you to plot.

Parameters:
  • luminosities (unyt.unyt_array) – The array that you want to create a luminosity function of (usually this is for example stellar luminosities).
  • lowest_magnitude (unyt.unyt_quantity) – the lowest magnitude edge of the bins
  • highest_magnitude (unyt.unyt_quantity) – the highest magnitude edge of the bins
  • box_volume (unyt.unyt_quantity) – The volume of the box such that we can return n / volume.
  • n_bins (unyt.unyt_array) – The number of equal log-width bins across the range to use.
  • minimum_in_bin (int, optional) – The number of objects in a bin for it to be classed as valid. Bins with a number of objects smaller than this are not returned. By default this parameter takes a value of 3.
  • return_bin_edges (bool, optional) – Return the bin edges used in the binning process? Default is False.
Returns:

  • bin_centers (unyt.unyt_array) – The centers of the bins (taken to be the linear mean of the bin edges).
  • luminosity_function (unyt.unyt_array) – The value of the luminosity function at the bin centers.
  • error (unyt.unyt_array) – Scatter in the luminosity function (Poisson errors).
  • bin_edges (unyt.unyt_array, optional) – Bin edges that were used in the binning process.