Skip to main content

pPXF: Full Spectrum Fitting of Galactic and Stellar Spectra

Project description

Full Spectrum Fitting of Galactic and Stellar Spectra

https://img.shields.io/pypi/v/ppxf.svg https://img.shields.io/badge/arXiv-1607.08538-orange.svg https://img.shields.io/badge/DOI-10.1093/mnras/stw3020-blue.svg

This pPXF package contains a Python implementation of the Penalized PiXel-Fitting (pPXF) method to fit the stellar and gas kinematics, as well as the stellar population of galaxies. The method was originally described in Cappellari & Emsellem (2004) and was significantly upgraded in Cappellari (2017).

Attribution

If you use this software for your research, please cite Cappellari (2017). The BibTeX entry for the paper is:

@ARTICLE{Cappellari2017,
    author = {{Cappellari}, M.},
    title = "{Improving the full spectrum fitting method:
        accurate convolution with Gauss-Hermite functions}",
    journal = {MNRAS},
    eprint = {1607.08538},
    year = 2017,
    volume = 466,
    pages = {798-811},
    doi = {10.1093/mnras/stw3020}
}

Installation

install with:

pip install ppxf

Without writing access to the global site-packages directory, use:

pip install --user ppxf

Usage examples

To learn how to use the main program pPXF run the example programs in the ppxf/examples directory and read the detailed documentation at the top of the file ppxf.py.

Problems with your first fit?

Common problems with your first pPXF fit are caused by incorrect wavelength ranges or different velocity scales between galaxy and templates. To quickly detect these problems try to overplot the (log rebinned) galaxy and the template just before calling the pPXF procedure.

You can use something like the following Python lines while adjusting the smoothing window and the pixels shift. If you cannot get a rough match by eye it means something is wrong and it is unlikely that pPXF (or any other program) will find a good match:

import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage

sigma = 2       # Velocity dispersion in pixels
shift = -20     # Velocity shift in pixels
template = np.roll(ndimage.gaussian_filter1d(template, sigma), shift)
plt.plot(galaxy, 'k')
plt.plot(template*np.median(galaxy)/np.median(template), 'r')

How to set regularization

The pPXF routine can give sensible quick results with the default BIAS parameter, however, like in any penalized/filtered/regularized method, the optimal amount of penalization generally depends on the problem under study.

The general rule here is that the penalty should leave the line-of-sight velocity-distribution (LOSVD) virtually unaffected, when it is well sampled and the signal-to-noise ratio (S/N) is sufficiently high.

EXAMPLE: If you expect an LOSVD with up to a high h4~0.2 and your adopted penalty biases the solution towards a much lower h4~0.1 even when the measured sigma > 3*velScale and the S/N is high, then you are misusing the pPXF method!

THE RECIPE: The following is a simple practical recipe for a sensible determination of the penalty in pPXF:

  1. Choose a minimum (S/N)_min level for your kinematics extraction and spatially bin your data so that there are no spectra below (S/N)_min;

  2. Perform a fit of your kinematics without penalty (pPXF keyword BIAS=0). The solution will be noisy and may be affected by spurious solutions, however this step will allow you to check the expected mean ranges in the Gauss-Hermite parameters [h3,h4] for the galaxy under study;

  3. Perform a Monte Carlo simulation of your spectra, following e.g. the included ppxf_simulation_example.pro routine. Adopt as S/N in the simulation the chosen value (S/N)_min and as input [h3, h4] the maximum representative values measured in the non-penalized pPXF fit of the previous step;

  4. Choose as penalty (BIAS) the largest value such that, for sigma > 3*velScale, the mean difference between the output [h3, h4] and the input [h3, h4] is well within the rms scatter of the simulated values (see e.g. Fig.2 of Emsellem et al. 2004).

License

Copyright (c) 2001-2018 Michele Cappellari

This software is provided as is without any warranty whatsoever. Permission to use, for non-commercial purposes is granted. Permission to modify for personal or internal use is granted, provided this copyright and disclaimer are included in all copies of the software. All other rights are reserved. In particular, redistribution of the code is not allowed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ppxf-6.7.8.tar.gz (3.2 MB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page