seds.append(gStar) seds.append(mStar) for sed in seds: sed.flambdaTofnu() filtDir = os.environ["LSST_THROUGHPUTS_BASELINE"] for airmass, zd in zip((15, 11), (50, 30)): for sidx, sed in enumerate(seds): for bpname in ("g", "r", "i"): bp = Bandpass(wavelen_max=1200) components = common_components + [os.path.join(tp_dir, "baseline", "filter_%s.dat" % (bpname)), os.path.join(tp_dir, "atmos", "atmos_%d.dat" % (airmass))] #print components bp.readThroughputList(components) bp.sbTophi() wavelen = sed.wavelen fnu = sed.fnu wavelen, fnu = sed.resampleSED(wavelen, fnu, wavelen_match=bp.wavelen) wavelenf, flambda = sed.fnuToflambda(wavelen, fnu) waveleng = gStar.wavelen fnug = gStar.fnu waveleng, fnug = gStar.resampleSED(waveleng, fnug, wavelen_match=bp.wavelen) wavelenfg, flambdag = gStar.fnuToflambda(waveleng, fnug) flux = fnu * bp.phi fluxg = fnug * bp.phi leff1 = np.exp(np.sum(fnu * bp.phi * np.log(wavelen)) / np.sum(fnu * bp.phi))
if __name__ == "__main__": pickleFile = "calculateSedDcr3.pickle" if not os.path.isfile(pickleFile): catDir = os.environ["CAT_SHARE_DATA"] filtDir = os.environ["LSST_THROUGHPUTS_BASELINE"] uBand = Bandpass() gBand = Bandpass() rBand = Bandpass() iBand = Bandpass() zBand = Bandpass() uBand.readThroughput(os.path.join(filtDir, "total_u.dat")) gBand.readThroughput(os.path.join(filtDir, "total_g.dat")) rBand.readThroughput(os.path.join(filtDir, "total_r.dat")) iBand.readThroughput(os.path.join(filtDir, "total_i.dat")) zBand.readThroughput(os.path.join(filtDir, "total_z.dat")) uBand.sbTophi() gBand.sbTophi() rBand.sbTophi() iBand.sbTophi() zBand.sbTophi() seen = [] for line in open(sys.argv[1]).readlines()[1:]: sed, mag, nsed = line.split() # These seem to have funky colors # Leading to u-band refraction RMS residuals of 0.06-0.07" # Without it is 0.01" if sed.startswith("burrows") or sed.startswith("L"): continue
wavelen = sed.wavelen fnu = sed.fnu if sed.needResample(wavelen=wavelen, wavelen_match=bp.wavelen): wavelen, fnu = sed.resampleSED(wavelen, fnu, wavelen_match=bp.wavelen) return np.sum(fnu * bp.phi) if __name__ == "__main__": import multiprocessing pool = multiprocessing.Pool(multiprocessing.cpu_count()-2) filtDir = os.environ["LSST_THROUGHPUTS_BASELINE"] gBand = Bandpass() rBand = Bandpass() gBand.readThroughput(os.path.join(filtDir, "total_g.dat")) rBand.readThroughput(os.path.join(filtDir, "total_r.dat")) gBand.sbTophi() rBand.sbTophi() catDir = os.environ["CAT_SHARE_DATA"] args = [] for line in open(sys.argv[1]).readlines()[1:]: sed, mag, nsed = line.split() mag = float(mag) if mag < 16 or mag > 25: continue args.append((line, gBand, rBand, catDir)) results = pool.map(doit, args) grs = []