snpy.CSPtemp package

Module contents

A python module to generate lightcurve templates. 2nd generation, based on DR2 Author: Chris Burns Version: 0.2

This module provides an object called template. You create any number of these and then simply ask it to generate a template of a given dm15 and then you can evaluate that template at any time you like. This is not a natural way to do things, but it keeps it comaptible with the other dm15temp module I made for Prieto’s templates.

Another template, based on stretch, is also defined now and is based on the observation that (B-V) color curves have a well-defined maximum. We define the stretch as the time of this maximum divided by 30 days.

Example: >>> import CSPtemp >>> t = CSPtemp.dm15_template() >>> t.mktemplate(1.6) >>> flux,e_flux,mask = t(‘B’, arange(-10, 70, 1.0))

>>> t = CSPtemp.s_template()
>>> t.mktemplate(1.1)
>>> flux,e_flux,mask = t('B', arange(-10, 70, 1.0))

Here, we create an instance of the template, ask it to generate a lc template with dm15 = 1.6, then we evaluate the flux on the interval [-10,70] in steps of 1 day. It returns a 3-tuple: flux (normalized to peak of 1.0), error in flux and a mask. The mask is 1 where the template is well-behaved (you could, afterall ask for a template that goes to day 1000, but its mask value will be 0, because we have no constraining data there).

NEW: Using GLOES is rather slow and expensive. However, you can always generate the surface and fit it with a bi-variate spline, capturing the information, but making things far faster. Now, we check to see if the tck in a file tck.pickle is available. If so, then use this instead of calling gloes.

snpy.CSPtemp.breakpoly(x, xb, coefs, before=True)
snpy.CSPtemp.dm152s(dm15)

Convert from dm15 parameter to stretch.

class snpy.CSPtemp.dm15_template
deltaTmax(band)

Given the current dm15, what is the time of maximum of [band] relative to B-band.

eval(band, times, z=0, mag=1, sextrap=1, gen=1, toff=True, extrap=False)

Evaluate the template in band [band] at epochs [times]. Optionally redshift by (1+[z]). If [mag]=1, return in magnitudes, otherwise return in flux units. If [sextrap]=1, extrapolate beyond the training sample by using a stretch. Use [gen] to specifiy the generation of the template. If you want the Tmax - Tmax(B) offset applied, set [toff] to True, otherwise, Tmax will be at 0 for every filter.

mktemplate(dm15, dm15_int=None, dm15_colors='int', generate=0)

2nd and 3rd arguments ignored.

teval(band, time, dm15, gen=1)
snpy.CSPtemp.finterp(band, t, p, param, gen, extrap=False)

interpolate at time t and param p for param,gen combo.

snpy.CSPtemp.get_p_lim(band, param, gen)
snpy.CSPtemp.get_t_lim(band, param, gen)

Get the limit in time-space for trusting the templates.

snpy.CSPtemp.load_data(band, param='dm15', gen=1)

Given a band param and generation of template generator, load the appropriate data and create a inter2D instance.

snpy.CSPtemp.poly(x, x0, coefs)
class snpy.CSPtemp.st_template
deltaTmax(band)

Given the current dm15, what is the time of maximum of [band] relative to B-band.

eval(band, times, z=0, mag=1, sextrap=1, gen=1, toff=True, extrap=False)

Evaluate the template in band [band] at epochs [times]. Optionally redshift by (1+[z]). If [mag]=1, return in magnitudes, otherwise return in flux units. If [sextrap]=1, extrapolate beyond the training sample by using a stretch. Use [gen] to specifiy the generation of the template. If you want the Tmax - Tmax(B) offset applied, set [toff] to True, otherwise, Tmax will be at 0 for every filter.

mktemplate(st, dm15_int=None, dm15_colors='int', generate=0)

2nd and 3rd arguments ignored.

teval(band, time, st, gen=1)