Skip to content

Commit

Permalink
Fix Gaia/XHIP distance selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtribick committed Feb 15, 2022
1 parent 7afd84f commit 717a546
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
1 change: 0 additions & 1 deletion celestia_gaia/make_stardb.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ def process_data() -> Table:
unknown_spectra = estimate_spectra(unknown_spectra)
data = join(
data,

unknown_spectra['HIP', 'CelSpec'],
keys=['HIP'],
join_type='left',
Expand Down
28 changes: 22 additions & 6 deletions celestia_gaia/parse_hip.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,31 @@ def process_hip(data: Table) -> Table:

data = join(data, load_sao(), keys=['HIP'], join_type='left')

data['r_est_gaia'] = data['r_est_gaia'].filled(np.nan)
data['r_est_xhip'] = data['r_est_xhip'].filled(np.nan)

data['r_gaia_score'] = np.where(
data['r_est_gaia'].mask,
-20000.0,
np.where(data['parallax'] <= 0, -10000.0, data['parallax'] / data['parallax_error']),
)
data['r_xhip_score'] = np.where(data['Plx'] <= 0, -10000.0, data['Plx'] / data['e_Plx'])
data['parallax'] <= 0,
-10000.0,
data['parallax'] / data['parallax_error'])

data['r_xhip_score'] = np.where(
data['Plx'] <= 0,
-10000.0,
data['Plx'] / data['e_Plx'])

data['dist_use'] = np.where(
data['r_gaia_score'] >= data['r_xhip_score'], data['r_est_gaia'], data['r_est_xhip']
np.isnan(data['r_est_gaia']),
data['r_est_xhip'],
np.where(
np.isnan(data['r_est_xhip']),
data['r_est_gaia'],
np.where(
data['r_gaia_score'] >= data['r_xhip_score'],
data['r_est_gaia'],
data['r_est_xhip']
)
)
)
data['dist_use'].unit = u.pc

Expand Down

0 comments on commit 717a546

Please sign in to comment.