Пример #1
0
def run(slhadata, inputs=None, update=False) :
    SIout = SuperISOPrecObs()
    fname = "/tmp/mc-{u}".format(u=tools.unique_str())
    slhadata.write(fname)
    SIlib.run_superiso(c_char_p(fname.encode('ascii')), byref(SIout))
    tools.rm(fname)
    return tools.ctypes_field_values(SIout, name)
Пример #2
0
def run(slhadata, inputs=None, update=False) :
    MOout = MicromegasPrecObs()
    reader = lambda f: MOlib.run_micromegas(c_char_p(f.encode('ascii')), byref(MOout))
    writer = lambda f: slhadata.write(f)

    fname = "/tmp/mc-{u}".format(u=unique_str())
    writer(fname)
    reader(fname)
    rm(fname)
    return ctypes_field_values(MOout, name)
def myloglike(cube, ndim, nparams):
    obs,params=get_obs(cube,ndim)
            
    if obs: 
        chi2=get_chi2(obs)
        #RESULT ORIENTED: for sampling set error to default if error in one of the predictors  
        for name in ['FeynHiggs','Micromegas','BPhysics','SUSY-POPE']:
            if obs[(name,'error')]:
                chi2=default_chi
        obs[('tot_X2', 'all')]=chi2
    else:
        chi2=default_chi
        obs=params
    # write everything to root files
    if args.root_out:
        rootstore.write_point_to_root(obs)
    if args.pickle_out:
        with open('{}/{}.pkl'.format(args.multinest_dir, unique_str()),'wb') as pickle_file:
            pickle.dump(obs,pickle_file)
    if 'X' in args.verbose: 
        print("X^2={}".format(chi2))
    return -chi2
def myloglike(cube, ndim, nparams):
    obs, params = get_obs(cube, ndim)

    if obs:
        chi2 = get_chi2(obs)
        # RESULT ORIENTED: for sampling set error to default if error in one of the predictors
        for name in ["FeynHiggs", "Micromegas", "BPhysics", "SUSY-POPE"]:
            if obs[(name, "error")]:
                chi2 = default_chi
        obs[("tot_X2", "all")] = chi2
    else:
        chi2 = default_chi
        obs = params
    # write everything to root files
    if args.root_out:
        VARS = rootstore.get_VARS(obs, args.model)
        root.root_write(VARS)
    if args.pickle_out:
        with open("{}/{}.pkl".format(args.multinest_dir, unique_str()), "wb") as pickle_file:
            pickle.dump(obs, pickle_file)
    if "X" in args.verbose:
        print("X^2={}".format(chi2))
    return -chi2
def myloglike(cube, ndim, nparams):
    obs,params=get_obs(cube,ndim)
            
    if obs is not None: 
        chi2=get_chi2(obs)
        #RESULT ORIENTED: for sampling set error to default if error in one of the predictors  
        #FIXME: consider to not set Micromegas error to infinity, since it crashes on neutralino!=lsp
        for name in ['FeynHiggs','Micromegas','BPhysics','SUSY-POPE']:
            if obs[(name,'error')]:
                chi2=default_chi()
        if numpy.isnan(chi2):
            chi2=default_chi()
        obs[('tot_X2', 'all')]=chi2
    else:
        obs={}
        chi2=default_chi()
#        obs=params
        obs[('tot_X2', 'all')]=chi2
    # write everything to root files
    if args.root_out:
        if args.storage_dict is not None:
            vars=len(storage_dict)*[0.]
            for oids, val in obs.items():
                try:
                    vars[storage_dict[oids]]=val
                except KeyError:
                    print('WARNING: not saving {}'.format(oids))
                    continue
        else:
            vars=rootstore.get_VARS(obs, args.model)
        root.root_write(vars)
    if args.pickle_out:
        with open('{}/{}.pkl'.format(args.multinest_dir, unique_str()),'wb') as pickle_file:
            pickle.dump(obs,pickle_file)
    if 'X' in args.verbose: 
        print("X^2={}".format(chi2))
    return -chi2
Пример #6
0
 def __str__(self):
     tmp_name = "/tmp/mc-{u}".format(u=unique_str())
     self.write(tmp_name)
     txt=open(tmp_name).read()
     rm(tmp_name)
     return txt