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)) leff2 = np.exp(np.sum(flambda * bp.phi * np.log(wavelenf)) / np.sum(flambda * bp.phi)) leff1g = np.exp(np.sum(fnug * bp.phi * np.log(waveleng)) / np.sum(fnug * bp.phi)) leff2g = np.exp(np.sum(flambdag * bp.phi * np.log(wavelenfg)) / np.sum(flambdag * bp.phi)) off1 = refract(leff1*10**-3, zd * np.pi / 180.) * 180. / np.pi * 3600. off2 = refract(leff2*10**-3, zd * np.pi / 180.) * 180. / np.pi * 3600. off = refract(wavelen*10**-3, zd * np.pi / 180.) * 180. / np.pi * 3600. off = np.sum(off * flux) / np.sum(flux)