Fitting stellar spectra with some help from Gaussian processes


Wednesday June 18th, 2014

Ian Czekala


  • the fundamental parameters of stars
  • some problems with fitting spectra
  • how Gaussian processes can help
  • some interesting applications

Fundamental parameters of stars

  • $M_\star$
  • $T_{\rm eff}$
  • $\log g$
  • $[{\rm Fe}/{\rm H}]$

Stellar evolution

Models make predictions of stellar properties as a function of mass and age. This relationship is rather uncertain for young stars.

Exoplanet properties

Determined relative to host star properties, and biases or uncertainties strongly affect habitable zone and $\eta_\bigoplus$ (Kane11)

My thesis: Fundamental Properties of Young Stars

Part I: Mass

Sub-mm interferometric observations of stars with circumstellar disks. Use Keplerian rotation to derive a very precise and accurate stellar mass ($< 5$%) (Rosenfeld+12)

My thesis: Fundamental Properties of Young Stars

Part II: The other properties

There are many ways to determine
$\{ T_{\rm eff}, \log g, [{\rm Fe}/{\rm H}] \}$

Depending on your desired precision and the nature of your target, you can use photometric colors, astroseismology, optical/IR interferometry, or spectroscopy.

By far, spectroscopic inference is the most prevalent and general purpose (e.g., spectral typing).

To leverage the high quality synthetic spectra that now exist, we develop a forward model of the observed stellar spectrum.

fitting spectra

  • use as much of the spectrum as possible
  • explore lots of parameters
  • spectral synthesis is computationally difficult
  • use pre-synthesized stellar grids $\{ T_{\rm eff}, \log g, [{\rm Fe}/{\rm H}] \}$
  • interpolate spectrum from the grid and post-process to make it look like the data

The problem in a nutshell

Spectroscopic fits are different from "normal" $ \chi^2$ fits

The problem in a nutshell

Existing stellar synthesis is amazing, but not perfect.

  1. low scale, mild residual structure
  2. "outlier" spectral lines with the wrong strength

How can you fit ~1,000 or more lines
with only a few parameters?

Spectral lines are the fundamental "data points"

a "good" fit


Fitting spectra $\ne$ vanilla $\chi^2$

  • the fundamental "data point" of a spectrum is a spectral line
  • when the strength of a line is incorrect, it causes several correlated pixel residuals
  • you are saved only if your model is perfect
  • with any large swath of spectrum,
failure perfection is not an option
Apollo 13
or at least very difficult to attain in practice


Gaussian processes

can help

How to cope with imperfection

the residuals are a spectrum $\textbf{R}$

the pixel "variances" are now a covariance matrix $C$

$$p(D | \theta) = \frac{1}{\sqrt{(2 \pi)^N \det(C)}} \exp\left ( -\frac{1}{2} \textbf{R}^T C^{-1} \textbf{R} \right ) $$

$$ \ln[p(D | \theta)] = -\frac{1}{2} \textbf{R}^T C^{-1} \textbf{R} - \frac{1}{2} \ln \det C - \frac{N}{2} \ln 2 \pi $$

the structure of $C$ is set by a kernel function analogous, say, to the two-point correlation function

Matérn $\nu = 3/2$

$k(\lambda_i, \lambda_j | a, l) = a \left (1 + \frac{\sqrt{3} r_{ij}}{l} \right ) \exp \left ( - \frac{\sqrt{3} r_{ij}}{l} \right )$

This covariance matrix accounts for the "global" correlated structure of the residuals

$\sim 5$ pixels correlated

Taste test

Spectral line outliers

A strong outlier generally looks like a Gaussian $\textbf{R}_\lambda(a, \mu, \sigma) = \frac{a}{\sqrt{2 \pi} \sigma} \exp \left ( - \frac{r^2(\lambda,\, \mu)}{2 \sigma^2} \right ) $

covariance kernel is

$k(\lambda_i, \lambda_j) = \langle \textbf{R}_i \textbf{R}_j \rangle$

$k(\lambda_i, \lambda_j | a, \mu, \sigma) = \frac{1}{2 \pi} \left ( \frac{a}{\sigma} \right)^2 \exp \left ( - \frac{r^2(\lambda_i,\, \mu) + r^2(\lambda_j,\, \mu)}{2 \sigma^2} \right ) $

Downweight outlier lines

Stellar posteriors

(courtesy dfm/ and dfm/emcee)

  • sample the stellar and covariance parameters with MH/Gibbs sampler
  • posteriors naturally inflate to capture uncertainty in model
  • preserves parameter degeneracies
  • tested against main sequence stars (Cushing+05, Rayner+09, Torres+12)

"Global" Hyperparameters

  • covariance hyperparameters are self-consistently determined
  • higher quality libraries of synthetic spectra yield lower "noise"
  • each outlier line also has its own set of hyperparameters (hierarchical)


M dwarf molecular bands are hard to model

...but, some bands tell you a lot about stellar properties

We want to include these areas but weight them appropriately

Workshop topic: custom design of covariance kernels?


The Holy Grail

and the quest for it

  1. fit many stellar spectra ($N > 50$)
  2. learn the covariance structure; the locations of the outlier lines
  3. use the information in the covariance matrix and the ensemble of real stars to infer (learn) what the models should be

    This is not unlike how $UBVRI$ photometric passbands
    are regressed out (Bessell & Simon 2012)

Pass this along to the stellar modellers.

If you're impatient/a DIY-er, you can create your own self-calibrated semi-empirical libraries of pseudo-synthetic spectra.


  • new framework for unbiased inference of stellar parameters from spectra
  • covariance kernels can help account for systematic model-data mismatch
  • applications from FKG stars to M dwarfs
  • given many stars, this framework presents a way to improve the stellar models while you fit
  • code will be released with the upcoming paper

Thank you!

Outlier line hyperparameters

  • covariance hyperparameters are sampled self-consistently
  • better models have fewer outliers
  • $h$ is a dummy parameter at this point