In [3]:
import sncosmo
In [4]:
from analyzeSN import SNANASims
In [5]:
# read in simulation
snana_eg = SNANASims.fromSNANAfileroot(snanafileroot='LSST_Ia',
location='/Users/rbiswas/data/LSST/SNANA_data/MINION_1016_10YR_DDF_v2/',
coerce_inds2int=False)
In [6]:
snana_eg.headData.head()
Out[6]:
In [7]:
snids = snana_eg.headData.index.values
In [8]:
lc = snana_eg.get_SNANA_photometry(snid='31')
In [9]:
max(lc.lightCurve['flux']/lc.lightCurve['fluxerr'] )
Out[9]:
In [10]:
from analyzeSN import ResChar
In [11]:
def inferParams(snanaSims, model, infer_method, i, minsnr=3.):
"""
infer the parameters for the ith supernova in the simulation
"""
snid = snanaSims.headData.index.values[i]
z = snanaSims.headData.ix[snid, 'REDSHIFT_FINAL']
lcinstance = snanaSims.get_SNANA_photometry(snid=snid)
model.set(z=z)
print(z)
resfit = infer_method(lcinstance.snCosmoLC(), model, vparam_names=['t0', 'x0', 'x1', 'c'],
modelcov=True, minsnr=minsnr)
reschar = ResChar.fromSNCosmoRes(resfit)
return reschar
In [12]:
dust = sncosmo.CCM89Dust()
model = sncosmo.Model(source='salt2-extended', effects=[dust, dust],
effect_names=['host', 'mw'], effect_frames=['rest', 'obs'])
In [13]:
#example
r = inferParams(snana_eg, model, sncosmo.fit_lc, 0)
In [14]:
r.parameters
Out[14]:
In [15]:
r.covariance
Out[15]:
In [ ]:
r = inferParams(snana_eg, model, sncosmo.fit_lc, 1)
In [1]:
r.parameters
In [ ]:
r.covariance
In [ ]:
r = inferParams(snana_eg, model, sncosmo.fit_lc, 0, minsnr=5.)
PSEUDO CODE (SERIAL)
PSEUDO CODE (Parallel ?)
read in simulation and create chunks
Distribute chunks to nodes
In [ ]:
def inferParams(snanaSims, model, infer_method, i, minsnr=3.):
"""
infer the parameters for the ith supernova in the simulation
"""
snid = snanaSims.headData.index.values[i]
z = snanaSims.headData.ix[snid, 'REDSHIFT_FINAL']
lcinstance = snanaSims.get_SNANA_photometry(snid=snid)
model.set(z=z)
print(z)
resfit = infer_method(lcinstance.snCosmoLC(), model, vparam_names=['t0', 'x0', 'x1', 'c'],
modelcov=True, minsnr=minsnr)
reschar = ResChar.fromSNCosmoRes(resfit)
return reschar
snana_eg = SNANASims.fromSNANAfileroot(snanafileroot='LSST_Ia',
location='/Users/rbiswas/data/LSST/SNANA_data/MINION_1016_10YR_DDF_v2/',
coerce_inds2int=False)