Simulating lightcurves for SNe IIP


In [1]:
import os
home_dir = os.environ.get('HOME')

# Please enter the filename of the ztf_sim output file you would like to use. The example first determines
# your home directory and then uses a relative path (useful if working on several machines with different usernames)
survey_file = os.path.join(home_dir, 'data/ZTF/test_schedule_v6.db')

# Please enter the path to where you have placed the Schlegel, Finkbeiner & Davis (1998) dust map files
# You can also set the environment variable SFD_DIR to this path (in that case the variable below should be None)
sfd98_dir = os.path.join(home_dir, 'data/sfd98')

In [2]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

from astropy.cosmology import Planck15
import simsurvey
import sncosmo

import simsurvey_tools as sst

In [3]:
# Load the ZTF CCD corners and filters
ccds = sst.load_ztf_ccds()
sst.load_ztf_filters()

In [4]:
# Load simulated survey from file (download from ftp://ftp.astro.caltech.edu/users/ebellm/one_year_sim_incomplete.db)
plan = simsurvey.SurveyPlan(load_opsim=survey_file, band_dict={'g': 'ztfg', 'r': 'ztfr', 'i': 'desi'}, ccds=ccds)

mjd_range = (plan.cadence['time'].min() - 30, plan.cadence['time'].max() + 30)

In [5]:
tr = simsurvey.get_transient_generator((0.0, 0.05), 
                                       transient='IIP',
                                       template='nugent',
                                       dec_range=(-30,90),
                                       mjd_range=(mjd_range[0],
                                                  mjd_range[1]),
                                       sfd98_dir=sfd98_dir)

In [6]:
survey = simsurvey.SimulSurvey(generator=tr, plan=plan)
    
lcs = survey.get_lightcurves(
    #progress_bar=True, notebook=True # If you get an error because of the progress_bar, delete this line.
)


/home/ufeindt/.local/lib/python2.7/site-packages/simsurvey-0.4.0-py2.7.egg/simsurvey/simulsurvey.py:1355: RuntimeWarning: invalid value encountered in log10

In [7]:
lcs[0]


Out[7]:
<Table length=230>
timebandfluxfluxerrzpzpsysfieldccdcomment
float64str4float64float64int64str2int64int64unicode7
57436.19041179086ztfr4260.8002359165381260.632495381193630ab55914all_sky
57436.21533387271desi6325.7553082849571006.292802698285330ab55914i_band
57436.24982064975ztfg2626.8864460870281174.329892085541130ab55914all_sky
57437.19182732894ztfr1978.07868484192481326.522275061595630ab55914all_sky
57437.22551764247ztfg3444.56795222076241133.169065894537230ab55914all_sky
57437.28797284913desi7552.7840767827111988.063080692739530ab55914i_band
57438.14431067917ztfr5603.9682009670241047.461024926773730ab55914all_sky
57438.22777775268ztfg1879.66930343345261247.464534499169330ab55914all_sky
57438.28688218023desi2088.65746825804172234.87086878529730ab55914i_band
57439.12272417054desi4302.687762611808961.789133329243730ab55914i_band
...........................
57700.3377396112ztfr12007.671685946778497.710401109293130ab55914all_sky
57700.37803687262ztfr12995.615500431575495.103565726483730ab55914all_sky
57700.40056679267ztfg2327.2736857409195439.578767164063330ab55914all_sky
57703.294842647454ztfr13454.625204096836909.385820211115530ab55914all_sky
57703.295305610416ztfr12282.011131700447909.385842082006730ab55914all_sky
57703.315631004596ztfr12390.865354101685910.128374016373530ab55914all_sky
57703.414657258225ztfg2065.2797333562903688.512706535572930ab55914all_sky
57704.353570489526ztfr12629.4475899234551081.0706688703930ab55914all_sky
57704.45359145785ztfg4058.2876491450825921.081594865296630ab55914all_sky
57705.320562272194desi24453.1023883241981222.79316424346830ab55914i_band

In [ ]: