In [16]:
%matplotlib inline
In [1]:
import analyzeSN
In [2]:
import sncosmo
In [3]:
model = sncosmo.Model(source='salt2')
In [4]:
data = sncosmo.load_example_data()
In [5]:
data.meta
Out[5]:
In [6]:
model.set(z=0.5)
In [7]:
res = sncosmo.fit_lc(data, model, vparam_names=['t0', 'x0', 'x1', 'c'], )
In [8]:
reschar = analyzeSN.ResChar.fromSNCosmoRes(res)
In [24]:
varmu = reschar.mu_variance_linear(alpha=0.14, beta=3.14)
In [25]:
print(varmu**0.5)
In [ ]:
# If we use mcmc to do this:
In [10]:
res_mcmc = sncosmo.mcmc_lc(data, model, vparam_names=['t0', 'x0', 'x1', 'c'], )
In [11]:
reschar_mcmc = reschar.fromSNCosmoRes(res_mcmc)
In [ ]:
# Note that mu might need additional constants
In [23]:
reschar_mcmc.salt_samples(alpha=0.1, beta=-3.14).mu.std()
Out[23]:
In [ ]: