Пример #1
0
    np.concatenate([
        np.linspace(sd_lo, -hor, 3 + 1),  # south
        np.linspace(-hor, +hor, 14 + 1),  # horizon
        np.linspace(+hor, sd_hi, 3 + 1),  # north
    ]))

# Make settings for each module per sample
sample_names = source_list_loader()
for key in sample_names:
    print("Building settings file for sample '{}'".format(key))
    # Load data that settings depend on
    srcs = source_list_loader(key)[key]
    runlist = runlist_loader(key)[key]
    exp_off = off_data_loader(key)[key]
    exp_on = on_data_loader(key)[key]
    mc = mc_loader(key)[key]

    # :: BG injector ::
    # Rebinning for the rate model fits, use monthly bins
    if key == "IC86_2012-2014":
        n_rate_bins = 36
    else:
        n_rate_bins = 12
    rate_rebins = np.linspace(np.amin(exp_off["time"]),
                              np.amax(exp_off["time"]), n_rate_bins)
    # We want the parameter spline to stick a little bit to the points
    spl_s = len(sindec_bins) / 2
    bg_inj_opts = {
        "sindec_bins": sindec_bins.tolist(),  # JSON only saves lists
        "rate_rebins": rate_rebins.tolist(),
        "spl_s": spl_s,
Пример #2
0
nsrcs = len(sources)
ra = [src["ra"] for src in sources]
dec = [src["dec"] for src in sources]
# Theo weights need to be normalized manually in skylab?
w = np.ones(nsrcs, dtype=float) / float(nsrcs)

# Create the multi LLH
rnd_seed = 1
multillh = MultiPointSourceLLH(seed=rnd_seed, ncpu=40)

livetimes = _loader.livetime_loader()
for name, livetime in sorted(livetimes.items()):
    print("\n# Setting up LLH for sample '{}'".format(name))
    # Get exp data and MC
    exp = _loader.exp_data_loader(name)[name]
    mc = _loader.mc_loader(name)[name]

    # Setup the energy LLH model with fixed index, only ns is fitted
    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=scramble,
                         **settings["llh_opts"])

    multillh.add_sample(name, llh)

    del exp
    del mc
    "IC86_2015": gfu,
}

key2skylab = {
    "IC79": "IC79",
    "IC86_2011": "IC86, 2011",
    "IC86_2012-2014": "IC86, 2012-2014",
    "IC86_2015": "IC86, 2015",
}

# Make settings for each module per sample
sample_names = sorted(_loader.livetime_loader().keys())
for key in sample_names:
    print("Building settings file for sample '{}'".format(key))
    # Load data that settings depend on
    mc = _loader.mc_loader(key)[key]

    # :: LLH model ::
    # This is kind of arbitrary, but seems to produce robust PDFs
    logE_bins = np.linspace(np.floor(np.amin(mc["logE"])),
                            np.ceil(np.amax(mc["logE"])), 30)

    # Get the official binnings from skylab instead
    if use_skylab_bins:
        sindec_bins = key2set[key].sinDec_bins(key2skylab[key])
        logE_bins = key2set[key].energy_bins(key2skylab[key])

    llh_model_opts = {
        # Watch the order of the bins in the list!
        "twodim_bins": [logE_bins.tolist(),
                        sindec_bins.tolist()],