In [1]:
from metrics import PerSNMetric
from efficiencyTable import EfficiencyTable


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-12585020e6fe> in <module>()
----> 1 from metrics import PerSNMetric
      2 from efficiencyTable import EfficiencyTable

/Users/rbiswas/doc/projects/supernovae/LSST/Cadence/LSSTmetrics/metrics.py in <module>()
     14 from lsst.sims.catUtils.supernovae import SNObject
     15 from astropy.utils import lazyproperty
---> 16 from .efficiencyTable import EfficiencyTable
     17 
     18 

ValueError: Attempted relative import in non-package

In [2]:
from opsimsummary import summarize_opsim as oss

In [3]:
import pandas as pd
import sncosmo

In [4]:
%matplotlib inline 
import matplotlib.pyplot as plt
import os
import numpy as np
import copy

In [5]:
from lsst.sims.photUtils import BandpassDict

Setup : Bandpasses


In [6]:
# Catsim bandpasses
lsst_bp = BandpassDict.loadTotalBandpassesFromFiles()

In [7]:
# sncosmo Bandpasses required for fitting
throughputsdir = os.getenv('THROUGHPUTS_DIR')

from astropy.units import Unit
bandPassList = ['u', 'g', 'r', 'i', 'z', 'y']
banddir = os.path.join(os.getenv('THROUGHPUTS_DIR'), 'baseline')

for band in bandPassList:

    # setup sncosmo bandpasses
    bandfname = banddir + "/total_" + band + '.dat'


    # register the LSST bands to the SNCosmo registry
    # Not needed for LSST, but useful to compare independent codes
    # Usually the next two lines can be merged,
    # but there is an astropy bug currently which affects only OSX.
    numpyband = np.loadtxt(bandfname)
    print band
    sncosmoband = sncosmo.Bandpass(wave=numpyband[:, 0],
                                   trans=numpyband[:, 1],
                                   wave_unit=Unit('nm'),
                                   name=band)
    sncosmo.registry.register(sncosmoband, force=True)


u
g
r
i
z
y

In [8]:
et = EfficiencyTable.fromDES_EfficiencyFile('example_data/SEARCHEFF_PIPELINE_DES.DAT')

In [10]:
from lsst.sims.catUtils.supernovae import SNObject

In [11]:
opsimHDF = os.path.join(os.getenv('HOME'), 'data', 'LSST', 'OpSimData', 'storage.h5')
summarydf = pd.read_hdf(opsimHDF, 'table')
# df = df.query('propID == [364, 366]')

In [12]:
summarydf.head()


Out[12]:
obsHistID sessionID propID fieldID fieldRA fieldDec filter expDate expMJD night ... wind humidity slewDist slewTime fiveSigmaDepth ditheredRA ditheredDec gamma N0sq alpha
0 1 1189 364 316 1.676483 -1.082473 y 2771 49353.032079 0 ... 0.0 0.0 1.620307 0.000000 21.084291 1.643930 -1.108924 0.039924 0.000002 0.039924
1 2 1189 364 372 1.694120 -1.033972 y 2810 49353.032525 0 ... 0.0 0.0 0.049266 4.542362 21.088257 1.664257 -1.060423 0.039924 0.000002 0.039924
2 3 1189 364 441 1.708513 -0.985271 y 2848 49353.032971 0 ... 0.0 0.0 0.049298 4.561422 21.091100 1.680878 -1.011722 0.039924 0.000002 0.039924
3 4 1189 364 505 1.720374 -0.936476 y 2887 49353.033417 0 ... 0.0 0.0 0.049266 4.570186 21.092714 1.694604 -0.962927 0.039924 0.000002 0.039924
4 5 1189 364 587 1.730248 -0.887672 y 2925 49353.033864 0 ... 0.0 0.0 0.049177 4.568530 21.093091 1.706054 -0.914123 0.039924 0.000002 0.039924

5 rows × 48 columns


In [13]:
summarydf = summarydf.query('propID == [364, 366]')#.query('night < 365')

In [14]:
# Create the summary instance
so = oss.SummaryOpsim(summarydf)

In [15]:
ss = so.simlib(fieldID=309)

In [16]:
ss.head()


Out[16]:
obsHistID sessionID propID fieldID fieldRA fieldDec filter expDate expMJD night ... humidity slewDist slewTime fiveSigmaDepth ditheredRA ditheredDec gamma N0sq alpha MJDay
54984 54932 1189 364 309 4.189756 -1.082474 u 6337289 49426.348262 73 ... 0.0 0.054175 4.737670 23.535869 4.165341 -1.089087 0.039553 7.762496e-07 0.039553 49426
62174 62118 1189 364 309 4.189756 -1.082474 i 7018234 49434.229565 81 ... 0.0 0.054641 4.659288 23.346593 4.230447 -1.089087 0.039780 8.518120e-07 0.039780 49434
62201 62145 1189 364 309 4.189756 -1.082474 i 7019269 49434.241549 81 ... 0.0 0.054641 4.600334 23.504851 4.230447 -1.089087 0.039745 7.912518e-07 0.039745 49434
65712 65656 1189 364 309 4.189756 -1.082474 Y 7364902 49438.241925 85 ... 0.0 0.054641 4.534727 21.193041 4.136860 -1.085780 0.039916 2.304308e-06 0.039916 49438
65717 65661 1189 364 309 4.189756 -1.082474 Y 7365094 49438.244152 85 ... 0.0 0.088075 5.189096 21.203663 4.136860 -1.085780 0.039915 2.293016e-06 0.039915 49438

5 rows × 49 columns

Start the calculatios

Field in the 2nd Season


In [17]:
fig_309, mat, _, _, _ = so.cadence_plot(fieldID=309, nightMax=730, nightMin=365., sql_query='night < 730. and night > 365.')



In [18]:
fig_744, mat, _, _, _ = so.cadence_plot(fieldID=744, nightMax=730, nightMin=365., sql_query='night < 730. and night > 365.')



In [19]:
fig_309.savefig('fig_309_2ndYear.pdf')
fig_744.savefig('fig_744_2ndYear.pdf')

Time Window around a central value


In [20]:
so.mjdvalfornight(570)


Out[20]:
49923
Deep field

In [66]:
fig_744_49923, _, _, _, _ = so.cadence_plot(fieldID=744, mjd_center=49923, 
                                            mjd_range=[-20., 50.])


Main Field at 2 times

In [68]:
fig_309_49923, _, _, _, _ = so.cadence_plot(fieldID=309, mjd_center=49923, 
                                            mjd_range=[-20., 50.])



In [146]:
fig_309_49823, _, _, _, _ = so.cadence_plot(fieldID=309, mjd_center=49823, 
                                            mjd_range=[-20., 50.])



In [145]:
fig_744_49923.savefig('TimeWindow_744_49923.pdf')

In [ ]:
fig_309_49923.savefig('TimeWindow_309_49923.pdf')

In [148]:
fig_309_49823.savefig('TimeWindow_309_49823.pdf')
Light Curves

In [21]:
qm_744_499 = PerSNMetric(t0=49923, fieldID=744, summarydf=summarydf,  efficiency=et, 
                         lsst_bp=lsst_bp)

In [22]:
qm_309_499 = PerSNMetric(t0=49923, fieldID=309, summarydf=summarydf,  efficiency=et, 
                         lsst_bp=lsst_bp)

In [209]:
qm_309_498 = PerSNMetric(t0=49823, fieldID=309, summarydf=summarydf,  efficiency=et, 
                         lsst_bp=lsst_bp)

In [23]:
fig_744_499_lc = qm_744_499.lcplot()
fig_309_499_lc = qm_309_499.lcplot()
fig_309_498_lc = qm_309_498.lcplot()

# save to files
fig_744_499_lc.savefig('fig_744_49923_lc.pdf')
fig_309_499_lc.savefig('fig_309_49923_lc.pdf')
fig_309_498_lc.savefig('fig_309_49823_lc.pdf')


(1103, Index([        u'obsHistID',         u'sessionID',            u'propID',
                 u'fieldID',           u'fieldRA',          u'fieldDec',
                  u'filter',           u'expDate',            u'expMJD',
                   u'night',         u'visitTime',      u'visitExpTime',
                 u'finRank',         u'finSeeing',      u'transparency',
                 u'airmass',        u'vSkyBright', u'filtSkyBrightness',
               u'rotSkyPos',               u'lst',          u'altitude',
                 u'azimuth',         u'dist2Moon',        u'solarElong',
                  u'moonRA',           u'moonDec',           u'moonAlt',
                  u'moonAZ',         u'moonPhase',            u'sunAlt',
                   u'sunAz',        u'phaseAngle',          u'rScatter',
              u'mieScatter',         u'moonIllum',        u'moonBright',
              u'darkBright',         u'rawSeeing',              u'wind',
                u'humidity',          u'slewDist',          u'slewTime',
          u'fiveSigmaDepth',        u'ditheredRA',       u'ditheredDec',
                   u'gamma',              u'N0sq',             u'alpha',
                   u'MJDay'],
      dtype='object'))
metrics.py:162: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['SNR'] = df['flux'] / df['fluxerr']
metrics.py:164: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['DetectionEfficiency'] = df.apply(self.func, axis=1)
metrics.py:165: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df.sort_values('SNR', ascending=False, inplace=True)
metrics.py:102: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  lc['modelFlux'] = lc['flux']
metrics.py:105: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  lc['deviation'] = np.random.normal(size=len(lc['flux']))
(20, Index([        u'obsHistID',         u'sessionID',            u'propID',
                 u'fieldID',           u'fieldRA',          u'fieldDec',
                  u'filter',           u'expDate',            u'expMJD',
                   u'night',         u'visitTime',      u'visitExpTime',
                 u'finRank',         u'finSeeing',      u'transparency',
                 u'airmass',        u'vSkyBright', u'filtSkyBrightness',
               u'rotSkyPos',               u'lst',          u'altitude',
                 u'azimuth',         u'dist2Moon',        u'solarElong',
                  u'moonRA',           u'moonDec',           u'moonAlt',
                  u'moonAZ',         u'moonPhase',            u'sunAlt',
                   u'sunAz',        u'phaseAngle',          u'rScatter',
              u'mieScatter',         u'moonIllum',        u'moonBright',
              u'darkBright',         u'rawSeeing',              u'wind',
                u'humidity',          u'slewDist',          u'slewTime',
          u'fiveSigmaDepth',        u'ditheredRA',       u'ditheredDec',
                   u'gamma',              u'N0sq',             u'alpha',
                   u'MJDay'],
      dtype='object'))
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-23-6937ddf0584d> in <module>()
      1 fig_744_499_lc = qm_744_499.lcplot()
      2 fig_309_499_lc = qm_309_499.lcplot()
----> 3 fig_309_498_lc = qm_309_498.lcplot()
      4 
      5 # save to files

NameError: name 'qm_309_498' is not defined

In [213]:
mcmc_out_309_744_Nocov = sncosmo.mcmc_lc(qm_744_499.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
                vparam_names=['t0', 'x0', 'x1', 'c'], 
                bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)}, 
                minsnr=0., modelcov=False)
mcmc_out_309_499_Nocov = sncosmo.mcmc_lc(qm_309_499.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
                vparam_names=['t0', 'x0', 'x1', 'c'], 
                bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)}, 
                minsnr=0., modelcov=False)
mcmc_out_309_498_Nocov = sncosmo.mcmc_lc(qm_309_498.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
                vparam_names=['t0', 'x0', 'x1', 'c'], 
                bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)}, 
                minsnr=0., modelcov=False)


1103
20
40

In [27]:
qm_309_499.writeLightCurve('lc_field309_mjd_49923.ascii')


(20, Index([        u'obsHistID',         u'sessionID',            u'propID',
                 u'fieldID',           u'fieldRA',          u'fieldDec',
                  u'filter',           u'expDate',            u'expMJD',
                   u'night',         u'visitTime',      u'visitExpTime',
                 u'finRank',         u'finSeeing',      u'transparency',
                 u'airmass',        u'vSkyBright', u'filtSkyBrightness',
               u'rotSkyPos',               u'lst',          u'altitude',
                 u'azimuth',         u'dist2Moon',        u'solarElong',
                  u'moonRA',           u'moonDec',           u'moonAlt',
                  u'moonAZ',         u'moonPhase',            u'sunAlt',
                   u'sunAz',        u'phaseAngle',          u'rScatter',
              u'mieScatter',         u'moonIllum',        u'moonBright',
              u'darkBright',         u'rawSeeing',              u'wind',
                u'humidity',          u'slewDist',          u'slewTime',
          u'fiveSigmaDepth',        u'ditheredRA',       u'ditheredDec',
                   u'gamma',              u'N0sq',             u'alpha',
                   u'MJDay'],
      dtype='object'))

In [26]:
qm_744_499.writeLightCurve('lc_field744_mjd_49923.ascii')


(1103, Index([        u'obsHistID',         u'sessionID',            u'propID',
                 u'fieldID',           u'fieldRA',          u'fieldDec',
                  u'filter',           u'expDate',            u'expMJD',
                   u'night',         u'visitTime',      u'visitExpTime',
                 u'finRank',         u'finSeeing',      u'transparency',
                 u'airmass',        u'vSkyBright', u'filtSkyBrightness',
               u'rotSkyPos',               u'lst',          u'altitude',
                 u'azimuth',         u'dist2Moon',        u'solarElong',
                  u'moonRA',           u'moonDec',           u'moonAlt',
                  u'moonAZ',         u'moonPhase',            u'sunAlt',
                   u'sunAz',        u'phaseAngle',          u'rScatter',
              u'mieScatter',         u'moonIllum',        u'moonBright',
              u'darkBright',         u'rawSeeing',              u'wind',
                u'humidity',          u'slewDist',          u'slewTime',
          u'fiveSigmaDepth',        u'ditheredRA',       u'ditheredDec',
                   u'gamma',              u'N0sq',             u'alpha',
                   u'MJDay'],
      dtype='object'))

In [24]:
fig_744_499_lc


Out[24]:

In [214]:
res_309_498_NoCov = ans.ResChar.fromSNCosmoRes(mcmc_out_309_498_Nocov)

In [218]:
corner(res_309_498_NoCov.salt_samples(), labels=res_309_498_NoCov.salt_samples().columns, 
       truths=[49823., 0., 0., -12.5, -12.5])


Out[218]:

In [ ]:
res_744_499_NoCov = ans.ResCharrChar.fromSN

In [ ]:
mcmc_out_309_498 = sncosmo.mcmc_lc(qm_309_498.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
                vparam_names=['t0', 'x0', 'x1', 'c'], 
                bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)}, 
                minsnr=0., modelcov=True)

In [193]:
qm_309_498 = PerSNMetric(t0=49823, fieldID=309, summarydf=summarydf,  efficiency=et, 
                         lsst_bp=lsst_bp)

In [198]:
fig_qm_309_498 = qm_309_498.lcplot()


40

In [206]:
fig_744_499 = qm_744_499.lcplot(nightlyCoadd=False)


1103

In [ ]:


In [183]:
qm_309_498.SN.SNstate


Out[183]:
{'MWE(B-V)': 0.32588091492652893,
 'ModelSource': 'salt2-extended',
 '_dec': -1.0824739999999999,
 '_ra': 4.189756,
 'c': 0.0,
 'hostebv': 0.0,
 'hostr_v': 3.1000000000000001,
 'mwebv': 0.0,
 'mwr_v': 3.1000000000000001,
 't0': 49823.0,
 'x0': 1.0068661711630977e-05,
 'x1': 0.0,
 'z': 0.5}

In [185]:
print qm_309_498.SN.equivalentSNCosmoModel()


<Model at 0x21f59da90>
source:
  class      : SALT2Source
  name       : 'salt2-extended'
  version    : 1.0
  phases     : [-20, .., 50] days
  wavelengths: [300, .., 18000] Angstroms
effect (name='host' frame='rest'):
  class           : OD94Dust
  wavelength range: [909.09, 33333.3] Angstroms
effect (name='mw' frame='obs'):
  class           : OD94Dust
  wavelength range: [909.09, 33333.3] Angstroms
parameters:
  z       = 0.5
  t0      = 49823.0
  x0      = 1.0068661711630977e-05
  x1      = 0.0
  c       = 0.0
  hostebv = 0.0
  hostr_v = 3.1000000000000001
  mwebv   = 0.32588091492652893
  mwr_v   = 3.1000000000000001

In [156]:
mcmc_out_309_498 = sncosmo.mcmc_lc(qm_309_498.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
                vparam_names=['t0', 'x0', 'x1', 'c'], 
                bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)}, 
                minsnr=0., modelcov=True)


40

In [157]:
out_309_498 = ans.ResChar.fromSNCosmoRes(mcmc_out_309_498)

In [162]:
-2.5 * np.log10(qm_309_498.SN.get('x0'))


Out[162]:
12.492570625969071

In [164]:
qm_309_498.lcplot()


40
Out[164]:

In [181]:
print qm_309_498.SN.equivalentSNCosmoModel()


<Model at 0x21f5c5a90>
source:
  class      : SALT2Source
  name       : 'salt2-extended'
  version    : 1.0
  phases     : [-20, .., 50] days
  wavelengths: [300, .., 18000] Angstroms
effect (name='host' frame='rest'):
  class           : OD94Dust
  wavelength range: [909.09, 33333.3] Angstroms
effect (name='mw' frame='obs'):
  class           : OD94Dust
  wavelength range: [909.09, 33333.3] Angstroms
parameters:
  z       = 0.5
  t0      = 49823.0
  x0      = 1.0068661711630977e-05
  x1      = 0.0
  c       = 0.0
  hostebv = 0.0
  hostr_v = 3.1000000000000001
  mwebv   = 0.32588091492652893
  mwr_v   = 3.1000000000000001

In [182]:
print out_309_498.sncosmoModel


<Model at 0x1c6a60d50>
source:
  class      : SALT2Source
  name       : 'salt2-extended'
  version    : 1.0
  phases     : [-20, .., 50] days
  wavelengths: [300, .., 18000] Angstroms
effect (name='host' frame='rest'):
  class           : OD94Dust
  wavelength range: [909.09, 33333.3] Angstroms
effect (name='mw' frame='obs'):
  class           : OD94Dust
  wavelength range: [909.09, 33333.3] Angstroms
parameters:
  z       = 0.5
  t0      = 49823.631863224953
  x0      = 4.6309307337106839e-06
  x1      = 0.71931976702786637
  c       = 0.23883403032414693
  hostebv = 0.0
  hostr_v = 3.1000000000000001
  mwebv   = 0.0076600932516157627
  mwr_v   = 3.1000000000000001

In [186]:
sncosmo.chisq(qm_309_498.SNCosmoLC(), model=qm_309_498.SN.equivalentSNCosmoModel())


40
Out[186]:
5.9372102542946931e-13

In [191]:
sncosmo.chisq(qm_309_498.SNCosmoLC(), model=out_309_498.sncosmoModel)


40
Out[191]:
0.48621729475023001

In [190]:
print qm_309_498.sncosmoModel


<Model at 0x21f17e510>
source:
  class      : SALT2Source
  name       : 'salt2-extended'
  version    : 1.0
  phases     : [-20, .., 50] days
  wavelengths: [300, .., 18000] Angstroms
effect (name='host' frame='rest'):
  class           : OD94Dust
  wavelength range: [909.09, 33333.3] Angstroms
effect (name='mw' frame='obs'):
  class           : OD94Dust
  wavelength range: [909.09, 33333.3] Angstroms
parameters:
  z       = 0.5
  t0      = 49823.0
  x0      = 1.0068661711630977e-05
  x1      = 0.0
  c       = 0.0
  hostebv = 0.0
  hostr_v = 3.1000000000000001
  mwebv   = 0.32588091492652893
  mwr_v   = 3.1000000000000001

In [176]:
sncosmo.plot_lc( qm_309_498.SNCosmoLC(), model=[out_309_498.sncosmoModel, 
                                                qm_309_498.SN.equivalentSNCosmoModel()],
               model_label=['fitted', 'truth'])


40
Out[176]:

In [163]:
corner(out_309_498.salt_samples(), labels=out_309_498.salt_samples().columns, truths=[49823, 12.5, 0, 0., 12.5])


Out[163]:

In [80]:
qm_744 = PerSNMetric(t0=49923, fieldID=744, summarydf=summarydf,  efficiency=et, lsst_bp=lsst_bp)

In [82]:
qm_744.qualityMetric()


1103
Out[82]:
6.9425772972855881

In [139]:
mBT = -2.5 * np.log10(qm_744.SN.SNstate['x0'])
muT = mBT

In [88]:
import analyzeSN as ans
from corner import corner

In [126]:
mcmc_out_744_F = sncosmo.mcmc_lc(qm_744.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
                vparam_names=['t0', 'x0', 'x1', 'c'], 
                bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)}, 
                minsnr=0., modelcov=False)

In [127]:
tt = ans.ResChar.fromSNCosmoRes(mcmc_out_744_F)

In [129]:
tt.salt_samples().mu.var()/ out_744.salt_samples().mu.var()


Out[129]:
0.079423266331676873

In [90]:
mcmc_out = sncosmo.mcmc_lc(qm_744.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
                vparam_names=['t0', 'x0', 'x1', 'c'], 
                bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)}, 
                minsnr=0., modelcov=True)

In [120]:
mcmc_out_309 = sncosmo.mcmc_lc(qm_309.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
                vparam_names=['t0', 'x0', 'x1', 'c'], 
                bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)}, 
                minsnr=0., modelcov=True)

In [130]:
mcmc_out_309_F = sncosmo.mcmc_lc(qm_309.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
                vparam_names=['t0', 'x0', 'x1', 'c'], 
                bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)}, 
                minsnr=0., modelcov=False)

In [131]:
out_309_F = ans.ResChar.fromSNCosmoRes(mcmc_out_309_F)

In [91]:
out_744 = ans.ResChar.fromSNCosmoRes(mcmc_out)

In [122]:
out_309 = ans.ResChar.fromSNCosmoRes(mcmc_out_309)

In [132]:
out_309.salt_samples().mu.var() / out_309_F.salt_samples().mu.var()


Out[132]:
0.48597328040162396

In [124]:
0.05 * 0.05 / out_309.salt_samples().mu.var()


Out[124]:
0.0019439683860306919

In [125]:
0.05 * 0.05 / out_309.mu_variance_linear()


          mB        x1         c
mB  0.034989  0.425184  0.024423
x1  0.425184  7.450886  0.427205
c   0.024423  0.427205  0.047480 [ 1.    0.14 -3.1 ]
Out[125]:
0.010678019000784269

In [142]:
qm_309.lcplot(scattered=False)


20
Out[142]:

In [143]:
corner(out_309.salt_samples(), labels=out_309.salt_samples().columns, truths=[49923, 
                                                                              0., 0. , mBT, muT  ])


Out[143]:

In [94]:
corner(out_744.salt_samples(), labels=out_744.salt_samples().columns)


/usr/local/manual/anaconda/lib/python2.7/site-packages/matplotlib/collections.py:650: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors_original != str('face'):
Out[94]:

In [115]:
0.05**2 / out_744.salt_samples(alpha=0.11, beta=3.1).mu.var()


Out[115]:
0.73100819292709907

In [119]:
0.05**2 / out_fit_309.salt_samples(alpha=0.11, beta=3.1).mu.var()


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-119-5ce166600306> in <module>()
----> 1 0.05**2 / out_fit_309.salt_samples(alpha=0.11, beta=3.1).mu.var()

AttributeError: 'tuple' object has no attribute 'salt_samples'

In [113]:
out_fit_744 = sncosmo.fit_lc(qm_744.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
               vparam_names=['x0', 'x1','c'], minsnr=0.,)

In [117]:
out_fit_744 = sncosmo.fit_lc(qm_744.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
               vparam_names=['x0', 'x1','c'], minsnr=0.,)

In [114]:
ans.ResChar.fromSNCosmoRes(out_fit_744)


---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-114-fde0049928c0> in <module>()
----> 1 ans.ResChar.fromSNCosmoRes(out_fit_744)

/Users/rbiswas/.local/lib/python2.7/site-packages/analyzeSN/analyzelcFits.pyc in fromSNCosmoRes(cls, SNCosmoRes)
     88                    covariance=res.covariance,
     89                    samples=samples,
---> 90                    weights=weights,
     91                    sncosmoModel=model)
     92 

UnboundLocalError: local variable 'weights' referenced before assignment

In [105]:
qm_744.discoveryMetric()


1103
Out[105]:
1.0

In [78]:
qm_309 = PerSNMetric(t0=49923, fieldID=309, summarydf=summarydf, efficiency=et, lsst_bp=lsst_bp)

In [79]:
qm_309.discoveryMetric()


metrics.py:159: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['SNR'] = df['flux'] / df['fluxerr']
metrics.py:161: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['DetectionEfficiency'] = df.apply(self.func, axis=1)
20
metrics.py:162: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df.sort_values('SNR', ascending=False, inplace=True)
Out[79]:
0.99999331820547932

In [84]:
qm_309.qualityMetric()


20
Out[84]:
0.053720543713400112

In [51]:
loc, ax_loc =plt.subplots()



In [57]:
xx = oss.SummaryOpsim(summarydf.query('fieldID==309'))
loc_fig = xx.showFields()



In [58]:
yy = oss.SummaryOpsim(summarydf.query('fieldID==744'))
yy.showFields(ax=loc_fig.axes[0])


Out[58]:

In [60]:
loc_fig.savefig('loc_309_744.pdf')

In [37]:
mat[mat.fillna(0.).sum(axis=1) > 0].index.max() - mat[mat.fillna(0.).sum(axis=1) > 0].index.min()


Out[37]:
215.0

In [24]:
len(_)


Out[24]:
5

In [16]:
_ = so.cadence_plot(fieldID=309, mjd_center=49540)


/usr/local/manual/anaconda/lib/python2.7/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors == str('face'):

In [17]:
# 1st season by default
_ = so.cadence_plot(fieldID=309)


Metrics


In [61]:
qm = PerSNMetric(fieldID=309, t0=49540, summarydf=summarydf, lsst_bp=lsst_bp)

In [62]:
qm.lcplot()


metrics.py:99: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  lc['modelFlux'] = lc['flux']
metrics.py:102: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  lc['deviation'] = np.random.normal(size=len(lc['flux']))
19
Out[62]:

In [63]:
qm.lcplot(nightlyCoadd=True)


19
Out[63]:

In [21]:
qm.writeLightCurve('coadded_lc.dat',nightlyCoadd=True)

In [22]:
cm = qm.cadence_Matrix(fieldID=309, mjd_center=49540, mjd_range=[-30., 50.])

In [23]:
cm.head()


Out[23]:
Filters u g r i z Y
49510 NaN NaN NaN NaN NaN NaN
49511 NaN NaN NaN NaN NaN NaN
49512 NaN NaN NaN NaN NaN NaN
49513 NaN NaN NaN NaN NaN NaN
49514 NaN NaN NaN NaN NaN NaN

In [24]:
cm = qm.cadence_plot(fieldID=309, mjd_center=49540, mjd_range=[-30, 5])



In [25]:
qm = PerSNMetric(fieldID=309, t0=49540, summarydf=ss, lsst_bp=lsst_bp, efficiency=et)

In [26]:
qm.SNCadence[0]


Out[26]:

In [27]:
qm.summary.head()


Out[27]:
obsHistID sessionID propID fieldID fieldRA fieldDec filter expDate expMJD night ... humidity slewDist slewTime fiveSigmaDepth ditheredRA ditheredDec gamma N0sq alpha MJDay
54984 54932 1189 364 309 4.189756 -1.082474 u 6337289 49426.348262 73 ... 0 0.054175 4.737670 23.535869 4.165341 -1.089087 0.039553 0.000001 0.039553 49426
62174 62118 1189 364 309 4.189756 -1.082474 i 7018234 49434.229565 81 ... 0 0.054641 4.659288 23.346593 4.230447 -1.089087 0.039780 0.000001 0.039780 49434
62201 62145 1189 364 309 4.189756 -1.082474 i 7019269 49434.241549 81 ... 0 0.054641 4.600334 23.504851 4.230447 -1.089087 0.039745 0.000001 0.039745 49434
65712 65656 1189 364 309 4.189756 -1.082474 Y 7364902 49438.241925 85 ... 0 0.054641 4.534727 21.193041 4.136860 -1.085780 0.039916 0.000002 0.039916 49438
65717 65661 1189 364 309 4.189756 -1.082474 Y 7365094 49438.244152 85 ... 0 0.088075 5.189096 21.203663 4.136860 -1.085780 0.039915 0.000002 0.039915 49438

5 rows × 49 columns


In [28]:
qm.discoveryMetric()


Out[28]:
0.99995137946174906

In [29]:
qm.qualityMetric()


Out[29]:
0.0029671277166204053

Using a Pull Light curve from MAF


In [30]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import healpy as hp
import lsst.sims.maf.db as db
import lsst.sims.maf.utils as utils
import lsst.sims.maf.metrics as metrics
import lsst.sims.maf.slicers as slicers
import lsst.sims.maf.metricBundles as metricBundles

In [31]:
outDir ='LightCurve'
dbFile = 'enigma_1189_sqlite.db'
opsimdb = utils.connectOpsimDb(dbFile)
resultsDb = db.ResultsDb(outDir=outDir)

In [32]:
filters = ['u','g','r','i','z','y']
colors={'u':'cyan','g':'g','r':'y','i':'r','z':'m', 'y':'k'}

In [33]:
# Set RA, Dec for a single point in the sky. in radians.
ra = np.radians(0.)
dec = np.radians(0.)
# SNR limit (Don't use points below this limit)
snrLimit = 5.
# Demand this many points above SNR limit before plotting LC
nPtsLimit = 6

In [34]:
# The pass metric just passes data straight through.
metric = metrics.PassMetric(cols=['filter','fieldID','finSeeing','fiveSigmaDepth',
                                  'expMJD','airmass', 'propID', 'night', 'filtSkyBrightness'])
slicer = slicers.UserPointsSlicer(ra,dec,lonCol='fieldRA',latCol='fieldDec')
sql = 'night < 366'
bundle = metricBundles.MetricBundle(metric,slicer,sql)
bg =  metricBundles.MetricBundleGroup({0:bundle}, opsimdb,
                                      outDir=outDir, resultsDb=resultsDb)

In [35]:
bg.runAll()


Querying database with constraint night < 366
Found 272657 visits
Running:  [0]
Completed metric generation.
Running reduce methods.
Running summary statistics.
Completed.

In [36]:
llc = pd.DataFrame.from_records(bundle.metricValues.data[0])

In [37]:
llc.head()


Out[37]:
obsHistID filtSkyBrightness airmass fieldRA fieldDec filter fiveSigmaDepth expMJD night finSeeing propID fieldID
0 239966 17.153304 1.168194 6.25556 0.003271 z 22.149947 49672.064912 319 0.772224 364 2655
1 149400 21.874528 1.153041 6.25556 0.003271 g 24.854518 49545.387207 192 0.782242 364 2655
2 227675 17.617678 1.209316 6.25556 0.003271 z 22.658431 49646.061726 293 0.597362 364 2655
3 148176 20.009584 1.293457 6.25556 0.003271 i 23.866753 49544.314227 191 0.758747 364 2655
4 178722 19.972167 1.355178 6.25556 0.003271 i 23.843180 49577.210972 224 0.759127 364 2655

In [38]:
llc.expMJD.hist()


Out[38]:
<matplotlib.axes._subplots.AxesSubplot at 0x160448b10>

In [39]:
q2 = PerSNMetric(t0=49580, summarydf=llc, lsst_bp=lsst_bp, efficiency=et, raCol='fieldRA',
                decCol='fieldDec')

In [40]:
ss.columns


Out[40]:
Index([u'obsHistID', u'sessionID', u'propID', u'fieldID', u'fieldRA', u'fieldDec', u'filter', u'expDate', u'expMJD', u'night', u'visitTime', u'visitExpTime', u'finRank', u'finSeeing', u'transparency', u'airmass', u'vSkyBright', u'filtSkyBrightness', u'rotSkyPos', u'lst', u'altitude', u'azimuth', u'dist2Moon', u'solarElong', u'moonRA', u'moonDec', u'moonAlt', u'moonAZ', u'moonPhase', u'sunAlt', u'sunAz', u'phaseAngle', u'rScatter', u'mieScatter', u'moonIllum', u'moonBright', u'darkBright', u'rawSeeing', u'wind', u'humidity', u'slewDist', u'slewTime', u'fiveSigmaDepth', u'ditheredRA', u'ditheredDec', u'gamma', u'N0sq', u'alpha', u'MJDay'], dtype='object')

In [41]:
llc.columns


Out[41]:
Index([u'obsHistID', u'filtSkyBrightness', u'airmass', u'fieldRA', u'fieldDec', u'filter', u'fiveSigmaDepth', u'expMJD', u'night', u'finSeeing', u'propID', u'fieldID'], dtype='object')

In [42]:
q2.raCol


Out[42]:
'fieldRA'

In [43]:
q2.summary[q2.raCol].iloc[0]


Out[43]:
6.25556

In [44]:
q2.radeg


Out[44]:
358.41718649085726

In [45]:
q2.decdeg


Out[45]:
0.18741449478729227

In [46]:
q2.SN.SNstate


Out[46]:
{'MWE(B-V)': 0.035068757832050323,
 'ModelSource': 'salt2-extended',
 '_dec': 0.003271,
 '_ra': 6.25556,
 'c': 0.0,
 'hostebv': 0.0,
 'hostr_v': 3.1000000000000001,
 'mwebv': 0.0,
 'mwr_v': 3.1000000000000001,
 't0': 49580.0,
 'x0': 1.0068661711630977e-05,
 'x1': 0.0,
 'z': 0.5}

In [47]:
q2.lcplot(nightlyCoadd=False)


metrics.py:148: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['SNR'] = df['flux'] / df['fluxerr']
metrics.py:150: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  df['DetectionEfficiency'] = df.apply(self.func, axis=1)
/usr/local/manual/anaconda/lib/python2.7/site-packages/pandas/core/frame.py:2891: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  inplace=inplace, kind=kind, na_position=na_position)

In [48]:
q2.lcplot(nightlyCoadd=True)



In [49]:
q2.writeLightCurve(fname='test.dat', nightlyCoadd=True)

In [50]:
!cat test.dat


night band zpsys flux zp fluxerr time
197 i ab 7.38981535465e-15 0.0 1.12061110296e-10 49550.294916
199 y ab 4.16334214811e-12 0.0 3.3196763789e-10 49552.2878882
200 z ab 5.38047609363e-12 0.0 1.05603667637e-10 49553.3395135
201 y ab 1.57584572158e-11 0.0 3.22634345035e-10 49554.3756353
202 y ab 2.39528163608e-11 0.0 3.07289518501e-10 49555.277983
204 y ab 6.15882336785e-11 0.0 2.34661082246e-10 49557.3534095
211 z ab 3.06088533052e-10 0.0 3.06937163341e-10 49564.433548
221 u ab 1.56029563392e-11 0.0 4.89707769799e-11 49574.326309
222 u ab 1.46938990797e-11 0.0 6.34592850528e-11 49575.26335
224 i ab 7.64088967051e-10 0.0 4.26806497321e-11 49577.203024
225 i ab 7.75634346472e-10 0.0 4.24992888433e-11 49578.2069525
230 y ab 7.2989146669e-10 0.0 2.15075882766e-10 49583.194115
239 r ab 5.28844207371e-10 0.0 4.80448638946e-11 49592.277693
242 g ab 9.20280911049e-11 0.0 1.43309236615e-11 49595.173483
251 i ab 4.01952469103e-10 0.0 2.26067447291e-11 49604.187105
252 i ab 3.84096121974e-10 0.0 4.02448535325e-11 49605.159508
255 z ab 4.0348474097e-10 0.0 6.48469963374e-11 49608.1246967
256 z ab 3.97467421966e-10 0.0 5.92905748255e-11 49609.130089
257 z ab 3.91194149306e-10 0.0 7.8789301386e-11 49610.1313937
259 y ab 3.86491211188e-10 0.0 3.91296930794e-10 49612.188252
266 i ab 1.95901501575e-10 0.0 9.12537376645e-11 49619.1560455

In [51]:
q2.coaddedLightCurve.reset_index()[q2.coaddedLightCurve.reset_index()['band'] == 'y']


Out[51]:
night band zpsys flux zp fluxerr time
1 199 y ab 4.163342e-12 0 3.319676e-10 49552.287888
3 201 y ab 1.575846e-11 0 3.226343e-10 49554.375635
4 202 y ab 2.395282e-11 0 3.072895e-10 49555.277983
5 204 y ab 6.158823e-11 0 2.346611e-10 49557.353409
11 230 y ab 7.298915e-10 0 2.150759e-10 49583.194115
19 259 y ab 3.864912e-10 0 3.912969e-10 49612.188252

In [52]:
q2.qualityMetric()


Out[52]:
0.086475461159803382

In [53]:
q2.discoveryMetric()


Out[53]:
0.99999999999999989

In [54]:
_ = q2.cadence_plot(summarydf=llc, racol='fieldRA', deccol='fieldDec', mjd_center=49580)



In [55]:
# Defaults to full season
_ = q2.cadence_plot(summarydf=llc, racol='fieldRA', deccol='fieldDec')


Demonstrate that a minimal definition of observation works


In [56]:
xx = llc[['expMJD', 'filter', 'fiveSigmaDepth', 'fieldRA', 'fieldDec', 'fieldID']].copy(deep=True)

In [57]:
xx


Out[57]:
expMJD filter fiveSigmaDepth fieldRA fieldDec fieldID
0 49672.064912 z 22.149947 6.255560 0.003271 2655
1 49545.387207 g 24.854518 6.255560 0.003271 2655
2 49646.061726 z 22.658431 6.255560 0.003271 2655
3 49544.314227 i 23.866753 6.255560 0.003271 2655
4 49577.210972 i 23.843180 6.255560 0.003271 2655
5 49554.373247 y 21.369012 6.255560 0.003271 2655
6 49672.081557 z 21.995196 6.255560 0.003271 2655
7 49543.439675 z 22.287935 6.255560 0.003271 2655
8 49547.355973 r 24.536172 6.255560 0.003271 2655
9 49631.109299 r 24.739914 6.255560 0.003271 2655
10 49646.080690 z 22.563434 6.255560 0.003271 2655
11 49631.116856 r 24.829550 6.255560 0.003271 2655
12 49609.137336 z 22.998605 6.255560 0.003271 2655
13 49557.355873 y 21.357556 6.255560 0.003271 2655
14 49645.135933 y 21.780857 6.255560 0.003271 2655
15 49631.128344 r 24.717211 6.255560 0.003271 2655
16 49574.326309 u 24.009828 6.255560 0.003271 2655
17 49555.288078 y 21.442207 6.255560 0.003271 2655
18 49544.297329 i 23.864832 6.255560 0.003271 2655
19 49646.033489 z 22.649448 6.255560 0.003271 2655
20 49545.404611 g 24.901808 6.255560 0.003271 2655
21 49608.115980 z 22.944295 6.255560 0.003271 2655
22 49543.426070 z 22.418617 6.255560 0.003271 2655
23 49595.179838 g 24.621747 6.255560 0.003271 2655
24 49646.049013 z 22.653370 6.255560 0.003271 2655
25 49555.285839 y 21.411571 6.255560 0.003271 2655
26 49637.075923 i 23.701628 6.255560 0.003271 2655
27 49684.027023 y 21.504122 6.255560 0.003271 2655
28 49637.055415 i 23.627379 6.255560 0.003271 2655
29 49645.133682 y 21.905190 6.255560 0.003271 2655
... ... ... ... ... ... ...
101 49637.074577 i 23.685725 0.027626 0.003271 2656
102 49645.127742 y 21.904519 0.027626 0.003271 2656
103 49619.163176 i 22.896463 0.027626 0.003271 2656
104 49646.043874 z 22.697461 0.027626 0.003271 2656
105 49583.190979 y 21.701455 0.027626 0.003271 2656
106 49645.123239 y 21.884584 0.027626 0.003271 2656
107 49645.119563 y 21.925221 0.027626 0.003271 2656
108 49555.285393 y 21.391583 0.027626 0.003271 2656
109 49653.997663 y 21.794320 0.027626 0.003271 2656
110 49545.391689 g 24.922707 0.027626 0.003271 2656
111 49646.152727 z 22.774476 0.027626 0.003271 2656
112 49544.314673 i 23.836942 0.027626 0.003271 2656
113 49544.296882 i 23.822951 0.027626 0.003271 2656
114 49646.033043 z 22.536047 0.027626 0.003271 2656
115 49604.177906 i 24.258893 0.027626 0.003271 2656
116 49612.188252 y 21.768196 0.027626 0.003271 2656
117 49631.110199 r 24.724469 0.027626 0.003271 2656
118 49547.353288 r 24.454882 0.027626 0.003271 2656
119 49631.127883 r 24.706460 0.027626 0.003271 2656
120 49547.372248 r 24.448127 0.027626 0.003271 2656
121 49608.133413 z 23.000778 0.027626 0.003271 2656
122 49654.024117 r 24.956614 0.027626 0.003271 2656
123 49583.197698 y 21.614014 0.027626 0.003271 2656
124 49608.116427 z 22.902978 0.027626 0.003271 2656
125 49595.167128 g 24.585773 0.027626 0.003271 2656
126 49543.440574 z 22.296168 0.027626 0.003271 2656
127 49595.180285 g 24.588526 0.027626 0.003271 2656
128 49578.217204 i 23.756624 0.027626 0.003271 2656
129 49631.117755 r 24.817052 0.027626 0.003271 2656
130 49545.411397 g 24.918747 0.027626 0.003271 2656

131 rows × 6 columns


In [58]:
q3 = PerSNMetric(t0=49580, summarydf=xx, lsst_bp=lsst_bp, efficiency=et, raCol='fieldRA',
                 decCol='fieldDec')

In [59]:
q3.lightcurve


Out[59]:
time band flux fluxerr zp zpsys SNR fiveSigmaDepth DetectionEfficiency
84 49578.196701 i 7.755384e-10 5.639221e-11 0 ab 13.752580 23.891976 0.982020548524
4 49577.210972 i 7.641964e-10 5.886288e-11 0 ab 12.982654 23.843180 0.970846927353
40 49577.195076 i 7.639816e-10 6.182001e-11 0 ab 12.358161 23.788072 0.980670206794
128 49578.217204 i 7.757303e-10 6.359777e-11 0 ab 12.197445 23.756624 0.980863066305
79 49592.277693 r 5.288442e-10 4.804486e-11 0 ab 11.007300 24.058825 0.977440877322
115 49604.177906 i 4.021245e-10 4.009737e-11 0 ab 10.028698 24.258893 0.971468221461
57 49604.209600 i 4.015318e-10 4.339009e-11 0 ab 9.253998 24.170085 0.960060775297
34 49604.195079 i 4.018032e-10 4.392809e-11 0 ab 9.146840 24.156292 0.958431972159
100 49604.165835 i 4.023504e-10 5.250583e-11 0 ab 7.662966 23.957700 0.91928675239
48 49605.172561 i 3.838602e-10 5.207630e-11 0 ab 7.371111 23.966039 0.898446610558
62 49605.146455 i 3.843320e-10 6.137305e-11 0 ab 6.262228 23.784909 0.732320326635
38 49609.123288 z 3.975091e-10 1.076489e-10 0 ab 3.692643 23.170611 0.147915195371
80 49609.122842 z 3.975119e-10 1.104060e-10 0 ab 3.600454 23.143069 0.131063060097
37 49608.132967 z 4.034365e-10 1.221543e-10 0 ab 3.302678 23.033086 0.0899290685553
42 49595.166681 g 9.208227e-11 2.811439e-11 0 ab 3.275273 24.626269 0.0455871130483
23 49595.179838 g 9.197747e-11 2.823113e-11 0 ab 3.258016 24.621747 0.0445034250721
121 49608.133413 z 4.034339e-10 1.258372e-10 0 ab 3.205997 23.000778 0.0787720699832
127 49595.180285 g 9.197391e-11 2.910569e-11 0 ab 3.159997 24.588526 0.0383478251473
125 49595.167128 g 9.207871e-11 2.917961e-11 0 ab 3.155584 24.585773 0.0380707012218
12 49609.137336 z 3.974230e-10 1.260820e-10 0 ab 3.152100 22.998605 0.0725523475965
78 49609.136890 z 3.974257e-10 1.287304e-10 0 ab 3.087272 22.976003 0.065071222715
21 49608.115980 z 4.035356e-10 1.325474e-10 0 ab 3.044464 22.944295 0.0601311267317
124 49608.116427 z 4.035330e-10 1.376831e-10 0 ab 2.930883 22.902978 0.0504244586653
52 49610.123399 z 3.912453e-10 1.494942e-10 0 ab 2.617127 22.813475 0.0296538331036
76 49610.123845 z 3.912424e-10 1.514511e-10 0 ab 2.583292 22.799352 0.0274139477974
33 49610.138942 z 3.911459e-10 1.637832e-10 0 ab 2.388193 22.714362 0.0189930104695
70 49610.139389 z 3.911430e-10 1.649642e-10 0 ab 2.371078 22.706563 0.0185480363744
55 49583.190532 y 7.299050e-10 4.083045e-10 0 ab 1.787649 21.722725 0.00652166818175
105 49583.190979 y 7.299033e-10 4.163903e-10 0 ab 1.752931 21.701455 0.00613282424487
97 49619.148915 i 1.959627e-10 1.189086e-10 0 ab 1.648011 23.061447 0.00165124901726
47 49583.197251 y 7.298796e-10 4.430705e-10 0 ab 1.647322 21.634095 0.00495000275789
123 49583.197698 y 7.298779e-10 4.513505e-10 0 ab 1.617098 21.614014 0.00461149347624
103 49619.163176 i 1.958403e-10 1.384548e-10 0 ab 1.414471 22.896463 0.000948682825452
86 49564.433548 z 3.060885e-10 3.069372e-10 0 ab 0.997235 22.032878 0.00179281143174
116 49612.188252 y 3.864912e-10 3.912969e-10 0 ab 0.987718 21.768196 0.0017680680578
16 49574.326309 u 1.560296e-11 4.897078e-11 0 ab 0.318618 24.009828 0.000327447080087
92 49575.263350 u 1.469390e-11 6.345929e-11 0 ab 0.231548 23.732270 0.000292619379922
43 49557.349596 y 6.149433e-11 5.330854e-10 0 ab 0.115355 21.432803 0.0005
81 49557.356768 y 6.167087e-11 5.715836e-10 0 ab 0.107895 21.357279 0.0005
13 49557.355873 y 6.164883e-11 5.714374e-10 0 ab 0.107884 21.357556 0.0005
45 49557.347805 y 6.145028e-11 5.859003e-10 0 ab 0.104882 21.330481 0.0005
77 49557.348701 y 6.147232e-11 5.869402e-10 0 ab 0.104734 21.328560 0.0005
83 49557.361714 y 6.179277e-11 5.976313e-10 0 ab 0.103396 21.309006 0.0005
17 49555.288078 y 2.405797e-11 5.284568e-10 0 ab 0.045525 21.442207 0.0005
25 49555.285839 y 2.403440e-11 5.436199e-10 0 ab 0.044212 21.411571 0.0005
108 49555.285393 y 2.402971e-11 5.537460e-10 0 ab 0.043395 21.391583 0.0005
75 49553.330838 z 5.353111e-12 1.389688e-10 0 ab 0.038520 22.889608 0.0005
95 49553.348189 z 5.407841e-12 1.590478e-10 0 ab 0.034001 22.743794 0.0005
30 49555.252622 y 2.368918e-11 7.933510e-10 0 ab 0.029860 21.002011 0.0005
85 49554.379517 y 1.578887e-11 5.462624e-10 0 ab 0.028903 21.406311 0.0005
88 49554.374142 y 1.574675e-11 5.645824e-10 0 ab 0.027891 21.370585 0.0005
5 49554.373247 y 1.573975e-11 5.654029e-10 0 ab 0.027838 21.369012 0.0005
61 49552.291835 y 4.178304e-12 7.689126e-10 0 ab 0.005434 21.035912 0.0005
82 49552.291389 y 4.176612e-12 7.846948e-10 0 ab 0.005323 21.013892 0.0005
56 49552.284236 y 4.149506e-12 7.971559e-10 0 ab 0.005205 20.996816 0.0005
71 49552.284683 y 4.151197e-12 8.136669e-10 0 ab 0.005102 20.974596 0.0005
59 49552.287370 y 4.161372e-12 8.467581e-10 0 ab 0.004914 20.931387 0.0005
72 49552.287816 y 4.163062e-12 8.636013e-10 0 ab 0.004821 20.910037 0.0005
90 49550.294916 i 7.389815e-15 1.120611e-10 0 ab 0.000066 23.124046 0.000100026377805

In [60]:
q3.SNCosmoLC()


Out[60]:
indextimebandfluxfluxerrzpzpsysSNRfiveSigmaDepthDetectionEfficiency
8449578.196701i7.75538365405e-105.63922106496e-110.0ab13.752579593423.8919760.982020548524
449577.210972i7.64196356584e-105.88628779774e-110.0ab12.982653632323.843180.970846927353
4049577.195076i7.63981577519e-106.18200051961e-110.0ab12.358161004623.7880720.980670206794
12849578.217204i7.7573032754e-106.35977734421e-110.0ab12.197444746223.7566240.980863066305
7949592.277693r5.28844207371e-104.80448638946e-110.0ab11.007299521824.0588250.977440877322
11549604.177906i4.02124455277e-104.00973738694e-110.0ab10.028698053624.2588930.971468221461
5749604.2096i4.01531809615e-104.33900886246e-110.0ab9.2539983748124.1700850.960060775297
3449604.195079i4.0180324533e-104.39280924679e-110.0ab9.1468402736424.1562920.958431972159
10049604.165835i4.02350366191e-105.25058284955e-110.0ab7.6629657643723.95770.91928675239
4849605.172561i3.83860199365e-105.20763040109e-110.0ab7.3711106549523.9660390.898446610558
6249605.146455i3.84332044583e-106.13730519363e-110.0ab6.2622280049223.7849090.732320326635
..............................
3049555.252622y2.36891836477e-117.93351000339e-100.0ab0.029859650567821.0020110.0005
8549554.379517y1.57888726978e-115.46262375648e-100.0ab0.028903459952121.4063110.0005
8849554.374142y1.57467523657e-115.64582361322e-100.0ab0.027890974717621.3705850.0005
549554.373247y1.57397465838e-115.65402917927e-100.0ab0.027838106392321.3690120.0005
6149552.291835y4.17830449003e-127.68912574756e-100.0ab0.0054340436445121.0359120.0005
8249552.291389y4.17661170682e-127.84694845122e-100.0ab0.0053225935314721.0138920.0005
5649552.284236y4.14950571962e-127.97155883514e-100.0ab0.0052053880620220.9968160.0005
7149552.284683y4.15119723193e-128.13666937662e-100.0ab0.005101838405620.9745960.0005
5949552.28737y4.16137189875e-128.4675808906e-100.0ab0.0049144755184620.9313870.0005
7249552.287816y4.16306184151e-128.63601329771e-100.0ab0.0048205829449320.9100370.0005
9049550.294916i7.38981535465e-151.12061110296e-100.0ab6.59445130889e-0523.1240460.000100026377805

In [61]:
q3.SN.SNstate


Out[61]:
{'MWE(B-V)': 0.035068757832050323,
 'ModelSource': 'salt2-extended',
 '_dec': 0.003271,
 '_ra': 6.25556,
 'c': 0.0,
 'hostebv': 0.0,
 'hostr_v': 3.1000000000000001,
 'mwebv': 0.0,
 'mwr_v': 3.1000000000000001,
 't0': 49580.0,
 'x0': 1.0068661711630977e-05,
 'x1': 0.0,
 'z': 0.5}

In [62]:
q3.qualityMetric()


Out[62]:
0.086475461159803382

In [63]:
q3.discoveryMetric()


Out[63]:
0.99999999999999989

In [ ]: