From 7aa09b9b570d4d4535f624bd8021800c29a6c875 Mon Sep 17 00:00:00 2001 From: Tomas Stolker Date: Tue, 18 Jun 2024 09:53:11 +0200 Subject: [PATCH] Store astrophysical parameters in output dictionary --- calistar/calistar.py | 57 +++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/calistar/calistar.py b/calistar/calistar.py index f9c7acd..62d1329 100644 --- a/calistar/calistar.py +++ b/calistar/calistar.py @@ -298,10 +298,17 @@ def target_star( float(gaia_result["parallax_error"][0]), # (mas) ) - target_dict[f"GAIA/GAIA{self.gaia_idx}.G"] = ( - float(gaia_result["phot_g_mean_mag"][0]), - mag_g_error, - ) + if "phot_g_mean_mag" in gaia_result.columns: + if not np.ma.is_masked(gaia_result["phot_g_mean_mag"][0]): + target_dict[f"GAIA/GAIA{self.gaia_idx}.G"] = ( + float(gaia_result["phot_g_mean_mag"][0]), + mag_g_error, + ) + + print( + f"\nG mag = {gaia_result['phot_g_mean_mag'][0]:.6f} +/- {mag_g_error:.6f}" + ) + if "phot_bp_mean_mag" in gaia_result.columns: if not np.ma.is_masked(gaia_result["phot_bp_mean_mag"][0]): @@ -310,6 +317,10 @@ def target_star( mag_bp_error, ) + print( + f"BP mag = {gaia_result['phot_bp_mean_mag'][0]:.6f} +/- {mag_bp_error:.6f}" + ) + if "phot_rp_mean_mag" in gaia_result.columns: if not np.ma.is_masked(gaia_result["phot_rp_mean_mag"][0]): target_dict[f"GAIA/GAIA{self.gaia_idx}.Grp"] = ( @@ -317,6 +328,10 @@ def target_star( mag_rp_error, ) + print( + f"RP mag = {gaia_result['phot_rp_mean_mag'][0]:.6f} +/- {mag_rp_error:.6f}" + ) + if "grvs_mag" in gaia_result.columns: if not np.ma.is_masked(gaia_result["grvs_mag"][0]): target_dict[f"GAIA/GAIA{self.gaia_idx}.Grvs"] = ( @@ -324,6 +339,12 @@ def target_star( float(gaia_result["grvs_mag_error"][0]), ) + print( + f"GRVS mag = {gaia_result['grvs_mag'][0]:.6f} " + f"+/- {gaia_result['grvs_mag_error'][0]:.6f}" + ) + + # Create SkyCoord object from the RA and Dec of the selected Gaia source ID gaia_coord = SkyCoord( @@ -376,29 +397,6 @@ def target_star( f"+/- {gaia_result['radial_velocity_error'][0]:.2f} km/s" ) - print( - f"\nG mag = {gaia_result['phot_g_mean_mag'][0]:.6f} +/- {mag_g_error:.6f}" - ) - - if "phot_bp_mean_mag" in gaia_result.columns: - if not np.ma.is_masked(gaia_result["phot_bp_mean_mag"][0]): - print( - f"BP mag = {gaia_result['phot_bp_mean_mag'][0]:.6f} +/- {mag_bp_error:.6f}" - ) - - if "phot_rp_mean_mag" in gaia_result.columns: - if not np.ma.is_masked(gaia_result["phot_rp_mean_mag"][0]): - print( - f"RP mag = {gaia_result['phot_rp_mean_mag'][0]:.6f} +/- {mag_rp_error:.6f}" - ) - - if "grvs_mag" in gaia_result.columns: - if not np.ma.is_masked(gaia_result["grvs_mag"][0]): - print( - f"GRVS mag = {gaia_result['grvs_mag'][0]:.6f} " - f"+/- {gaia_result['grvs_mag_error'][0]:.6f}" - ) - if "teff_gspphot" in gaia_result.columns: if not np.ma.is_masked(gaia_result["teff_gspphot"]): print( @@ -408,6 +406,11 @@ def target_star( print(f"Metallicity = {gaia_result['mh_gspphot'][0]:.2f}") print(f"G-band extinction = {gaia_result['ag_gspphot'][0]:.2f}") + target_dict["teff"] = float(gaia_result['teff_gspphot'][0]) + target_dict["log(g)"] = float(gaia_result['logg_gspphot'][0]) + target_dict["metallicity"] = float(gaia_result['mh_gspphot'][0]) + target_dict["ag_ext"] = float(gaia_result['ag_gspphot'][0]) + print( f"\nAstrometric excess noise = {gaia_result['astrometric_excess_noise'][0]:.2f}" )