In [1]:
from LSSTmetrics import PerSNMetric, EfficiencyTable
from LSSTmetrics import example_data as lsstm_example_data
from opsimsummary import OpSimOutput
#from efficiencyTable import EfficiencyTable

In [2]:
from opsimsummary import summarize_opsim as oss

In [3]:
import pandas as pd
import sncosmo

In [4]:
from sndata import LightCurve

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

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

Setup : Bandpasses


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

In [8]:
# 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 [9]:
efficiencyFile = os.path.join(lsstm_example_data, 'SEARCHEFF_PIPELINE_DES.DAT')
et = EfficiencyTable.fromDES_EfficiencyFile(efficiencyFile)

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

In [11]:
opsimHDF = os.path.join(os.getenv('HOME'), 'data', 'LSST', 'OpSimData', 'storage.h5')
#summarydf = OpSimOutput.fromOpSimDB('/Users/rbiswas/data/LSST/OpSimData/minion_1016_sqlite.db').summary.copy()

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 == [54, 56]')#.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 calculations

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 [21]:
fig_744_49923, _, _, _, _ = so.cadence_plot(fieldID=744, mjd_center=49923, 
                                            mjd_range=[-20., 50.])


Main Field at 2 times

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



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



In [24]:
fig_309_49540, _, _, _, _ = so.cadence_plot(fieldID=309, mjd_center=49540,
                                            mjd_range=[-20., 50.])



In [25]:
fig_290_49540, _, _, _, _ = so.cadence_plot(fieldID=290, mjd_center=49540,
                                         mjd_range=[-20., 50.])



In [30]:
fig_290_49540.savefig('SN_Cadence_290.pdf')

In [29]:
fig_309_49540.savefig('SN_Cadence_309.pdf')

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

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

In [76]:
fig_309_49823.savefig('TimeWindow_309_49823.pdf')

In [31]:
fig_309_49540, _, _, _, _ = so.cadence_plot(fieldID=309, mjd_center=49540, 
                                            mjd_range=[-20., 50.])


Light Curves

In [32]:
qm_290_49540 = PerSNMetric(t0=49540, fieldID=290, summarydf=summarydf,  efficiency=et, 
                         lsst_bp=lsst_bp)

In [33]:
qm_290_49540.lightcurve


(804, 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'))
/Users/rbiswas/soft/LSST/DarwinX86/sims_catUtils/2.3.4.sims/python/lsst/sims/catUtils/supernovae/snObject.py:736: RuntimeWarning: divide by zero encountered in log10
  return -2.5 * np.log10(fluxinMaggies)
/Users/rbiswas/soft/LSST/DarwinX86/sims_photUtils/2.3.4.sims/python/lsst/sims/photUtils/SignalToNoise.py:358: RuntimeWarning: divide by zero encountered in double_scalars
  fluxRatio = m5Flux/sourceFlux
/Users/rbiswas/soft/LSST/DarwinX86/sims_catUtils/2.3.4.sims/python/lsst/sims/catUtils/supernovae/snObject.py:780: RuntimeWarning: invalid value encountered in double_scalars
  return fluxinMaggies / SNR
/Users/rbiswas/.local/lib/python2.7/site-packages/LSSTmetrics/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']
/Users/rbiswas/.local/lib/python2.7/site-packages/LSSTmetrics/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)
/Users/rbiswas/.local/lib/python2.7/site-packages/LSSTmetrics/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)
Out[33]:
time band flux fluxerr zp zpsys SNR finSeeing airmass filtSkyBrightness fiveSigmaDepth propID night DetectionEfficiency
152756 49548.415128 r 6.729189e-10 3.110622e-11 0.0 ab 21.632936 0.717574 1.245747 21.120225 24.578616 366 195 0.984114444408
152757 49548.415545 r 6.729068e-10 3.111954e-11 0.0 ab 21.623291 0.717749 1.246357 21.119823 24.578089 366 195 0.984109042714
152758 49548.415961 r 6.728947e-10 3.113294e-11 0.0 ab 21.613596 0.717925 1.246971 21.119418 24.577559 366 195 0.984103613685
152759 49548.416378 r 6.728826e-10 3.114642e-11 0.0 ab 21.603851 0.718102 1.247590 21.119011 24.577026 366 195 0.984098156374
152760 49548.416795 r 6.728705e-10 3.116004e-11 0.0 ab 21.594021 0.718281 1.248214 21.118601 24.576488 366 195 0.984092651594
152761 49548.417211 r 6.728584e-10 3.117374e-11 0.0 ab 21.584142 0.718461 1.248842 21.118189 24.575947 366 195 0.984087119578
152762 49548.417628 r 6.728464e-10 3.118753e-11 0.0 ab 21.574213 0.718642 1.249474 21.117774 24.575403 366 195 0.984081559383
152763 49548.418045 r 6.728343e-10 3.120140e-11 0.0 ab 21.564235 0.718824 1.250111 21.117356 24.574856 366 195 0.984075971526
152748 49548.411795 r 6.730155e-10 3.141803e-11 0.0 ab 21.421315 0.727074 1.240960 21.123387 24.566396 366 195 0.983995936606
152749 49548.412211 r 6.730035e-10 3.186211e-11 0.0 ab 21.122378 0.738467 1.241600 21.122963 24.549239 366 195 0.983828531716
152750 49548.412628 r 6.729914e-10 3.187524e-11 0.0 ab 21.113298 0.738640 1.242179 21.122580 24.548735 366 195 0.983823446624
152751 49548.413045 r 6.729793e-10 3.188848e-11 0.0 ab 21.104151 0.738815 1.242763 21.122194 24.548227 366 195 0.983818324399
152752 49548.413461 r 6.729672e-10 3.190183e-11 0.0 ab 21.094938 0.738991 1.243350 21.121805 24.547715 366 195 0.983813165556
152753 49548.413878 r 6.729551e-10 3.191527e-11 0.0 ab 21.085677 0.739168 1.243943 21.121414 24.547200 366 195 0.98380797886
152754 49548.414295 r 6.729430e-10 3.192885e-11 0.0 ab 21.076331 0.739347 1.244540 21.121020 24.546680 366 195 0.983802745458
152755 49548.414711 r 6.729310e-10 3.194249e-11 0.0 ab 21.066955 0.739527 1.245141 21.120624 24.546158 366 195 0.983797494905
152764 49548.418461 r 6.728222e-10 3.528350e-11 0.0 ab 19.069032 0.823993 1.250753 21.116935 24.426328 366 195 0.982678657748
152765 49548.418878 r 6.728101e-10 3.530030e-11 0.0 ab 19.059614 0.824215 1.251399 21.116512 24.425760 366 195 0.982673383589
152766 49548.419295 r 6.727980e-10 3.531726e-11 0.0 ab 19.050119 0.824439 1.252049 21.116087 24.425187 366 195 0.982668066707
152767 49548.419711 r 6.727859e-10 3.533432e-11 0.0 ab 19.040581 0.824664 1.252704 21.115658 24.424611 366 195 0.982662725502
142239 49534.251421 r 8.032777e-10 5.544420e-11 0.0 ab 14.488037 1.088389 1.447443 20.729421 23.910751 366 181 0.985212880008
142238 49534.250993 r 8.032669e-10 5.547938e-11 0.0 ab 14.478657 1.089101 1.449146 20.729745 23.910033 366 181 0.984987774926
142237 49534.250565 r 8.032561e-10 5.551477e-11 0.0 ab 14.469232 1.089815 1.450858 20.730068 23.909311 366 181 0.98476157411
142236 49534.250137 r 8.032453e-10 5.555033e-11 0.0 ab 14.459774 1.090532 1.452577 20.730390 23.908586 366 181 0.984534586399
142235 49534.249708 r 8.032344e-10 5.558612e-11 0.0 ab 14.450271 1.091253 1.454304 20.730711 23.907857 366 181 0.984306496218
142234 49534.249280 r 8.032236e-10 5.562026e-11 0.0 ab 14.441207 1.091956 1.455992 20.731057 23.907162 366 181 0.984088968356
142233 49534.248863 r 8.032131e-10 5.565742e-11 0.0 ab 14.431375 1.092683 1.457734 20.731339 23.906406 366 181 0.983853004159
142232 49534.248435 r 8.032023e-10 5.569387e-11 0.0 ab 14.421736 1.093412 1.459485 20.731655 23.905665 366 181 0.983621658407
142214 49534.244604 r 8.031055e-10 5.722551e-11 0.0 ab 14.034047 1.124460 1.475454 20.734343 23.875011 363 181 0.974317138613
142212 49534.244187 r 8.030950e-10 5.726689e-11 0.0 ab 14.023722 1.125239 1.477286 20.734581 23.874195 363 181 0.974069339794
... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
176778 49575.157544 u 4.239669e-13 7.591402e-11 0.0 ab 0.005585 0.997765 1.382323 21.976450 23.519884 366 222 0.000202233932276
176769 49575.153701 u 4.232853e-13 7.579316e-11 0.0 ab 0.005585 0.987332 1.395069 21.969219 23.521563 366 222 0.000202233896949
176777 49575.157115 u 4.238909e-13 7.603440e-11 0.0 ab 0.005575 0.998317 1.383721 21.975653 23.518214 366 222 0.000202229995152
176776 49575.156687 u 4.238150e-13 7.615541e-11 0.0 ab 0.005565 0.998871 1.385125 21.974853 23.516538 366 222 0.00020222605328
176775 49575.156259 u 4.237391e-13 7.627718e-11 0.0 ab 0.005555 0.999428 1.386536 21.974050 23.514854 366 222 0.000202222101566
176768 49575.153284 u 4.232113e-13 7.629896e-11 0.0 ab 0.005547 0.989616 1.400984 21.965894 23.514553 366 222 0.000202218700244
176774 49575.155831 u 4.236632e-13 7.639631e-11 0.0 ab 0.005546 0.999972 1.387916 21.973266 23.513209 366 222 0.000202218238993
176773 49575.155414 u 4.235892e-13 7.651954e-11 0.0 ab 0.005536 1.000534 1.389341 21.972457 23.511510 366 222 0.00020221427995
176772 49575.154986 u 4.235133e-13 7.664333e-11 0.0 ab 0.005526 1.001098 1.390772 21.971646 23.509806 366 222 0.000202210307369
176771 49575.154557 u 4.234372e-13 7.676790e-11 0.0 ab 0.005516 1.001665 1.392211 21.970832 23.508094 366 222 0.000202206324308
175745 49574.158565 u 2.249323e-13 7.278152e-11 0.0 ab 0.003091 0.950481 1.393252 21.970244 23.564248 366 221 0.000201236205596
175751 49574.161134 u 2.255004e-13 7.686934e-11 0.0 ab 0.002934 1.011956 1.379535 21.978044 23.506686 366 221 0.000201173421844
175750 49574.160706 u 2.254058e-13 7.699032e-11 0.0 ab 0.002928 1.012513 1.380920 21.977252 23.505028 366 221 0.000201171086316
175749 49574.160278 u 2.253111e-13 7.711207e-11 0.0 ab 0.002922 1.013073 1.382311 21.976457 23.503362 366 221 0.000201168746408
175748 49574.159850 u 2.252165e-13 7.723438e-11 0.0 ab 0.002916 1.013635 1.383708 21.975660 23.501691 366 221 0.000201166405482
175747 49574.159421 u 2.251216e-13 7.735739e-11 0.0 ab 0.002910 1.014199 1.385113 21.974860 23.500013 366 221 0.000201164060214
175759 49574.164537 u 2.262525e-13 7.784077e-11 0.0 ab 0.002907 1.032202 1.368771 21.984242 23.493444 366 221 0.000201162642557
175746 49574.158993 u 2.250270e-13 7.748117e-11 0.0 ab 0.002904 1.014766 1.386524 21.974057 23.498327 366 221 0.000201161711829
175758 49574.164109 u 2.261579e-13 7.795939e-11 0.0 ab 0.002901 1.032755 1.370103 21.983472 23.491838 366 221 0.000201160388319
175757 49574.163681 u 2.260633e-13 7.807863e-11 0.0 ab 0.002895 1.033310 1.371441 21.982698 23.490226 366 221 0.000201158131699
175756 49574.163252 u 2.259685e-13 7.819538e-11 0.0 ab 0.002890 1.033853 1.372750 21.981943 23.488650 366 221 0.000201155917624
175755 49574.162836 u 2.258766e-13 7.831609e-11 0.0 ab 0.002884 1.034414 1.374101 21.981165 23.487023 366 221 0.000201153666507
175754 49574.162407 u 2.257818e-13 7.843407e-11 0.0 ab 0.002879 1.034961 1.375422 21.980405 23.485435 366 221 0.000201151447541
175753 49574.161991 u 2.256899e-13 7.855618e-11 0.0 ab 0.002873 1.035527 1.376787 21.979621 23.483794 366 221 0.000201149189571
175752 49574.161563 u 2.255952e-13 7.867884e-11 0.0 ab 0.002867 1.036094 1.378158 21.978834 23.482148 366 221 0.000201146916959
175764 49574.166655 u 2.267203e-13 8.115294e-11 0.0 ab 0.002794 1.079855 1.362245 21.988033 23.449470 366 221 0.000201117496396
175763 49574.166238 u 2.266282e-13 8.127408e-11 0.0 ab 0.002788 1.080426 1.363544 21.987277 23.447895 366 221 0.000201115377585
175762 49574.165810 u 2.265337e-13 8.139285e-11 0.0 ab 0.002783 1.080985 1.364815 21.986537 23.446353 366 221 0.00020111328549
175761 49574.165394 u 2.264418e-13 8.151541e-11 0.0 ab 0.002778 1.081561 1.366127 21.985775 23.444764 366 221 0.000201111160705
175760 49574.164965 u 2.263470e-13 8.163885e-11 0.0 ab 0.002773 1.082141 1.367446 21.985010 23.443166 366 221 0.000201109016305

724 rows × 14 columns


In [34]:
import seaborn as sns
sns.set_style('whitegrid')
sns.set_context('paper')

In [35]:
qm_309_49540 = PerSNMetric(t0=49540, fieldID=309, summarydf=summarydf,  efficiency=et, 
                         lsst_bp=lsst_bp)

In [36]:
def plotlc(qm, ylabel='flux(maggies)', xlabel_add='(MJD)'):
    model = qm.sncosmoModel
    lc = LightCurve(qm.lightcurve)
    fig = sncosmo.plot_lc(lc.snCosmoLC(), model=model, color='k', pulls=False)
    axs = fig.axes
    xlabel = axs[-1].get_xlabel()
    xlabel += xlabel_add
    _ = list(ax.set_ylabel(ylabel) for ax in axs[::2])
    _ = list(ax.set_xlabel(xlabel) for ax in axs[-2:])
    return fig

In [37]:
sns.set_style(None)

In [38]:
fig_309_lc = plotlc(qm_309_49540)


(19, 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'))
/Users/rbiswas/soft/LSST/DarwinX86/miniconda2/4.2.12.lsst1/lib/python2.7/site-packages/pandas/core/frame.py:2834: 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
  **kwargs)

In [39]:
fig_309_lc.savefig('SN_309_lc.pdf')

In [40]:
fig_290_lc = plotlc(qm_290_49540)


(804, 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]:
fig_290_lc.axes[2].get_ylabel()


Out[41]:
u'flux(maggies)'

In [42]:
fig_290_lc.savefig('SN_290_lc.pdf')

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

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

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

In [59]:
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'))
/Users/rbiswas/soft/LSST/DarwinX86/sims_catUtils/2.3.4.sims/python/lsst/sims/catUtils/supernovae/snObject.py:736: RuntimeWarning: divide by zero encountered in log10
  return -2.5 * np.log10(fluxinMaggies)
/Users/rbiswas/soft/LSST/DarwinX86/sims_photUtils/2.3.4.sims/python/lsst/sims/photUtils/SignalToNoise.py:358: RuntimeWarning: divide by zero encountered in double_scalars
  fluxRatio = m5Flux/sourceFlux
/Users/rbiswas/soft/LSST/DarwinX86/sims_catUtils/2.3.4.sims/python/lsst/sims/catUtils/supernovae/snObject.py:780: RuntimeWarning: invalid value encountered in double_scalars
  return fluxinMaggies / SNR
/Users/rbiswas/.local/lib/python2.7/site-packages/LSSTmetrics/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']
/Users/rbiswas/.local/lib/python2.7/site-packages/LSSTmetrics/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)
/Users/rbiswas/.local/lib/python2.7/site-packages/LSSTmetrics/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)
/Users/rbiswas/.local/lib/python2.7/site-packages/LSSTmetrics/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']
/Users/rbiswas/.local/lib/python2.7/site-packages/LSSTmetrics/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'))
(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 [60]:
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, 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-60-91b4703c023a> in <module>()
----> 1 mcmc_out_309_744_Nocov = sncosmo.mcmc_lc(qm_744_499.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 
      2                 vparam_names=['t0', 'x0', 'x1', 'c'],
      3                 bounds={'c':(-1., 1.), 'x1':(-5.0, 5.0)},
      4                 minsnr=0., modelcov=False)
      5 mcmc_out_309_499_Nocov = sncosmo.mcmc_lc(qm_309_499.SNCosmoLC(nightlyCoadd=True), model=qm_744.sncosmoModel, 

NameError: name 'qm_744' is not defined

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

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

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 [80]:
qm = PerSNMetric(fieldID=309, t0=49540, summarydf=summarydf, lsst_bp=lsst_bp)

In [82]:
fig_49540_no_coadd = qm.lcplot()


(19, 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 [83]:
fig_49540_no_coadd.axes


Out[83]:
[<matplotlib.axes._subplots.AxesSubplot at 0x14cd3b8d0>,
 <matplotlib.axes._subplots.AxesSubplot at 0x16b69ac10>,
 <matplotlib.axes._subplots.AxesSubplot at 0x15f563b90>,
 <matplotlib.axes._subplots.AxesSubplot at 0x151e4fcd0>]

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 [ ]: