# [AstroPy] Requesting Help for Matching Source Catalogs Using astropy.coordinates

Samantha Martin smartin2016 at my.fit.edu
Thu Mar 28 15:34:22 EDT 2019

```Hello all!

I am working on a project for my undergraduate research where I am using
astropy.coordinates and match_coordinates_sky to find source matches
between three sets of data in RA and DEC.  I am able to find the source
matches between two data sets at a time.  I have two questions about
this.  First
of all, when I match my first data set to my second data set, they have
2240 matches, but when I match my first data set to my third data set, they
have 3400 matches.  My first data set is the one I want to match to
specifically because it has the least amount of sources.  *How do I ensure
that all three data sets all match each other (ie. contain the same
sources), not just one of the other data sets?  My second question is, now
that I have the source matches, how do I apply this to the rest of the
parameters (magnitude, flux etc.) in my data?*  After matching, I am able
to output the matching RA and DEC values for each data set, but I don’t
know how to apply the matches to the other 21 columns of data that
correspond to these sources.  In order for me to continue the project I
must be able to use all of the data, not just RA and DEC.  Below is the
code that I have used to find my matches.  I’ve been trying to search
online for answers to these questions for days with no luck.*  I am not
sure if this a good place to ask this, and if it isn’t then could someone
direct me to a good forum for these types of questions?*

import numpy as np

from astropy.coordinates import SkyCoord

from astropy import units as u

from astropy.coordinates import match_coordinates_sky

c = SkyCoord(my_csv1[:, 12], my_csv1[:, 13], frame='icrs', unit='deg')

catalog = SkyCoord(my_csv2[:, 12], my_csv2[:, 13], frame='icrs', unit='deg')

max_sep = 1.0*u.arcsec

idx, sep2d, _ = c.match_to_catalog_sky(catalog)

sep_constraint = sep2d < max_sep

c_matches = c[sep_constraint]

catalog_matches = catalog[idx[sep_constraint]]

print (len(c_matches), len(catalog_matches))

Thank you,

Samantha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20190328/9705816f/attachment.html>
```