analysis.spectra_chisq

The spectra_chisq module calculates the chi-squared values for modeled spectra.

This module is incomplete. It does not consider color warping.

Function Documentation

analysis.spectra_chisq.band_limits(band_name, trans_limit)[source]

Return wavelength range where a band is above a given transmission

Parameters:
  • band_name (str) – Name of an sncosmo registered band
  • trans_limit (float) – The transmission limit
Returns:

The wavelengths, fluxes, and flux errors inside the bandpass

analysis.spectra_chisq.calc_chisq(wave, flux, flux_err, model_flux, start, end)[source]

Calculate the chi-squared for a spectrum within a wavelength range

Chi-squared summation includes boundary wavelengths. No assumption is made in the units of the calculation except that flux, flux_err, and model_flux all have the same units.

Parameters:
  • wave (ndarray) – An array of wavelengths
  • flux (ndarray) – An array of flux values
  • flux_err (ndarray) – An array of error values for flux
  • model_flux (ndarray) – An array of model flux values
  • start (float) – The starting wavelength for the band
  • end (float) – The ending wavelength for the band
Returns:

A dictionary with the chi_squared value in each band

analysis.spectra_chisq.tabulate_chisq(data_release, models, err_estimate=0.03, features=None, bands=None, trans_limit=0.1, out_path=None)[source]

Tabulate band specific chi-squared values for spectroscopic observations

If bands and trans_limit are given then the chi-squared is determined per band over the wavelength range where the transmission is above trans_limit. Specifying bands = 'all' will calculate the chi-squared for the entire spectrum.

If features is given, then the chi-squared is determined per feature. See analysis.equivalent_width.features for an example.

Error in the flux is assumed to be a fraction of the observed flux. Defaults assume a 3% error in observed spectra.

Parameters:
  • data_release (module) – An sndata data release
  • models (list) – List of sncosmo models
  • err_estimate (float) – Error estimate for spectra as fraction of flux
  • bands (list) – A list of band names
  • trans_limit (float) – Transmission limit for defining band wave range
  • features (dict) – Dictionary of feature names and meta data
  • out_path (str) – Optionally write results to file
Returns:

An astropy table of chi-squared values