pPXF

Module for running pPXF analyses

frb.galaxies.ppxf.run(spec_file, R, zgal, results_file=None, spec_fit='tmp.fits', chk=True, flux_scale=1.0, atmos=[], gaps=[], wvmnx=(0.0, 1000000000.0))[source]

Wrapper for running and handling outputs

Outputs are written to disk

Args:
  • spec_file (str or XSpectrum1D)

  • R (float)

  • zgal (float)

  • results_file (str, optional)

  • spec_fit

  • chk

  • flux_scale

  • atmos (list of tuple) – List of (wvmin,wvmax) regions to mask during the analysis This is a list of lists, e.g. [[7150., 7300.]]

  • gaps (list) – Regions to ignore due to detector gaps or any other bad regions This is a list of lists, e.g. [[6675., 6725.]]

  • wvmnx

frb.galaxies.ppxf.fit_spectrum(spec, zgal, specresolution, tie_balmer=False, miles_dir=None, rebin=True, limit_doublets=False, degree_add=None, degree_mult=5, **kwargs)[source]

This is a wrapper for pPXF to fit stellar population models as well as emission lines to galaxy spectra. Although pPXF allows otherwise, the emission lines are kinematically fixed to one another as are the stellar models, and the stars and gas independently vary with one another.

Please see the pPXF documentation for more details on the vast array of parameters and options afforded by the software.

The pPXF software may be downloaded at http://www-astro.physics.ox.ac.uk/~mxc/software/

Parameters:
  • spec (XSpectrum1D) – Spectrum to be fitted

  • zgal (float) – Redshift of galaxy

  • specresolution (float) – Spectral resolution (R) of the data

  • tie_balmer (bool, optional) – Assume intrinsic Balmer decrement. See documentation in ppxf_util.py, as this has implications for the derived reddening.

  • limit_doublets (bool, optional) – Limit the ratios of [OII] and [SII] lines to ranges allowed by atomic physics. See documentation in ppxf_util.py, as this has implications for getting the true flux values from those reported.

  • degree_add (int, optional) – Degree of the additive Legendre polynomial used to modify the template continuum in the fit.

  • degree_mult (int,optional)

  • miles_dir (str, optional) – Location of MILES models

Returns:

  • ppfit (ppxf) – Object returned by pPXF; attributes are data pertaining to the fit

  • miles (miles) – Contains information about the stellar templates used in the fit. See the documentation in miles_util.py for full details

  • weights (1d numpy vector) – Weights of the stellar template components. Equivalent to the first N elements of ppfit.weights where N is the number of stellar templates used in the fit.

frb.galaxies.ppxf.total_mass(miles, weights, quiet=False)[source]

Computes the total mass of living stars and stellar remnants in models fitted, given the weights produced and output by pPXF.

A Salpeter IMF is assumed (slope=1.3) initially. TODO: Employ Chabrier models. The returned mass excludes the gas lost during stellar evolution.

This procedure uses the mass predictions from Vazdekis+12 and Ricciardelli+12 http://adsabs.harvard.edu/abs/2012MNRAS.424..157V http://adsabs.harvard.edu/abs/2012MNRAS.424..172R they were downloaded in December 2016 below and are included in pPXF with permission http://www.iac.es/proyecto/miles/pages/photometric-predictions/based-on-miuscat-seds.php

Parameters:
  • miles (miles) – Miles object output from fit_spectrum()

  • weights (1d numpy array) – Weights vector corresponding to stellar templates. Output from fit_spectrum()

  • quiet (bool, optional) – If True, do not print stellar mass result

Returns:

mass_no_gas – Total stellar mass of templates fitted. NOTE: this value will generally need to be scaled if there is any mismatch in units between data and models. The MILES model spectra are generally given in units of L_sun/M_sun/Angstrom

Return type:

float

frb.galaxies.ppxf.dump_bestfit(ppfit, outfile=None, z=0.0)[source]

Create the bestfit in the observer frame and with vacuum wavelengths

Parameters:
  • ppfit

  • outfile

Returns:

bestfit

Return type:

XSpectrum1D

frb.galaxies.ppxf.dump_ppxf_results(ppfit, miles, z, outfile)[source]

Write the stnadard results and the gas_component measurements to a simple ASCII file

Parameters:
  • ppfit (ppxf)

  • outfile (str)

class frb.galaxies.ppxf.ppxfFit(ppfit, miles, weights)[source]

Bases: object

__init__(ppfit, miles, weights)[source]

Stripped down class of pPXf fit attributes to improve load times and data management.

Parameters:
  • ppfit (ppxf) – pPXF object output from fit_spectrum()

  • miles (miles) – Miles object output from fit_spectrum()

  • weights (array) – Weights on stellar pop models in fit; output from fit_spectrum()

Returns:

mass_no_gas – Total stellar mass of templates fitted. NOTE: this value will generally need to be scaled if there is any mismatch in units between data and models. The MILES model spectra are generally given in units of L_sun/M_sun/Angstrom

Return type:

float

Note

This module requires the optional ppxf package. Install with: pip install ppxf