inj = PointSourceInjector(Gamma, sinDec_bandwidth=.05, src_dec=src_dec, seed=0) else: inj = PointSourceInjector(Gamma, sinDec_bandwidth=.05, src_dec=src_dec, theo_weight=modelweights['{}'.format(injweight)], seed=0) sensitivity = MultiPointSourceLLH.weighted_sensitivity(llhmodel, src_ra=src_ra, src_dec=src_dec, alpha=.5, beta=.9, inj=inj, trials={ 'n_inj': [], 'TS': [], 'nsources': [], 'gamma': [] }, bckg_trials=bckg_trials, eps=100., n_iter=1) print('Sensitivity mu = ' + str(musens) + ', flux =' + str(inj.mu2flux(musens))) print('Discovery flux =' + str(mudisc) + ', flux =' + str(inj.mu2flux(mudisc)))
## Like in the background trials, we have to define which llhmodel to use. if llhweight == 'uniform': llh79 = data_multi.init79(energy=True) llh59= data_multi.init59(energy=True) llh40= data_multi.init40(energy=True) else: llh40= data_multi.init40(energy=True, weighting = modelweights['{}'.format(llhweight)]) llh79 = data_multi.init79(energy=True, weighting = modelweights['{}'.format(llhweight)]) llh59= data_multi.init59(energy=True, weighting = modelweights['{}'.format(llhweight)]) #We've loaded in the appropriate llh samples, now let's put them both in the blender (not sure about weighting) samples = [llh40,llh59,llh79] llhmodel = data_multi.multi_init(samples,energy=True) ##Remember, weighted sensitivity requires src dec in radians.# ##Now, I'll input my injection weighting scheme from the commandline. ## if injweight == 'uniform': inj = PointSourceInjector(Gamma, sinDec_bandwidth=.05, src_dec= src_dec, seed=0) else: inj = PointSourceInjector(Gamma, sinDec_bandwidth=.05, src_dec= src_dec, theo_weight = modelweights['{}'.format(injweight)], seed=0) sensitivity = MultiPointSourceLLH.weighted_sensitivity(llhmodel,src_ra=src_ra,src_dec=src_dec,alpha=.5,beta=.9,inj=inj,trials={'n_inj':[],'TS':[],'nsources':[],'gamma':[]},bckg_trials=bckg_trials,eps=100.,n_iter=1) print ('Sensitivity mu = ' + str(musens)+', flux =' + str(inj.mu2flux(musens))) print ('Discovery flux =' + str(mudisc)+', flux =' +str(inj.mu2flux(mudisc)))