creanero / stellar_matchmaker

MIT License
1 stars 1 forks source link

Implement GAIA name search on target #35

Open creanero opened 1 month ago

creanero commented 1 month ago

Develop a method for querying a target by Gaia or other identifier. This may require connecting to SIMBAD because Gaia does not support direct query by common name. This stackoverflow response seems to be on point: https://numpy.org/doc/stable/reference/generated/numpy.where.html

The minimal example

from astroquery.simbad import Simbad

result_table = Simbad.query_objectids("eta carinae")

for x in result_table:
    if 'gaia' in x['ID'].lower():
        print(x['ID'])

returns the string 'Gaia DR3 5350358584482202880' which includes the Gaia ID

Subsequently, it is possible to query Gaia with the following minimal example

from astroquery.gaia import Gaia
job = Gaia.launch_job("SELECT ra, dec, phot_g_mean_mag, phot_bp_mean_mag, phot_rp_mean_mag FROM gaiadr3.gaia_source WHERE source_id = 5350358584482202880")

job.results returns a table containing the RA, dec and magnitudes of eta carinae.

Based on this example, it should be possible for the user to input a target by name, and return parameters which can be used to set the target parameters.