Reference / API

Model & Components

Model(source[, effects, effect_names, …])

An observer-frame model, composed of a Source and zero or more effects.

Source component of Model

Source()

An abstract base class for transient models.

TimeSeriesSource(phase, wave, flux[, …])

A single-component spectral time series model.

StretchSource(phase, wave, flux[, name, version])

A single-component spectral time series model, that “stretches” in time.

MLCS2k2Source(fluxfile[, name, version])

A spectral time series model based on the MLCS2k2 model light curves, using the Hsiao template at each phase, mangled to match the model photometry.

SALT2Source([modeldir, m0file, m1file, …])

The SALT2 Type Ia supernova spectral timeseries model.

SALT3Source([modeldir, m0file, m1file, …])

The SALT3 Type Ia supernova spectral timeseries model.

SNEMOSource(fluxfile[, name, version])

The SNEMO Type Ia supernova spectral timeseries model

SUGARSource([modeldir, m0file, alpha1file, …])

The SUGAR Type Ia supernova spectral time series template.

Effect components of Model: interstellar dust extinction

PropagationEffect()

Abstract base class for propagation effects.

CCM89Dust()

Cardelli, Clayton, Mathis (1989) extinction model dust.

OD94Dust()

O’Donnell (1994) extinction model dust.

F99Dust([r_v])

Fitzpatrick (1999) extinction model dust with fixed R_V.

Bandpass & Magnitude Systems

Bandpass(wave, trans[, wave_unit, …])

Transmission as a function of spectral wavelength.

AggregateBandpass(transmissions[, …])

Bandpass defined by multiple transmissions in series.

BandpassInterpolator(transmissions, …[, …])

Bandpass generator defined as a function of focal plane position.

MagSystem([name])

An abstract base class for magnitude systems.

ABMagSystem([name])

Magnitude system where a source with F_nu = 3631 Jansky at all frequencies has magnitude 0 in all bands.

SpectralMagSystem(refspectrum[, name])

A magnitude system defined by a fundamental spectrophotometric standard.

CompositeMagSystem([bands, families, name])

A magnitude system defined in a specific set of bands.

I/O

Functions for reading and writing photometric data, gridded data, extinction maps, and more.

read_lc(file_or_dir[, format])

Read light curve data for a single supernova.

write_lc(data, fname[, format])

Write light curve data.

read_bandpass(fname[, fmt, wave_unit, …])

Read bandpass from two-column ASCII file containing wavelength and transmission in each line.

load_example_data()

Load an example photometric data table.

load_example_spectrum_data()

Load example spectrum data.

read_snana_ascii(fname[, default_tablename])

Read an SNANA-format ascii file.

read_snana_fits(head_file, phot_file[, snids, n])

Read the SNANA FITS format: two FITS files jointly representing metadata and photometry for a set of SNe.

read_snana_simlib(fname)

Read an SNANA ‘simlib’ (simulation library) ascii file.

read_griddata_ascii(name_or_obj)

Read 2-d grid data from a text file.

read_griddata_fits(name_or_obj[, ext])

Read a multi-dimensional grid of data from a FITS file, where the grid coordinates are encoded in the FITS-WCS header keywords.

write_griddata_ascii(x0, x1, y, name_or_obj)

Write 2-d grid data to a text file.

write_griddata_fits(x0, x1, y, name_or_obj)

Write a 2-d grid of data to a FITS file

Spectra

Spectrum([wave, flux, fluxerr, fluxcov, …])

An observed spectrum of an object.

Fitting Photometric Data

Estimate model parameters from photometric data

fit_lc([data, model, vparam_names, bounds, …])

Fit model parameters to data by minimizing chi^2.

mcmc_lc(data, model, vparam_names[, bounds, …])

Run an MCMC chain to get model parameter samples.

nest_lc(data, model, vparam_names, bounds[, …])

Run nested sampling algorithm to estimate model parameters and evidence.

Convenience functions

select_data(data, index)

Convenience function for indexing photometric data with covariance.

chisq(data, model[, modelcov])

Calculate chisq statistic for the model, given the data.

flatten_result(res)

Turn a result from fit_lc into a simple dictionary of key, value pairs.

Plotting

Convenience functions for quick standard plots (requires matplotlib)

plot_lc([data, model, bands, zp, zpsys, …])

Plot light curve data or model light curves.

Simulation

zdist(zmin, zmax[, time, area, ratefunc, …])

Generate a distribution of redshifts.

realize_lcs(observations, model, params[, …])

Realize data for a set of SNe given a set of observations.

Registry

Register and retrieve custom built-in sources, bandpasses, and magnitude systems

register(instance[, name, data_class, force])

Register a class instance.

register_loader(data_class, name, func[, …])

Register a data reading function.

get_source(name[, version, copy])

Retrieve a Source from the registry by name.

get_bandpass(name, *args)

Get a Bandpass from the registry by name.

get_magsystem(name)

Get a MagSystem from the registry by name.

Class Inheritance Diagrams

Inheritance diagram of models, magsystems, bandpasses