Association & Catalog Matching

radioxmatch.py contains all the machinery for cross-matching radio point sources.

Adapted from EP’s VSLOW.py.

matching.radioxmatch.associate(conn, detected_sources, imobj, search_radius, save)[source]

Associates new sources with old sources if the center positions of the two sources are separated by an angular distance less than half the size of semi-minor axis of the current image’s beam.

Parameters:
  • conn (psycopg2.extensions.connect instance) – The PostgreSQL database connection object.
  • detected_sources (list) – List of the sources extracted from the current image.
  • imobj (database.dbclasses.Image instance) – Initialized Image object with attribute values set from header info & updated with source finding results.
  • search_radius (float) – Size of the circular search region in degrees.
  • save (bool) – If False, print the results to the console and/or log file.
Returns:

  • detected_matched (list) – Sources extracted from the image that were successfully associated with previously detected sources stored in the assoc_source table.
  • detected_unmatched (list) – Sources extracted from the image which could NOT be successfully associated with previously detected sources. These are added to the assoc_table as new detections and then cross-matched with other radio catalogs.
  • assoc_matched (list) – Previously detected sources from the assoc_source table which were successfully associated with sources from the new image. Positions of these sources are updated in the assoc_source table to reflect the weighted average of all detections. The number of detections (‘ndetect’) is increased by one.
  • assoc_unmatched (list) – Previously detected sources from the assoc_source table which were not successfully associated with sources from the new image. Any of these non-detections with no radio catalog matches (‘nmatches’ = 0) are recorded in the vlite_unique table.

matching.radioxmatch.catalogmatch(conn, sources, catalog, imobj, search_radius, save)[source]

Matches VLITE sources to sources from other radio sky survey catalogs.

Parameters:
  • conn (psycopg2.extensions.connect instance) – The PostgreSQL database connection object.
  • sources (list) – List of DetectedSource objects which need a sky survey catalog match.
  • catalog (str) – Name of the sky survey catalog whose sources are being used for cross-matching.
  • imobj (database.dbclasses.Image instance) – Image object whose attributes are used for setting the cone search center. Only used if match_in_db is False.
  • search_radius (float) – Size of the circular search region in degrees. Only used if match_in_db is False.
  • save (bool) – If True, store the catalog cross-matching results for future insertion into the database. If False, print the results to the console and/or log file. This parameter is automatically set to False if only the source finding and catalog matching stages are turned on.
Returns:

  • sources (list) – DetectedSource objects with updated ‘nmatches’ attribute.
  • catalog_matched (list) – CatalogSource objects which have been successfully matched to the VLITE sources.

matching.radioxmatch.check_previous(conn, src, search_radius)[source]

Searches the database image table for images of the same size which could have contained the source in question in their field-of-view.

Parameters:
  • conn (psycopg2.extensions.connect instance) – The PostgreSQL database connection object.
  • src (database.dbclasses.DetectedSource instance) – Source whose position will be used to find all previously processed images which could have contained it.
  • search_radius (float) – Radius of the image field-of-view in degrees.
Returns:

prev_images – List of ids of the images which could have contained the given point.

Return type:

list

Extracts all sources from the specified database table which fall within a circular region on the sky.

Parameters:
  • conn (psycopg2.extensions.connect instance) – The PostgreSQL database connection object.
  • table (str) – Name of the database table to query.
  • center_ra (float) – Right ascension coordinate of the circle center in degrees.
  • center_dec (float) – Declination coordinate of the circle center in degrees.
  • radius (float) – Size of the circular search region in degrees.
  • schema (str, optional) – The database schema which contains the table. Default is ‘public’.
Returns:

rows – List of row dictionary objects corresponding to the sources that fall within the circular search region.

Return type:

list

matching.radioxmatch.filter_catalogs(conn, catalogs, res)[source]

Selects only radio catalogs with a spatial resolution that lies in the same range as the current image’s resolution. The A & B configuration equivalent resolution ranges are combined into one big range to include more all-sky survey catalogs.

Parameters:
  • conn (psycopg2.extensions.connect instance) – The PostgreSQL database connection object.
  • catalogs (list) – List of catalog names to check.
  • res (float) – Spatial resolution of the current image.
Returns:

filtered_catalogs – Names of catalogs which have resolutions adequate to proceed with the positional cross-matching.

Return type:

list

matching.radioxmatch.filter_res(rows, res_class)[source]

Filters out sources extracted from the database which originate from images with spatial resolutions outside the acceptable range.

Parameters:
  • rows (list) – psycopg2 row dictionary objects extracted from the database.
  • res (float) – Spatial resolution of the current image in arcseconds.
Returns:

keep – List of psycopg2 row dictionary objects after applying the spatial resolution filtering.

Return type:

list