示例#1
0
 def new_cosmo_model(self, p):
     model = cosmo.Cosmow0wa()
     model.Omega_m = p['Omega_m'].free
     model.Omega_k = p['Omega_k'].free
     model.w = p['w'].free
     model.wa = p['wa'].free
     model.H0 = p['H0'].free
     model.Omega_b_h2 = p['Omega_b_h2'].free
     return model
 def new_cosmo_model(self, p):
     if model_type == "wwa":
         model = cosmo.Cosmow0wa()
         model.Omega_k = p['Omega_k'].free
         model.wa = p['wa'].free
     else:
         model = cosmo.CosmoLambda()
         model.Omega_lambda = p['Omega_lambda'].free
     model.Omega_m = p['Omega_m'].free
     model.w = p['w'].free
     model.H0 = p['H0'].free
     model.Omega_b_h2 = p['Omega_b_h2'].free
     return model
示例#3
0
 def __init__(self, d, fixed_pars, cosmo=cosmo.Cosmow0wa(), n_spline=30, intrinsic_dispersion=0.08):
     self.int_disp = intrinsic_dispersion
     self.data = d
     self.bands = np.unique(self.data['band'])
     self.n_sn = len(np.unique(d['#SN']))
     self.model_cosmo = cosmo
     self.params, self.spline_base = self.init_params(fixed_pars, n_spline)
     self.free_cosmo_params = []
     self.fixed_pars = fixed_pars
     self.cosmo_free_idx = np.zeros(len(self.model_cosmo.param_names))
     for i, par in enumerate(self.model_cosmo.param_names):
         if self.params[par].indexof() != -1:
             self.free_cosmo_params += [par]
             self.cosmo_free_idx[i] = 1
     self.color_law_degree = len(self.params['color_law'].free)-1
     self.impacted = False
     self.lines, self.cols, self.J_dat = np.zeros(0), np.zeros(0), np.zeros(0)
     self.pedestal = color_disp_func(d['l_eff'])
     try:
         self.der_dl = get_standard_wavelength_derivatives(bands=[b.split('::')[-1] for b in self.bands])
     except:
         self.der_dl = np.zeros(len(self.bands))
import time
from saunerie.linearmodels import SparseSystem
import pyfits
from saunerie.spectrum import Spectrum
from saunerie.instruments import FilterWheel
from glob import glob

###
# Choix du modèle pour les performances
###

# model_type = "wwa"
model_type = "lambdaCDM"

if model_type == "wwa":
    mod = cosmo.Cosmow0wa()
else:
    mod = cosmo.CosmoLambda()

###
# Extraction du spectre SALT2
###


class NotKeptError(Exception):
    pass


print 'Starting --- ' + time.ctime()
m = InstrumentModel("LSSTPG")
cfg = saltpath.read_card_file(saltpath.fitmodel_filename)