Beispiel #1
0
    settings = _loader.settings_loader(name, skylab_bins=use_skylab_bins)[name]
    llh_model = EnergyLLH(**settings["llh_model_opts"])
    llh = PointSourceLLH(exp, mc, livetime, llh_model, scramble=True,
                         **settings["llh_opts"])

    multillh.add_sample(name, llh)

    del exp
    del mc
    gc.collect()


# Do background only trials
print(":: Starting {} background trials ::".format(ntrials))
_t0 = time()
trials = multillh.do_trials(ntrials, src_ra=ra, src_dec=dec, src_w=w)
print(":: Done. {} ::".format(sec2str(time() - _t0)))

# Save trials
out = {
    "ts": trials["TS"].tolist(),
    "ns": trials["nsources"].tolist(),
    "gamma": trials["gamma"].tolist(),
    "rnd_seed": rnd_seed,
    "ntrials": ntrials,
    }

_fname = os.path.join(outpath, "job_{}.json.gz".format(job_id))
with gzip.open(_fname, "w") as fp:
    json.dump(out, fp=fp, indent=2)
    print("Saved to:\n  {}".format(_fname))
Beispiel #2
0
    elif years == 1:
        print("Using IC86")
        llh = datascript.init86I(mode='box')

if catalog:
    if years == 1:
        bckg_trials = PointSourceLLH.do_trials(
            llh[0],
            n_iter=batchsize,
            src_ra=src_ra,
            src_dec=src_dec,
            src_w=modelweights['{}'.format(llhweight)])
    else:
        bckg_trials = MultiPointSourceLLH.do_trials(
            llh[0],
            n_iter=batchsize,
            src_ra=src_ra,
            src_dec=src_dec,
            src_w=modelweights['{}'.format(llhweight)])
else:
    if years == 1:
        bckg_trials = PointSourceLLH.do_trials(llh[0],
                                               n_iter=batchsize,
                                               src_ra=src_ra,
                                               src_dec=src_dec)
    else:
        bckg_trials = MultiPointSourceLLH.do_trials(llh[0],
                                                    n_iter=batchsize,
                                                    src_ra=src_ra,
                                                    src_dec=src_dec)

#choose an output dir, and make sure it exists