Skip to content

Commit

Permalink
Improving query based on CDS developer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanmartim committed Jan 28, 2025
1 parent 5a93760 commit 1f7d6af
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions python/lsst/ts/observatory/control/base_tcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1683,14 +1683,14 @@ async def find_target_simbad(

customSimbad = Simbad()

customSimbad.add_votable_fields("mesdistance", "V")
customSimbad.add_votable_fields("V", "rvz_redshift", "ident")
customSimbad.TIMEOUT = self.long_long_timeout

radec = self.radec_from_azel(az=az, el=el)

# Build the ADQL-like criteria for V magnitude + HD catalog
criteria = (
f"V>{mag_limit} AND V<{mag_limit + mag_range} " f"AND main_id LIKE 'HD%'"
f"V>{mag_limit} AND V<{mag_limit + mag_range} AND ident.id LIKE 'HD%'"
)

query_callable = partial(
Expand All @@ -1700,7 +1700,6 @@ async def find_target_simbad(
criteria=criteria,
)

# Execute the query_region asynchrnously
loop = asyncio.get_event_loop()
try:
result_table = await loop.run_in_executor(None, query_callable)
Expand All @@ -1715,16 +1714,16 @@ async def find_target_simbad(
result_table.sort("V")

# Pick the first (brightest) match
target_main_id = str(result_table["main_id"][0])
target_ident_id = str(result_table["id"][0])

radec_icrs = ICRS(
ra=Angle(result_table[0]["ra"], unit=u.deg),
dec=Angle(result_table[0]["dec"], unit=u.deg),
)

self.object_list_add(f"{target_main_id}".rstrip(), radec_icrs)
self.object_list_add(f"{target_ident_id}".rstrip(), radec_icrs)

return f"{target_main_id}".rstrip()
return f"{target_ident_id}".rstrip()

async def find_target_local_catalog(
self,
Expand Down

0 comments on commit 1f7d6af

Please sign in to comment.