示例#1
0
i = args.i
istr = "%05d" % i

np.random.seed(i)

difftype = args.difftype
time = args.time
position = args.position
emin = args.emin
emax = args.emax

diffdir = "/afs/slac/g/glast/groups/diffuse/rings/2year/"

iso = get_background(join(diffdir, "isotrop_2year_P76_source_v0.txt"))
ring = get_background(join(diffdir, "ring_2year_P76_v0.fits"))
sreekumar = get_sreekumar(diff_factor=1)

if difftype == "galactic":
    for p in iso.smodel.param_names:
        iso.smodel.freeze(p)
    ring.smodel = Constant()
    diffuse_sources = [iso, ring]
elif difftype == "isotropic":
    diffuse_sources = [iso]
elif difftype == "sreekumar":
    diffuse_sources = [sreekumar]

tempdir = mkdtemp(prefix="/scratch/")

if position == "highlat":
    while True:
示例#2
0
np.random.shuffle(extensions)

# formula to interpolate from the flux at lowest to highest extension
flux_mc = lambda extension: np.exp(np.log(min_flux_mc) + 
                                   (np.log(max_flux_mc) - np.log(min_flux_mc))*\
                                   (extension-min(extensions))/(max(extensions)-min(extensions)))

index_mc = args.index

emin=1e2
emax=1e5
irf="P7SOURCE_V6"

skydir_mc = SkyDir()

bg = get_sreekumar()

ft2 = dict2fgl['ft2']
ltcube = dict2fgl['ltcube']

results = []

for extension_mc in extensions:

    print 'Looping over extension_mc=%g' % extension_mc

    model_mc = PowerLaw(index=index_mc)
    model_mc.set_flux(flux_mc(extension_mc), emin, emax)

    r = dict(
        type = args.type,
示例#3
0
if source == 'W44':
    skydir = SkyDir(284.005,1.345)
    gtifile = '/u/gl/funk/data/GLAST/ExtendedSources/NewAnalysis/gtlike/W44/sel_W44_60_100000.fits'
elif source == 'IC443':
    skydir = SkyDir(94.310,22.580)
    gtifile = '/u/gl/funk/data/GLAST/ExtendedSources/NewAnalysis/gtlike/IC443/sel_IC443_60_100000.fits'


if args.diffuse == 'galactic':
    ds = get_default_diffuse(
        diffdir="/nfs/slac/g/ki/ki03/lande/fermi/diffuse/",
        gfile="gal_2yearp7v6_v0.fits",
        ifile="iso_p7v6source.txt")
elif args.diffuse == 'sreekumar':
    ds = [ get_sreekumar() ]
elif args.diffuse == 'nobackground':
    ds = []
elif args.diffuse == 'extrapolated':
    ds = get_background(
        "/afs/slac/g/glast/groups/scienceTools/bugs/Likelihood/energy_dispersion/Simulations/galdif_extended.fits",
        '/nfs/slac/g/ki/ki03/lande/fermi/diffuse/iso_p7v6source_extrapolated.txt')
else: 
    raise Exception("...")


ps,ds = catalog.merge_lists(skydir, radius=15, user_diffuse_list=ds)

d = {s.name:s for s in ds}

if source == 'W44':