Skip to content

Commit 76bb0c8

Browse files
committed
ADES astCat check is case insensitive
1 parent 83ef815 commit 76bb0c8

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

grss/fit/fit_ades.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
'6': 'Gaia_2016',
102102
}
103103
# flip the dictionary to get the catalog codes
104-
ades_catalog_map = {v: k for k, v in ades_catalog_map.items()}
104+
ades_catalog_map = {v.lower(): k for k, v in ades_catalog_map.items()}
105105

106106
# from ADES-Master/Python/bin/packUtil.py
107107
pack_letters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'

grss/fit/fit_optical.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,15 @@ def _ades_ast_cat_check(df):
9090
"""
9191
# from https://www.minorplanetcenter.net/iau/info/ADESFieldValues.html
9292
valid_cats = list(ades_catalog_map.keys())
93-
deprecated_cats = [
94-
'UCAC3', 'UCAC2', 'UCAC1',
95-
'USNOB1', 'USNOA2', 'USNOSA2', 'USNOA1', 'USNOSA1',
96-
'Tyc2', 'Tyc1', 'Hip2', 'Hip1', 'ACT',
97-
'GSCACT', 'GSC2.3', 'GSC2.2', 'GSC1.2', 'GSC1.1', 'GSC1.0', 'GSC',
98-
'SDSS8', 'SDSS7', 'CMC15', 'CMC14', 'SSTRC4', 'SSTRC1',
99-
'MPOSC3', 'PPM', 'AC', 'SAO1984', 'SAO', 'AGK3', 'FK4',
100-
'ACRS', 'LickGas', 'Ida93', 'Perth70', 'COSMOS',
101-
'Yale', 'ZZCAT', 'IHW', 'GZ', 'UNK']
102-
df_cats = df['astCat']
93+
df_cats = df['astCat'].str.lower()
10394
if not df_cats.isin(valid_cats).all():
10495
invalid_cats = np.setdiff1d(df_cats.unique(), valid_cats)
10596
print("\tWARNING: At least one unrecognized astCat in the data. "
10697
f"Unrecognized values are {invalid_cats}. "
107-
"Force deleting corresponding observations and setting catalog to UNK...")
108-
delete_idx = df[df['astCat'].isin(invalid_cats)].index
98+
"Force deleting corresponding observations. "
99+
"This can still lead to errors in processing the data...")
100+
delete_idx = df[df_cats.isin(invalid_cats)].index
109101
df.loc[delete_idx, 'selAst'] = 'd'
110-
df.loc[delete_idx, 'astCat'] = 'UNK'
111102
return df
112103

113104
def create_optical_obs_df(body_id, optical_obs_file=None, t_min_tdb=None,
@@ -508,7 +499,7 @@ def apply_debiasing_scheme(obs_df, lowres, verbose):
508499
print("Applying Eggl et al. (2020) debiasing scheme to the observations.")
509500
df_groups = obs_df.groupby('astCat')
510501
for cat, group in df_groups:
511-
cat_code = ades_catalog_map[cat]
502+
cat_code = ades_catalog_map[cat.lower()]
512503
if cat_code in unbiased_catalogs:
513504
obs_df.loc[group.index, 'biasRA'] = 0.0
514505
obs_df.loc[group.index, 'biasDec'] = 0.0
@@ -604,7 +595,7 @@ def apply_station_weight_rules(group, obs_df, cols, verbose):
604595
default_weight_counter = 0
605596
all_times = obs_df.loc[group.index, 'obsTimeMJD'].values
606597
all_stns = obs_df.loc[group.index, 'stn'].values
607-
all_cats = obs_df.loc[group.index, 'astCat'].values
598+
all_cats = obs_df.loc[group.index, 'astCat'].str.lower().values
608599
all_progs = obs_df.loc[group.index, 'prog'].values
609600
ccd_weight_arr = np.ones((len(group), 2))*np.nan
610601
for i in range(len(group)):

grss/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.5.3
1+
4.5.4

0 commit comments

Comments
 (0)