<div dir="ltr">



















<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif">Hello all!<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif">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.<span> 
</span>I am able to find the source matches between two data sets at a time.<span>  </span>I have two questions about this. <span> </span>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.<span>  </span>My first data set is the one I want to match
to specifically because it has the least amount of sources.<span>  </span><b>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?<span> 
</span>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?</b><span>  </span>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.<span>  </span>In order for me to continue the project I
must be able to use all of the data, not just RA and DEC.<span>  </span>Below is the code that I have used to find my
matches.<span>  </span>I’ve been trying to search
online for answers to these questions for days with no luck.<b><span>  </span>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?</b><br></p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif"><br></p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif">



















</p><p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">import numpy as np<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">my_csv1 = np.loadtxt(open("F435W.csv"),
delimiter=",")<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">my_csv2 = np.loadtxt(open("F550M.csv"),
delimiter=",")<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">from astropy.coordinates import SkyCoord<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">from astropy import units as u<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">from astropy.coordinates import match_coordinates_sky<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">c = SkyCoord(my_csv1[:, 12], my_csv1[:, 13], frame='icrs', unit='deg')<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">catalog = SkyCoord(my_csv2[:, 12], my_csv2[:, 13], frame='icrs',
unit='deg')<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">max_sep = 1.0*u.arcsec<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">idx, sep2d, _ = c.match_to_catalog_sky(catalog)<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">sep_constraint = sep2d < max_sep<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">c_matches = c[sep_constraint]<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;line-height:normal;font-size:11pt;font-family:"Calibri",sans-serif">catalog_matches = catalog[idx[sep_constraint]]<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif">print (len(c_matches), len(catalog_matches))<span></span></p>





<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif"><br></p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif">Thank you,</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif">Samantha<br></p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:"Calibri",sans-serif"><span></span></p>





<div><br></div><div><br></div></div>