Skip to content

Commit b71d0d3

Browse files
Merge pull request #102 from rahil-makadia/dev
ADES astCat check is case insensitive
2 parents 97acee7 + 76bb0c8 commit b71d0d3

File tree

7 files changed

+12
-22
lines changed

7 files changed

+12
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Once the GRSS library has been installed, it can be imported into a Python scrip
8282
import grss
8383
```
8484

85-
The first time the library is imported, it will download some data files such as NAIF SPICE kernels and the data needed to debias optical astrometry. This should should take a few minutes. Once these files are available to the library, you are ready to use GRSS to its full potential!
85+
The first time the library is imported, it will download some data files such as NAIF SPICE kernels and the data needed to debias optical astrometry. This should take a few minutes. Once these files are available to the library, you are ready to use GRSS to its full potential!
8686

8787
Check out the [examples](https://rahil-makadia.github.io/grss/examples.html) on the [GRSS website](https://rahil-makadia.github.io/grss/) to get started.
8888

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channels:
33
- conda-forge
44
- defaults
55
dependencies:
6-
- python>=3.8,<3.13
6+
- python>=3.10,<=3.13
77
- pip
88
- jupyter
99
- ipykernel

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

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ classifiers = [
3131
"Programming Language :: C++",
3232
"Programming Language :: Python :: 3",
3333
"Programming Language :: Python :: 3 :: Only",
34-
"Programming Language :: Python :: 3.8",
35-
"Programming Language :: Python :: 3.9",
3634
"Programming Language :: Python :: 3.10",
3735
"Programming Language :: Python :: 3.11",
3836
"Programming Language :: Python :: 3.12",
37+
"Programming Language :: Python :: 3.13",
3938
"Topic :: Scientific/Engineering :: Astronomy",
4039
]
4140

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
4646
# if os is windows, throw error and exit
4747
if os.name == "nt":
4848
raise OSError("Windows is not supported.",
49-
"Please use the Windows Subsystem for if you do not have access to another OS.")
49+
"Please use the Windows Subsystem for Linux if you do not have access to another OS.")
5050

5151
setup(
5252
ext_modules=[CMakeExtension("libgrss")],

0 commit comments

Comments
 (0)