This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== Usage ====== For code version >= 2.2.0 Go [[old_usage|here]] for an older versions of this usage page for code version 2.0 (first SALT2 release) ===== Complete installation scripts ===== <color orange> Recommended if you are not familiar with the package organization and want to reproduce published results.</color> Download one of the following scripts in the directory where you want to install the package and execute it (you need to do a ''chmod u+x xxx-installation.sh'' first, you also need to have ''wget'' installed). * {{::jla-installation.sh}}, as in Betoule et al. (2014), SDSS-II/SNLS3 Joint Light-curve Analysis, [[http://supernovae.in2p3.fr/sdss_snls_jla/ReadMe.html|link to the data release page]]. * {{::snls3-installation.sh}}, as in Guy et al. (2010), SNLS 3 year analysis, [[https://tspace.library.utoronto.ca/snls/|link to the data release page]]. You can check the agreement of the content of the output file ''result_salt2.dat'' with the released result for the SN in the test directory ''result_salt2_xxx.dat''. ===== Setup of model data ===== - Create a directory (''DIR'') for the model data and set an environement variable ''SALTPATH'' (or ''PATHMODEL'' for versions < 2...) pointing to it. The code will look for a file fitmodel.card in this directory. - Download some instruments ([[instruments|here]]) and save them in the ''DIR'' directory. Edit ''DIR/fitmodel.card'' to point to the instruments. The key name has to match the one in the lightcurve. - Download magnitude systems ([[instruments|here]]) and save them in the ''DIR'' directory. Edit ''DIR/fitmodel.card'' to point to the current file describing the magnitude system (go there for more details about magnitude systems). The key name has to match the one in the lightcurve. - Download SALT2 (or/and SALT1) templates ([[salt_templates|here]]), save them in the ''DIR'' directory, and edit ''DIR/fitmodel.card''. Example: ''ls $PATHMODEL/*'' /home/guy/junk/snfit_data/fitmodel.card /home/guy/junk/snfit_data/Instruments: 4Shooter2 Bessel Keplercam NICMOS2 Sdss2.5 ACSWF Bessel-shifted-sifto MegacamVariable SWIFT Swope /home/guy/junk/snfit_data/MagSys: Vega0.dat alpha_lyr_stis_004.ascii VegaBD17-2008-11-28.dat bd_17d4708_stisnic_002.ascii /home/guy/junk/snfit_data/salt2-2-0: salt2_color_correction.dat salt2_spec_covariance_01.dat salt2_color_dispersion.dat salt2_spec_variance_0.dat salt2_lc_dispersion_scaling.dat salt2_spec_variance_1.dat salt2_lc_relative_covariance_01.dat salt2_template_0.dat salt2_lc_relative_variance_0.dat salt2_template_1.dat salt2_lc_relative_variance_1.dat ''more $PATHMODEL/fitmodel.card'' @STANDARD Instruments/Bessel-shifted-sifto @MEGACAM Instruments/MegacamVariable @KEPLERCAM Instruments/Keplercam @4SHOOTER2 Instruments/4Shooter2 @ACSWF Instruments/ACSWF @NICMOS2 Instruments/NICMOS2 @SWIFT Instruments/SWIFT @SDSS Instruments/Sdss2.5 @SWOPE Instruments/Swope @VEGA MagSys/VegaBD17-2008-11-28.dat @VEGAHST MagSys/Vega0.dat @VEGA0 MagSys/Vega0.dat @SALT2 salt2-2-0 ===== Compilation and installation of the code ===== tar zxvf snfit_src-[version].tar.gz cd snfit configure --prefix=[where_you_want] --enable-static=false make make install Version 2.2.2 tested successfully on : * Unordered List ItemLinux gcc/gfortran 4.1.2,4.2.4,4.4.1, arch: i686,x86_64 * Mac OS 10.5.8 Intel Core 2 Duo (with gfortran from here ) New: Go [[https://github.com/RuiPereira/homebrew/wiki/SALT2-on-Homebrew|here]] for an easy installation on Mac OS X using the Homebrew package manager. This installation method is maintained by Rui Pereira. Successful Homebrew installation on : * Intel Core 2 Duo with Mac OS 10.7.1 (Lion) * Intel Core 2 Duo with Mac OS 10.6.8 (Snow Leopard) Rui : 'For compilation on my Mac (and hence on the homebrew formula) I had to force $LDFLAGS with "-L/path/to/libgfortran -lgfortran"' ===== Light curves Input format ===== ==== New light curve format ==== Since ''snfit'' version 2.3, two light curve formats are now available. New light curve format (for ''snfit'' version >=2.3.0) a single light curve file for all pass bands (+ optionally a covariance matrix) ''Example lc-03D4ag.list:'' # light curves from SNLS 3 year analysis @SN 03D4ag @Z_HELIO 0.285 @MWEBV 0.0258 @X_FOCAL_PLANE 4.65855 @Y_FOCAL_PLANE -0.130529 @DayMax 52830.921 0.13672582 @COVMAT covmat_lc-03D4ag.dat @CCD 24 @DEC -17.739655 @FIELD D4 @RA 333.690959 @SELECTED_FOR_SNLS3_TRAINING 1 @SURVEY SNLS3_LC @z_source H #Date : #Flux : #Fluxerr : #ZP : #Filter : instrument and band #MagSys : magnitude system #end 52816.54 87.553312 0.76978898 27.091335 MEGACAM::g VEGA 52824.59 202.89127 0.90009357 27.091335 MEGACAM::g VEGA 52795.59 -0.18016601 1.1661804 25.913054 MEGACAM::i VEGA 52796.59 0.42716008 1.1578453 25.913054 MEGACAM::i VEGA ... There is an additional row with the ''INSTRUMENT::BAND'' with respect to the previous format (compare with ''SNLS-03D4ag/lc2fit_g.dat'' below). For this particular SNLS example, a covariance matrix ''covmat_lc-03D4ag.dat'' identified by the key ''@COVMAT'' is expected to be found in the same directory (if there is no ''@COVMAT'' key, the errors reported in the file in the row ''Fluxerr'' are used, and they are considered as uncorrelated). ==== "Old" light curve format ==== lightfile + one lightcurve file per band (+ optionally weight matrices) 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 : 1994D/lightfile 1994D/lc2fit_U.dat 1994D/lc2fit_B.dat 1994D/lc2fit_V.dat ''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 : @INSTRUMENT STANDARD @BAND B @MAGSYS VEGA 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 light curve format with fluxes, errors and zero points. Note also that there are now informations about the location of the SN in the focal plane (used in the code for the filter transmission) ''Example, SNLS-03D4ag/lc2fit_g.dat'' @INSTRUMENT MEGACAM @MAGSYS VEGA @BAND g @WEIGHTMAT flux_per_night_weightmat_g.dat #Date : #Flux : #Fluxerr : #ZP : #end 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 mentioned : the covariance matrix of the flux measurements) Usage of the light curve fitter The default values for options have changed since version 2.0 (SALT2 first release)! snfit lightcurve1 lightcurve2 ... -o filename : write output in filename instead of result_salt2.dat -m {salt,salt2} : model (default is salt2) options for data selection : -r phasemin phasemax : range of phases (default is -15,45) -w wmin wmax : wavelength range (default SALT1:3460,6600 SALT2:3000,7000) options for model parameters (need to define the model before): (for salt : DayMax Dflux Stretch Color Redshift, for salt2 : DayMax Color X0 X1 Redshift GalaxyType) -f name value : fix the value of parameter 'name' -p name mean sigma : add a gaussian prior for 'name' -i name value : initial value of parameter 'name' options for assumed uncertainties : -e (0 or 1) : (diagonal) model uncertainties in chi2 (0=no,1=yes,default=1, for salt2) -k (0 or 1) : k-correction uncertainties in chi2 (0=no,1=yes,default=1,for salt2) -U value : add observed U-band calibration error (default is 0.1) -E value : error floor to apply for nearby SNe (frac. of max flux) The default options are now the one used for the SNLS 3 year analysis: by default SALT2 is used, model uncertainties (diagonal and k-correction uncertainties) are used, the phase range is [-15,+40] days, the wavelength range is [3000,7000] A (central wavelength of the effective filter, rest-frame), a calibration uncertainty of 0.1 is considered for light curve for which the central wavelength of the effective filter is shorter than 4000 A (observer frame) (effectively impacts only U-band observations). Photometric redshifts and fit of spectroscopic data are not supported in this release. ===== Other tools ===== You can write the light curves of the model with ''snlc'' (note: you need snfit v 2.4.2 or above to run it with new lightcurve format): 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'') A simple plotter in python (requires matplotlib and numpy) can be downloaded here {{:snplot.py|}} If you have a more fancy version of it, please share it. Example : snfit jla_light_curves/lc-03D4ag.list -o res-03D4ag.txt snlc jla_light_curves/lc-03D4ag.list -p res-03D4ag.txt -o model-03D4ag.list snplot.py --data jla_light_curves/lc-03D4ag.list --model model-03D4ag.list --mag ===== Other implementations of the model and light-curve fitter ===== - [[http://das.sdss2.org/ge/sample/sdsssn/SNANA-PUBLIC|SNANA]] - [[https://sncosmo.readthedocs.org|SNCosmo]]