Skip to content

Commit 09e11eb

Browse files
committed
fixes for query
1 parent 7efb8b5 commit 09e11eb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

pbjam/query.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
## Convenience functions for looking up bp_rp (and teff),
22
## rescued from pbjam1
33

4+
import re
45
import time
6+
from astropy import units
57
from astroquery.mast import ObservationsClass as AsqMastObsCl
68
from astroquery.mast import Catalogs
79
from astroquery.simbad import Simbad
810
from astroquery.gaia import Gaia
911

1012
def _querySimbad(ID):
11-
""" Query simbad for Gaia DR2 source ID.
13+
""" Query simbad for Gaia DR3 source ID.
1214
13-
Looks up the target ID on Simbad to check if it has a Gaia DR2 ID.
15+
Looks up the target ID on Simbad to check if it has a Gaia DR3 ID.
1416
1517
The input ID can be any commonly used identifier, such as a Bayer
1618
designation, HD number or KIC.
@@ -28,7 +30,7 @@ def _querySimbad(ID):
2830
Returns
2931
-------
3032
gaiaID : str
31-
Gaia DR2 source ID. Returns None if no Gaia ID is found.
33+
Gaia DR3 source ID. Returns None if no Gaia ID is found.
3234
"""
3335

3436
print('Querying Simbad for Gaia ID')
@@ -40,7 +42,9 @@ def _querySimbad(ID):
4042
return None
4143

4244
for line in job['id']: # as of astroquery >= 0.4.8, this is lowercase
43-
if 'Gaia DR2' in line:
45+
if 'Gaia DR3' in line:
46+
return line.replace('Gaia DR3 ', '')
47+
elif 'Gaia DR2' in line:
4448
return line.replace('Gaia DR2 ', '')
4549
return None
4650

@@ -186,6 +190,7 @@ def _format_name(name):
186190

187191
# Add naming exceptions here
188192
variants = {'KIC': ['kic', 'kplr', 'KIC'],
193+
'Gaia DR3': ['gaia dr3', 'gdr3', 'dr3', 'Gaia DR3'],
189194
'Gaia DR2': ['gaia dr2', 'gdr2', 'dr2', 'Gaia DR2'],
190195
'Gaia DR1': ['gaia dr1', 'gdr1', 'dr1', 'Gaia DR1'],
191196
'EPIC': ['epic', 'ktwo', 'EPIC'],
@@ -208,7 +213,7 @@ def get_spec(ID):
208213
""" Search online for bp_rp and Teff values based on ID.
209214
210215
First a check is made to see if the target is a TIC number, in which case
211-
the TIC will be queried, since this is already cross-matched with Gaia DR2.
216+
the TIC will be queried, since this is already cross-matched with Gaia DR3.
212217
213218
If it is not a TIC number, Simbad is queries to identify a possible Gaia
214219
source ID.
@@ -235,7 +240,7 @@ def get_spec(ID):
235240
ID = _format_name(ID)
236241

237242
if 'TIC' in ID:
238-
bp_rp = _queryTIC(ID)
243+
res = _queryTIC(ID)
239244

240245
else:
241246
try:
@@ -249,4 +254,4 @@ def get_spec(ID):
249254
print(f'Unable to retrieve a bp_rp and Teff value for {ID}.')
250255
res = None
251256

252-
return res
257+
return res

0 commit comments

Comments
 (0)