def medianLabel(config, emin, emax): if config[:2] == 'IC': median, sigL, sigR = readDist_IC(config, emin, emax) if config[:2] == 'IT': median, sigL, sigR = readDist_IT(config, emin, emax) median = 10**(9+median) median = round(median, -int(math.floor(math.log10(median))) + 1) if median >= 1e15: return '%.1fPeV' % (median / 1e15) if median >= 1e12: if median >= 1e13: return '%iTeV' % (median / 1e12) return '%.1fTeV' % (median / 1e12)
) p.add_argument("-o", "--out", dest="out", default=None, help="Option to write to file") args = p.parse_args() if args.files == "config": files = glob.glob("%s/IC?*_24H_sid.fits" % my.ani_maps) configs = np.array([os.path.basename(f).split("_")[0] for f in files]) csort = configs.argsort() configs, files = configs[csort], np.asarray(files)[csort] x = range(len(configs)) smooth = 5 if args.files == "energy": files = getEnergyMaps("IC") ebins = [float(i) for i in getEbins()] nbins = len(ebins) - 1 x = [readDist_IC("IC", ebins[i], ebins[i + 1])[0] for i in range(nbins)] xL = [readDist_IC("IC", ebins[i], ebins[i + 1])[1] for i in range(nbins)] xR = [readDist_IC("IC", ebins[i], ebins[i + 1])[2] for i in range(nbins)] # x = getMids(ebins, infvalue=100) smooth = 20 # Custom treatment of IT map files += [["{}/IT_24H_sid_STA8.fits".format(my.ani_maps)]] # x = np.append(x, np.log10(2*10**6)) median, sigL, sigR = readDist_IT("IT", 8, 100) x += [median] xL += [sigL] xR += [sigR] if args.files == "comp": files = glob.glob("%s/IT_24H_sid_STA8_?.fits" % my.ani_maps) comps = [f[-6] for f in files] # comp2e = {'p':1.,'h':2.,'o':8.,'f':26.}