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, **kwargs)

Get a Bandpass from the registry by name.

get_magsystem(name)

Get a MagSystem from the registry by name.

Class Inheritance Diagrams

digraph inheritancee1d2e41539 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABMagSystem" [URL="api/sncosmo.ABMagSystem.html#sncosmo.ABMagSystem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Magnitude system where a source with F_nu = 3631 Jansky at all"]; "MagSystem" -> "ABMagSystem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AggregateBandpass" [URL="api/sncosmo.AggregateBandpass.html#sncosmo.AggregateBandpass",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Bandpass defined by multiple transmissions in series."]; "Bandpass" -> "AggregateBandpass" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Bandpass" [URL="api/sncosmo.Bandpass.html#sncosmo.Bandpass",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Transmission as a function of spectral wavelength."]; "BandpassInterpolator" [URL="api/sncosmo.BandpassInterpolator.html#sncosmo.BandpassInterpolator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Bandpass generator defined as a function of focal plane position."]; "C11" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="C11 scattering effect for sncosmo."]; "PropagationEffect" -> "C11" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CCM89Dust" [URL="api/sncosmo.CCM89Dust.html#sncosmo.CCM89Dust",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Cardelli, Clayton, Mathis (1989) extinction model dust."]; "PropagationEffect" -> "CCM89Dust" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CompositeMagSystem" [URL="api/sncosmo.CompositeMagSystem.html#sncosmo.CompositeMagSystem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="CompositeMagSystem(bands=None, families=None, name=None)"]; "MagSystem" -> "CompositeMagSystem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "F99Dust" [URL="api/sncosmo.F99Dust.html#sncosmo.F99Dust",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Fitzpatrick (1999) extinction model dust with fixed R_V."]; "PropagationEffect" -> "F99Dust" [arrowsize=0.5,style="setlinewidth(0.5)"]; "G10" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Guy (2010) SNe Ia non-coherent scattering."]; "PropagationEffect" -> "G10" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GeneralBandpassInterpolator" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A general-purpose interpolator for bandpasses with spatial or"]; "MLCS2k2Source" [URL="api/sncosmo.MLCS2k2Source.html#sncosmo.MLCS2k2Source",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A spectral time series model based on the MLCS2k2 model light curves,"]; "Source" -> "MLCS2k2Source" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MagSystem" [URL="api/sncosmo.MagSystem.html#sncosmo.MagSystem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An abstract base class for magnitude systems."]; "Model" [URL="api/sncosmo.Model.html#sncosmo.Model",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An observer-frame model, composed of a Source and zero or more effects."]; "OD94Dust" [URL="api/sncosmo.OD94Dust.html#sncosmo.OD94Dust",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="O'Donnell (1994) extinction model dust."]; "PropagationEffect" -> "OD94Dust" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PropagationEffect" [URL="api/sncosmo.PropagationEffect.html#sncosmo.PropagationEffect",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for propagation effects."]; "SALT2Source" [URL="api/sncosmo.SALT2Source.html#sncosmo.SALT2Source",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The SALT2 Type Ia supernova spectral timeseries model."]; "Source" -> "SALT2Source" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SALT3Source" [URL="api/sncosmo.SALT3Source.html#sncosmo.SALT3Source",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The SALT3 Type Ia supernova spectral timeseries model."]; "SALT2Source" -> "SALT3Source" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SNEMOSource" [URL="api/sncosmo.SNEMOSource.html#sncosmo.SNEMOSource",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The SNEMO Type Ia supernova spectral timeseries model"]; "Source" -> "SNEMOSource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SUGARSource" [URL="api/sncosmo.SUGARSource.html#sncosmo.SUGARSource",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The SUGAR Type Ia supernova spectral time series template."]; "Source" -> "SUGARSource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Source" [URL="api/sncosmo.Source.html#sncosmo.Source",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An abstract base class for transient models."]; "SpectralMagSystem" [URL="api/sncosmo.SpectralMagSystem.html#sncosmo.SpectralMagSystem",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A magnitude system defined by a fundamental spectrophotometric"]; "MagSystem" -> "SpectralMagSystem" [arrowsize=0.5,style="setlinewidth(0.5)"]; "StretchSource" [URL="api/sncosmo.StretchSource.html#sncosmo.StretchSource",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A single-component spectral time series model, that \"stretches\" in"]; "Source" -> "StretchSource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TimeSeriesSource" [URL="api/sncosmo.TimeSeriesSource.html#sncosmo.TimeSeriesSource",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A single-component spectral time series model."]; "Source" -> "TimeSeriesSource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Transforms" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Provides transformations from pixel coordinates to focal plane and"]; }