コード例 #1
0
ファイル: kwargtry.py プロジェクト: brelethford/IceCube
def init3yr(**kwargs):
    energy = kwargs.pop('energy', True)
    decorr = kwargs.pop('decorr', False)
    if decorr:
        arr_exp = cache.load(filename_pickle + "epinat_3yr/noMESE/exp.pickle")
        arr_mc = cache.load(filename_pickle + "epinat_3yr/noMESE/mc.pickle")
    else:
        arr_exp = cache.load(filename_pickle + "epinat_3yr/exp.pickle")
        arr_mc = cache.load(filename_pickle + "epinat_3yr/mc.pickle")
    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.93, 4 + 1),
            np.linspace(-0.93, -0.3, 10 + 1),
            np.linspace(-0.3, 0.05, 9 + 1),
            np.linspace(0.05, 1., 18 + 1),
        ]))

    energy_bins = [np.linspace(1., 9.5, 50 + 1), dec_bins]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)

    else:

        llh_model = ClassicLLH(sinDec_bins=dec_bins, sinDec_range=[-1., 1.])

    llh = StackingPointSourceLLH(arr_exp,
                                 arr_mc,
                                 livetime=livetime3yr,
                                 llh_model=llh_model,
                                 seed=np.random.randint(2**32),
                                 **kwargs)

    return llh
コード例 #2
0
ファイル: kwargtry.py プロジェクト: brelethford/IceCube
def initMESEfollowup(**kwargs):
    energy = kwargs.pop('energy', True)
    arr_exp = cache.load(filename_pickle + "MESE/expfollowup.pickle")
    arr_mc = cache.load(filename_pickle + "MESE/mc.pickle")

    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.93, 4 + 1),
            np.linspace(-0.93, hem, 12 + 1),
        ]))

    energy_bins = [np.linspace(2., 8.5, 67 + 1), np.linspace(-1., hem, 4 + 1)]

    arr_mc = arr_mc[arr_mc["logE"] > 1.]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)

    else:

        llh_model = ClassicLLH(sinDec_bins=dec_bins, sinDec_range=[-1., 1.])

    llh = StackingPointSourceLLH(arr_exp,
                                 arr_mc,
                                 livetime=livetimeMESEfollowup,
                                 llh_model=llh_model,
                                 seed=np.random.randint(2**32),
                                 **kwargs)

    return llh
コード例 #3
0
ファイル: kwargtry.py プロジェクト: brelethford/IceCube
def init79_sirin(**kwargs):
    energy = kwargs.pop('energy', True)
    decorr = kwargs.pop('decorr', False)
    if decorr:
        arr_exp = cache.load(filename_pickle + "sirin_IC79/noMESE/exp.pickle")
        arr_mc = cache.load(filename_pickle + "sirin_IC79/noMESE/mc.pickle")
    else:
        arr_exp = cache.load(filename_pickle + "sirin_IC79/exp.pickle")
        arr_mc = cache.load(filename_pickle + "sirin_IC79/mc.pickle")

    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.75, 10 + 1),
            np.linspace(-0.75, 0.0, 15 + 1),
            np.linspace(0.0, 1., 20 + 1),
        ]))

    energy_bins = [np.linspace(2., 9., 67 + 1), dec_bins]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)
    else:

        llh_model = ClassicLLH(sinDec_bins=dec_bins, sinDec_range=[-1., 1.])

    #Why a different sindec binning? Curious...
    llh = StackingPointSourceLLH(arr_exp,
                                 arr_mc,
                                 livetime=livetime_IC79_sirin,
                                 llh_model=llh_model,
                                 seed=np.random.randint(2**32),
                                 **kwargs)

    return llh
コード例 #4
0
ファイル: kwargtry.py プロジェクト: brelethford/IceCube
def init86I(**kwargs):
    energy = kwargs.pop('energy', True)
    decorr = kwargs.pop('decorr', False)
    if decorr:
        arr_exp = cache.load(filename_pickle + "IC86I/noMESE/exp.pickle")
        arr_mc = cache.load(filename_pickle + "IC86I/noMESE/mc.pickle")
    else:
        arr_exp = cache.load(filename_pickle + "IC86I/exp.pickle")
        arr_mc = cache.load(filename_pickle + "IC86I/mc.pickle")
    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.2, 10 + 1),
            np.linspace(-0.2, hem, 4 + 1),
            np.linspace(hem, 0.2, 5 + 1),
            np.linspace(0.2, 1., 10),
        ]))
    #check this later, BEN!
    energy_bins = [np.linspace(1., 10., 67 + 1), dec_bins]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)

    else:

        llh_model = ClassicLLH(sinDec_bins=dec_bins, sinDec_range=[-1., 1.])

    llh = StackingPointSourceLLH(arr_exp,
                                 arr_mc,
                                 livetime=livetime_IC86I,
                                 llh_model=llh_model,
                                 seed=np.random.randint(2**32),
                                 **kwargs)

    return llh
コード例 #5
0
def init79(energy=False, stacking=True, decorr=False, mode='all', **kwargs):
    if decorr:
        arr_exp = cache.load(filename_pickle + "IC79/noMESE/exp.pickle")
        arr_mc = cache.load(filename_pickle + "IC79/noMESE/mc.pickle")
    else:
        arr_exp = cache.load(filename_pickle + "IC79/exp.pickle")
        arr_mc = cache.load(filename_pickle + "IC79/mc.pickle")

    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.75, 10 + 1),
            np.linspace(-0.75, 0.0, 15 + 1),
            np.linspace(0.0, 1., 20 + 1),
        ]))

    energy_bins = [np.linspace(2., 9., 67 + 1), dec_bins]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)

        #llh_model = EnergyLLH(sinDec_bins=dec_bins(50),#min(50, Nexp // 50),
        #                      sinDec_range=[-1., 1.],
        #                      logE_bins=min(50, Nexp // 50), #energybins(50)
        #                      logE_range=[[0.9 * min(arr_exp["logE"].min(),
        #                                               arr_mc["logE"].min()),
        #                                     1.1 * max(arr_exp["logE"].max(),
        #                                               arr_mc["logE"].max())],
        #                                     [-1., 1.]])
    else:

        llh_model = ClassicLLH(  #["logE"], min(50, Nexp // 50),
            #twodim_range=[0.9 * arr_mc["logE"].min(),
            #             1.1 * arr_mc["logE"].max()],
            sinDec_bins=dec_bins,
            sinDec_range=[-1., 1.])

    if stacking:
        llh = StackingPointSourceLLH(arr_exp,
                                     arr_mc,
                                     livetime=livetime_IC79,
                                     llh_model=llh_model,
                                     mode=mode,
                                     seed=np.random.randint(2**32),
                                     **kwargs)
    else:
        llh = PointSourceLLH(arr_exp,
                             arr_mc,
                             livetime=livetime_IC79,
                             llh_model=llh_model,
                             mode=mode,
                             seed=np.random.randint(2**32),
                             **kwargs)
    return llh
コード例 #6
0
ファイル: load_starburst.py プロジェクト: brelethford/IceCube
def init59(energy=False, mode='all', **kwargs):
    arr_exp = cache.load(filename_pickle+"sirin_IC59/exp.pickle")
    arr_mc = cache.load(filename_pickle+"sirin_IC59/mc.pickle")

    dec_bins = np.unique(np.concatenate([
                           np.linspace(-1., -0.95, 2 + 1),
                           np.linspace(-0.95, -0.25, 25 + 1),
                           np.linspace(-0.25, 0.05, 15 + 1),
                           np.linspace(0.05, 1., 10 + 1),
                           ]))    

    dec_bins_logE = np.unique(np.concatenate([
                           np.linspace(-1., -0.05, 20 + 1),
                           np.linspace(0.05, 1., 10 + 1),
                           ]))     

    energy_bins = [np.linspace(2., 9.5, 67 + 1), dec_bins_logE]

    if energy:

        llh_model = EnergyLLH(energy_bins,
                          sinDec_bins=dec_bins)
        
        #llh_model = EnergyLLH(sinDec_bins=dec_bins(50),#min(50, Nexp // 50),
        #                      sinDec_range=[-1., 1.],
        #                      logE_bins=min(50, Nexp // 50), #energybins(50)
        #                      logE_range=[[0.9 * min(arr_exp["logE"].min(),
        #                                               arr_mc["logE"].min()),
        #                                     1.1 * max(arr_exp["logE"].max(),
        #                                               arr_mc["logE"].max())],
        #                                     [-1., 1.]]) 
    else:

        llh_model = ClassicLLH(#["logE"], min(50, Nexp // 50),
                                #twodim_range=[0.9 * arr_mc["logE"].min(),
                                 #             1.1 * arr_mc["logE"].max()],
                                sinDec_bins=dec_bins,
                                sinDec_range=[-1., 1.])

    #Why a different sindec binning? Curious...
    llh = StackingPointSourceLLH(arr_exp, arr_mc, livetime=livetime_IC59, llh_model=llh_model,
                         mode=mode, #hemispheres=dict(Full=[-np.inf, np.inf]),
                         #nsource=Nexp / 100.,
                         #nsource_bounds=(-Nexp / 2., Nexp / 2.)
                         #               if not energy else (0., Nexp / 2.),
                         seed=np.random.randint(2**32),
                         **kwargs)

    return llh
コード例 #7
0
def init40(energy=False, stacking=True, mode='all', nopull=False, **kwargs):
    if nopull:
        arr_exp = cache.load(filename_pickle + "nopull/sirin_IC40/exp.pickle")
        arr_mc = cache.load(filename_pickle + "nopull/sirin_IC40/mc.pickle")
    else:
        arr_exp = cache.load(filename_pickle + "IC40/exp.pickle")
        arr_mc = cache.load(filename_pickle + "IC40/mc.pickle")

    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.25, 10 + 1),
            np.linspace(-0.25, 0.0, 5 + 1),
            np.linspace(0.0, 1., 10 + 1),
        ]))

    dec_bins_logE = np.unique(
        np.concatenate([
            np.linspace(-1., -0.25, 10 + 1),
            np.linspace(-0.25, 0.0, 10 + 1),
            np.linspace(0.0, 1., 10 + 1),
        ]))
    #These binnings are done, year specifically, in load.py from stefan.
    energy_bins = [np.linspace(2., 9., 75 + 1), dec_bins_logE]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)

    else:

        llh_model = ClassicLLH(sinDec_bins=dec_bins, sinDec_range=[-1., 1.])
    if stacking:
        llh = StackingPointSourceLLH(arr_exp,
                                     arr_mc,
                                     livetime=livetime_IC40,
                                     llh_model=llh_model,
                                     mode=mode,
                                     seed=np.random.randint(2**32),
                                     **kwargs)
    else:
        llh = PointSourceLLH(arr_exp,
                             arr_mc,
                             livetime=livetime_IC40,
                             llh_model=llh_model,
                             mode=mode,
                             seed=np.random.randint(2**32),
                             **kwargs)

    return llh
コード例 #8
0
def initMESE3yr(energy=False, stacking=True, mode='all', **kwargs):
    arr_exp = cache.load(filename_pickle + "MESE/exp3yr.pickle")
    arr_mc = cache.load(filename_pickle + "MESE/mc.pickle")

    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.92, 3 + 1),
            np.linspace(-0.92, hem, 10 + 1),
        ]))

    energy_bins = [
        np.linspace(2., 8.5, 40 + 1),
        np.linspace(-1., hem, 4 + 1),
    ]

    arr_mc = arr_mc[arr_mc["logE"] > 1.]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)

    else:

        llh_model = ClassicLLH(  #["logE"], min(50, Nexp // 50),
            #twodim_range=[0.9 * arr_mc["logE"].min(),
            #             1.1 * arr_mc["logE"].max()],
            sinDec_bins=dec_bins,
            sinDec_range=[-1., 1.])

    if stacking:
        llh = StackingPointSourceLLH(arr_exp,
                                     arr_mc,
                                     livetime=livetimeMESE3yr,
                                     llh_model=llh_model,
                                     mode=mode,
                                     seed=np.random.randint(2**32),
                                     **kwargs)
    else:
        llh = PointSourceLLH(arr_exp,
                             arr_mc,
                             livetime=livetimeMESE3yr,
                             llh_model=llh_model,
                             mode=mode,
                             seed=np.random.randint(2**32),
                             **kwargs)

    return llh
コード例 #9
0
def init3yr(energy=False, stacking=True, decorr=False, mode='all', **kwargs):
    if decorr:
        arr_exp = cache.load(filename_pickle + "epinat_3yr/noMESE/exp.pickle")
        arr_mc = cache.load(filename_pickle + "epinat_3yr/noMESE/mc.pickle")
    else:
        arr_exp = cache.load(filename_pickle + "epinat_3yr/exp.pickle")
        arr_mc = cache.load(filename_pickle + "epinat_3yr/mc.pickle")
    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.93, 4 + 1),
            np.linspace(-0.93, -0.3, 10 + 1),
            np.linspace(-0.3, 0.05, 9 + 1),
            np.linspace(0.05, 1., 18 + 1),
        ]))

    energy_bins = [np.linspace(1., 9.5, 50 + 1), dec_bins]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)

    else:

        llh_model = ClassicLLH(  #["logE"], min(50, Nexp // 50),
            #twodim_range=[0.9 * arr_mc["logE"].min(),
            #             1.1 * arr_mc["logE"].max()],
            sinDec_bins=dec_bins,
            sinDec_range=[-1., 1.])

    if stacking:
        llh = StackingPointSourceLLH(arr_exp,
                                     arr_mc,
                                     livetime=livetime3yr,
                                     llh_model=llh_model,
                                     mode=mode,
                                     seed=np.random.randint(2**32),
                                     **kwargs)
    else:
        llh = PointSourceLLH(arr_exp,
                             arr_mc,
                             livetime=livetime3yr,
                             llh_model=llh_model,
                             mode=mode,
                             seed=np.random.randint(2**32),
                             **kwargs)

    return llh
コード例 #10
0
ファイル: load_starburst.py プロジェクト: brelethford/IceCube
def init86I(energy=False,  mode='all', **kwargs):
    arr_exp = cache.load(filename_pickle+"sirin_IC86I/exp.pickle")
    arr_mc = cache.load(filename_pickle+"sirin_IC86I/mc.pickle")
    #This hem... not sure about what it means, but stefan uses it in load.py.
    #Obviously it's for the hemisphere line - but why doesn't he use it for every year?
    hem = np.sin(np.radians(-5.))
    dec_bins = np.unique(np.concatenate([
                         np.linspace(-1., -0.2, 10 + 1),
                         np.linspace(-0.2, hem, 4 + 1),
                         np.linspace(hem, 0.2, 5 + 1),
                         np.linspace(0.2, 1., 10),
                         ]))
    #check this later, BEN!
    energy_bins = [np.linspace(1., 10., 67 + 1), dec_bins]

    if energy:

        llh_model = EnergyLLH(energy_bins,
                          sinDec_bins=dec_bins)
        
        #llh_model = EnergyLLH(sinDec_bins=dec_bins(50),#min(50, Nexp // 50),
        #                      sinDec_range=[-1., 1.],
        #                      logE_bins=min(50, Nexp // 50), #energybins(50)
        #                      logE_range=[[0.9 * min(arr_exp["logE"].min(),
        #                                               arr_mc["logE"].min()),
        #                                     1.1 * max(arr_exp["logE"].max(),
        #                                               arr_mc["logE"].max())],
        #                                     [-1., 1.]]) 
    else:

        llh_model = ClassicLLH(#["logE"], min(50, Nexp // 50),
                                #twodim_range=[0.9 * arr_mc["logE"].min(),
                                 #             1.1 * arr_mc["logE"].max()],
                                sinDec_bins=dec_bins,
                                sinDec_range=[-1., 1.])

    #Why a different sindec binning? Curious...
    llh = StackingPointSourceLLH(arr_exp, arr_mc, livetime=livetime_IC86I, llh_model=llh_model,
                         mode=mode, #hemisphere=dict(Full=[-np.inf, np.inf]),
                         #nsource=Nexp / 100.,
                         #nsource_bounds=(-Nexp / 2., Nexp / 2.)
                         #               if not energy else (0., Nexp / 2.),
                         seed=np.random.randint(2**32),
                         **kwargs)

    return llh
コード例 #11
0
ファイル: load_starburst.py プロジェクト: brelethford/IceCube
def init40(energy=False, mode='all', **kwargs):
    arr_exp = cache.load(filename_pickle+"sirin_IC40/exp.pickle")
    arr_mc = cache.load(filename_pickle+"sirin_IC40/mc.pickle")

    dec_bins = np.unique(np.concatenate([
                           np.linspace(-1., -0.25, 10 + 1),
                           np.linspace(-0.25, 0.0, 5 + 1),
                           np.linspace(0.0, 1., 10 + 1),
                           ]))    

    dec_bins_logE = np.unique(np.concatenate([
                           np.linspace(-1., -0.25, 10 + 1),
                           np.linspace(-0.25, 0.0, 10 + 1),
                           np.linspace(0.0, 1., 10 + 1),
                           ]))     
    #These binnings are done, year specifically, in load.py from stefan.
    energy_bins = [np.linspace(2., 9., 75 + 1), dec_bins_logE]

    if energy:

        llh_model = EnergyLLH(energy_bins,
                          sinDec_bins=dec_bins)
        
    else:

        llh_model = ClassicLLH(#["logE"], min(50, Nexp // 50),
                                #twodim_range=[0.9 * arr_mc["logE"].min(),
                                 #             1.1 * arr_mc["logE"].max()],
                                sinDec_bins=dec_bins,
                                sinDec_range=[-1., 1.])

    #Why a different sindec binning? Curious...
    llh = StackingPointSourceLLH(arr_exp, arr_mc, livetime=livetime_IC40, llh_model=llh_model,
                         mode=mode, #hemispheres=dict(Full=[-np.inf, np.inf]),
                         #nsource=Nexp / 100.,
                         #nsource_bounds=(-Nexp / 2., Nexp / 2.)
                         #               if not energy else (0., Nexp / 2.),
                         seed=np.random.randint(2**32),
                         **kwargs)

    return llh
コード例 #12
0
ファイル: kwargtry.py プロジェクト: brelethford/IceCube
def init59(**kwargs):
    energy = kwargs.pop('energy', True)
    arr_exp = cache.load(filename_pickle + "IC59/exp.pickle")
    arr_mc = cache.load(filename_pickle + "IC59/mc.pickle")

    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.95, 2 + 1),
            np.linspace(-0.95, -0.25, 25 + 1),
            np.linspace(-0.25, 0.05, 15 + 1),
            np.linspace(0.05, 1., 10 + 1),
        ]))

    dec_bins_logE = np.unique(
        np.concatenate([
            np.linspace(-1., -0.05, 20 + 1),
            np.linspace(0.05, 1., 10 + 1),
        ]))

    energy_bins = [np.linspace(2., 9.5, 67 + 1), dec_bins_logE]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)

    else:

        llh_model = ClassicLLH(sinDec_bins=dec_bins, sinDec_range=[-1., 1.])

    llh = StackingPointSourceLLH(arr_exp,
                                 arr_mc,
                                 livetime=livetime_IC59,
                                 llh_model=llh_model,
                                 seed=np.random.randint(2**32),
                                 **kwargs)

    return llh
コード例 #13
0
ファイル: kwargtry.py プロジェクト: brelethford/IceCube
def init40(**kwargs):
    energy = kwargs.pop('energy', True)
    arr_exp = cache.load(filename_pickle + "IC40/exp.pickle")
    arr_mc = cache.load(filename_pickle + "IC40/mc.pickle")

    dec_bins = np.unique(
        np.concatenate([
            np.linspace(-1., -0.25, 10 + 1),
            np.linspace(-0.25, 0.0, 5 + 1),
            np.linspace(0.0, 1., 10 + 1),
        ]))

    dec_bins_logE = np.unique(
        np.concatenate([
            np.linspace(-1., -0.25, 10 + 1),
            np.linspace(-0.25, 0.0, 10 + 1),
            np.linspace(0.0, 1., 10 + 1),
        ]))
    #These binnings are done, year specifically, in load.py from stefan.
    energy_bins = [np.linspace(2., 9., 75 + 1), dec_bins_logE]

    if energy:

        llh_model = EnergyLLH(energy_bins, sinDec_bins=dec_bins)

    else:

        llh_model = ClassicLLH(sinDec_bins=dec_bins, sinDec_range=[-1., 1.])
        print("using classic llh")
    llh = StackingPointSourceLLH(arr_exp,
                                 arr_mc,
                                 livetime=livetime_IC40,
                                 llh_model=llh_model,
                                 seed=np.random.randint(2**32),
                                 **kwargs)
    return llh