(old) Usage

For code version 2.0 (old release)

go here for recent versions

Setup of model data

  1. Download the base data archive (here). Set an environement variable PATHMODEL pointing to the snfit_data directory.
  2. Download some instruments (here) and save them in the snfit_data directory. Edit snfit_data/fitmodel.card to point to the instruments. The key name has to match the one in the lightcurve.
  3. Download SALT2 (or/and SALT1) templates (salt2_model_data-[version].tar.gz and/or salt_model_data-1-0.tar.gz), save them in the snfit_data directory, and edit snfit_data/fitmodel.card.

Installation of the code

tar zxvf snfit_src-[version].tar.gz
cd snfit
configure --prefix=[where_you_want]
make install

For mac intel, try :

configure --prefix=[where_you_want] --enable-gfortran

(S. Bailey needed to set environment variable MACOSX_DEPLOYMENT_TARGET=10.3 despite the fact that he runs Mac OS 10.4)

Download the file install-salt2.0.sh in the directory where you want to install the package and execute it (you need to do a chmod u+x install-salt2.0.sh first, you also need to have wget installed). The versions that are proposed here for download are the ones used in Guy et al. (2007), with compilation bug fixes but there might be newer versions of any of those files today. So this installation script should be considered as an example for a complete installation and test.

Light curves Input format

Assumed format (if you want to use another one, edit the MeasuredData class) : One directory per supernova containing :

  • lightfile (ASCII file with redshift, Galactic E(B-V), …)
  • Several light curve files for each instrument/filter.

Example, files :


lightfile :

NAME           1994D
RA             12:34:02.3950
DEC            +07:42:05.700
EPOCH          2000.0
Redshift       0.00266901307822
z_heliocentric 0.001494
z_cmb          0.00266901307822
MWEBV          0.02228

1994D/lc2fit_B.dat :

#Date :
#Mag :
#Magerr :
#end :
49420.900000 14.230000 0.001943
49422.830000 13.290000 0.001175
49423.900000 12.890000 0.000907

(INSTRUMENT name matches entry in fitmodel.card, BAND is one the bands listed in snfit_data/Instruments/Landolt-1/FilterWheel)

There is also a lightcurve format with fluxes, errors and zero points.

Example, SNLS-03D4ag/lc2fit_g.dat :

@WEIGHTMAT flux_per_night_weightmat_g.dat
#Date :
#Flux :
#Fluxerr :
#ZP :
176.54 10267.351 95.517 32.2024 
185.59 24423.189 102.738 32.2024 
212.53 6733.480 144.903 32.2024 

(Here, an additional file is mentionned : the covariance matrix of the flux measurements)

Usage of the lightcurve fitter

By default SALT1 is used. Use option -m salt2 for SALT2. Options -e and -k permit to propagate the model uncertainties (diagonal and k-correction uncertainties, see section 6 of the paper).

snfit lightcurve1 lightcurve2 ... 
-s spectrum_file_name    : fit this spectrum as well
-m modelname             : salt or salt2, default is salt(1)
-1                       : only one obsevred band fitted 
-2                       : max 2 observed band fitted 
-3                       : max 3 observed band fitted 
-r  phasemin phasemax    : range of phases to be fitted (default is -15,+40)
-f stretch/color/daymax/X1/gtype ...        : fix a value 
-p stretch/color/daymax/...      : add a prior 
-f X{0,1,2,3,4}  value   : for salt2
-z                       : fit redshift
-i z value               : initial value of redshift
-c #                     : number of calib. params. for spectra (def 1)
-w wmin wmax             : allow SALT1/2 to fit in this wavelength range
-e                       : use (diagonal) model uncertainties in chi2 
-E                       : apply error floor for nearby SNe 
-k                       : use k-correction uncertainties in chi2 
-U  #                    : add obs. U-band calib. error
-M                       : run minos at the end

Combination of options used in Guy et al (2007) :

snfit lc2fit*.dat -r -15 +45 -f rv 3.1 -f ebv 0 -m salt2 -e -k -U 0.085 -f X2 0 -w 2900 7000

Warning : In order to find the same results using salt1 with this code compared to versions For photometric redshifts, you need to give an initial value using option -i z # so that when the code checks the lightcurves for which it can provide a model, it does not discard all of them (default redshift is 0.05)!

You can write the lightcurves of the model with snlc :

snlc writes an ASCII file with the lightcurve of the model
usage : snlc lightcurve1 lightcurve2 ... -p filename

filename is the path of the output file of snfit: (i.e. result_salt.dat or result_salt2.dat)