def query_NED( name, config, RA="RA", DEC="DEC", z="Redshift", RAf="RA", DECf="DEC", origin="Origin", ): """ Use astroquery to query the NED database Input: name: name of the source to query region for config: configuration RA, DEC: optional, coordinates of RA and DEC columns; defaults to vizier names which point to RA and DEC homogenized to deg and J2000 Return: Final table containing 4 columns, RA, DEC, redshift and origin of redshift measurement, compiled from all data available of Vizier """ # Query NED for the region around source within radius try: ned_result = Ned.query_region_async( name, radius=config.radius).text.encode() except Exception as e: print(e) raise NedQueryFailed() cat_vot = parse(BytesIO(ned_result), pedantic=False, invalid="mask") cat_vot = cat_vot.get_first_table().to_table(use_names_over_ids=True) # Filter the catalog, to remove useless rows filtered_cat = filter_ned_cat(cat_vot, RA, DEC) # Initialize a list of table to be appended; These will be table that have # a redshift measurement row_list = [] # Do another NED targeted search on each of the targets to check what type # of redshift it has associated for line in filtered_cat: if redshift_type(line, RA, DEC, config.uncertainty) is not None: row_list.append(line[RA, DEC, "Redshift"]) # Vstack all the lines into a single catalogue if not row_list: return None final_cat = vstack(row_list) # Rename columns to match general choice final_cat.rename_column("Redshift", z) final_cat.rename_column(RA, RAf) final_cat.rename_column(DEC, DECf) # Add origin column as NED final_cat.add_column(Column(["NED"] * len(final_cat)), name=origin) return final_cat