# For each defined redshift, eval the photometry and store on the database. db_m = db.get('/%s/%s/%s' % (filterid, ccd, 'library')) i_z = 0 for z in np.arange(z_from, z_to, z_step): if z == 0: d_L = 3.08567758e19 # 10 parsec in cm else: d_L = cosmocalc.cosmocalc(z)['DL_cm'] k_cosmo = L_sun / ( 4 * np.pi * np.power(d_L,2) ) O = zcor(obs_spec, z) O['flux'] = O['flux'] * k_cosmo x = spec2filterset(f.filterset, O, dlambda_eff = 3.0) # print 'z', z # print aux0[i_base] # # plt.figure(1) # plt.clf() # plt.plot(O['wl'][kk], O['flux'][kk]) # plt.figure(2) # plt.clf() # plt.plot(f.filteravgwls, x, '.') db_m[i_z, i_base + aux_basesize*i_av] = x i_z = i_z + 1
pystarlight.io.starlighttable.__file__ ) ts = atpy.TableSet(obs_test_file, type="starlight_input") obs_spec = np.copy( ts.starlight_input.data.view(dtype=np.dtype([("wl", "<f8"), ("flux", "<f8"), ("error", "<f8"), ("flag", "<i8")])) ) model_spec["flux"] = model_spec["flux"] * tm.keywords["fobs_norm"] * 1e-17 obs_spec["flux"] = obs_spec["flux"] * 1e-17 obs_spec["error"] = obs_spec["error"] * 1e-17 # print spec2filter(filter, obs_spec, model_spec, log_level=logging.DEBUG) plt.clf() c = photoconv() x = spec2filterset(f.filterset, obs_spec, model_spec, dlambda_eff=3.0) plt.plot(f.filteravgwls, x["m_ab"]) for z in np.arange(0.1, 1, 0.2): print "z ==", z O = zcor(obs_spec, z) M = zcor(model_spec, z) x = spec2filterset(f.filterset, O, M, dlambda_eff=3.0) plt.plot(f.filteravgwls, x["m_ab"]) if z > 0.3: plt.plot(O["wl"], -2.5 * np.log10(O["flux"] * (O["wl"] ** 2) / c_AngSec) - 48.6, color="black", alpha=0.3) plt.plot(M["wl"], -2.5 * np.log10(M["flux"] * (M["wl"] ** 2) / c_AngSec) - 48.6, color="blue", alpha=0.3) raw_input() print "test 1" raw_input("Enter for next test...") print c.fromStarlight(f.filterset, ts, tm, dlambda_eff=3.0)