Gaia Queries¶
- agasc_gaia.gaia_queries.run_full_preliminary_cross_match(agasc_table='agasc', resume=False, n_batches=100, login=True)[source]¶
Do all the steps to make a preliminary cross-match between AGASC and Gaia DR3.
This process is repeated exactly for the normal “agasc” table, and for the background “agasc_bkg” table (which has randomly shifted positions).
This function will: - launch a number (n_batches) of cross-match jobs between {agasc_table} and gaiadr3.gaia_source - wait for all jobs to finish - upload the intermediate result tables to the Gaia archive (tables named {agasc_table}_{n}) - submit a query to join the intermediate tables - wait for this job, and upload the result to the Gaia archive (table {agasc_table}_gaia_index) - remove the intermediate tables - submit a final query with get_gaia_matches, which can be downloaded.
This function was written mostly to document all the steps. It is not really intended to be run on its own. It needs some oversight, because things can fail. For this reason, it has the “resume” option, which will skip steps that have already been done.
Admitedly this is not ideal. I would rather have a DAG of tasks, but the infrastructure is not setup for that, so the process evolved into this.
- Parameters:
- agasc_tablestr
The AGASC table to use. This is either “agasc” or “agasc_bkg”.
- resumebool
If True, skip steps that have already been done.
- n_batchesint
Number of batches to split the AGASC catalog into. Each batch will be cross-matched separately, and the results will be joined at the end.
- loginbool
If True, login to Gaia before starting.
- agasc_gaia.gaia_queries.cleanup(agasc_table, remove_index=False)[source]¶
Cleanup intermediate file and jobs from a preliminary cross-match between AGASC and Gaia.
- Parameters:
- agasc_tablestr
table name
- remove_indexbool, optional
whether to remove the YAML file with job IDs, by default False
- agasc_gaia.gaia_queries.get_query(oid_min, oid_max, agasc_table='agasc')[source]¶
Get the query for a preliminary AGASC-Gaia match, restricted to a range of AGASC OIDs.
- Parameters:
- oid_minint
The minimum AGASC OID to include in the match. OID is the primary key in the AGASC table.
- oid_maxint
The maximum AGASC OID to include in the match. OID is the primary key in the AGASC table.
- agasc_tablestr, optional
Agasc table to use, by default “agasc”. It can be a sub-query.
- Returns:
- str
a query for Gaia
- agasc_gaia.gaia_queries.get_gaia_matches(agasc_ids, radius=1.5, neighborhood_radius=None, debug=False, jobid=None)[source]¶
Convenience method to make a rough match between AGASC and Gaia. NOT used in the final analysis. Useful for debugging.
- agasc_gaia.gaia_queries.get_gaia_cone(agasc_id=None, radius=0.0004166666666666667, debug=False, name=None)[source]¶
Convenience method to get Gaia stars in a cone. NOT used in the final analysis.
- agasc_gaia.gaia_queries.match_probability(d_mag, d2d)[source]¶
Rough estimate of the matching probability, as a function of magnitude and position differences.
This is NOT used in the final analysis. It was used in an intermediate stage.
The probability is given by two Gaussian factors:
- where:
The radial factor is a 2d Gaussian ~ r exp(-r^2/sigma^2), with sigma = 1.5 arcsec
The magnitude factor is a Gaussian with sigma = 0.2. This value comes from the magnitude model fit.