def add_w(t): ws = gen.map_np(gen.w, t["de_rad"], t["plx"], t["pm_ra"], t["pm_de"], np.zeros(len(t))) t.add_column(table.Column(data=ws[:, 0, 0], name="w1", unit="km / s")) t.add_column(table.Column(data=ws[:, 1, 0], name="w2", unit="1 / yr")) t.add_column(table.Column(data=ws[:, 2, 0], name="w3", unit="1 / yr")) t["w1"].axis_label = "$w_1$" t["w2"].axis_label = "$w_2$" t["w3"].axis_label = "$w_3$"
def add_v_proj(t): ws = gen.XD_arr(t, "w1", "w2", "w3") vs = gen.map_np(gen.v_proj, ws, t["R^-1"]) t.add_column(table.Column(data=vs[:, 0], name="v_x", unit="km / s")) t["v_x"].axis_label = "$v_x$" t.add_column(table.Column(data=vs[:, 1], name="v_y", unit="km / s")) t["v_y"].axis_label = "$v_y$" t.add_column(table.Column(data=vs[:, 2], name="v_z", unit="km / s")) t["v_z"].axis_label = "$v_z$"
def reconstruct_v_from_astrometry(t): cols_already_in_t = [ col for col in ("v_x_R", "v_y_R", "v_z_R") if col in t.keys() ] if cols_already_in_t: raise gen.GFC_Exception( "\n\ngaia_fc.simulated.reconstruct_v_from_astrometry: The following columns are already in the table: {0}" .format(cols_already_in_t)) w = np.vstack((t["w1"], t["w2"], t["w3"])).T reconstr = gen.map_np(lambda A, w: A.dot(w), t["A"], w) t.add_column(table.Column(data=reconstr[:, 0], name="v_x_R", unit="km / s")) t["v_x_R"].axis_label = r"$v_x (R)$" t.add_column(table.Column(data=reconstr[:, 1], name="v_y_R", unit="km / s")) t["v_y_R"].axis_label = r"$v_y (R)$" t.add_column(table.Column(data=reconstr[:, 2], name="v_z_R", unit="km / s")) t["v_z_R"].axis_label = r"$v_z (R)$"
def add_A(t): all_A = gen.map_np(gen.A, t["phi"], t["theta"]) t.add_column(table.Column(data=all_A, name="A"))
def add_Rr_and_Rt(t): Rrs = gen.map_np(gen.R_r, t["r_hat"]) Rts = np.identity(3) - Rrs t.add_column(table.Column(data=Rrs, name="R_r")) t.add_column(table.Column(data=Rts, name="R_t"))
def add_rhat(t): rhats = gen.map_np(rhat_row, t) t.add_column(table.Column(data=rhats, name="r_hat"))
def add_S(t): Ss = gen.map_np(gen.S, t["C"], t["Q"]) t.add_column(table.Column(data=Ss, name="S"))
def add_Q(t): Qs = gen.map_np(gen.Q_star, t["plx"], t["pm_ra"], t["pm_de"]) # no pmap t.add_column(table.Column(data=Qs, name="Q"))
def add_C(t): Cs = gen.map_np(C_row, t) # pmap crashes t.add_column(table.Column(data=Cs, name="C"))
def add_A(t): As = gen.map_np(gen.A, t["ra_rad"], t["de_rad"]) t.add_column(table.Column(data=As, name="A"))