[AstroPy] Some Feedbacks about Astropy

Erik Tollerud erik.tollerud at gmail.com
Wed Sep 24 20:21:49 EDT 2014


FYI, there's a PR that expands on the matching feature currently under
review at

https://github.com/astropy/astropy/pull/2953

This adds a feature to search around a coordinate for all of the objects
nearby instead of just single matches.

That's still not the one-to-one matching, but it adds some features that
are of relevance there.  Specifically, returning matches where *both*
catalogs may not be completely represented in the sample (necessary for
one-to-one matching, but *not* in the current matching scheme).


Also, BTW, if anyone is looking at this and wants to know how to do
one-to-one, I think the simplest solution is to do the snippet I did
before, but then add a second stage where you reverse which is the catalog
and which is the coordinate to match.  Then only accept the pairs where
*both* directions agree on which is the closest neighbor.

If anyone wants to take up adding methods for one-to-one matching to
SkyCoord, feel free to try to implement that and issue a PR.  Or if you
want to dig deeper (for more memory efficiency), you can try using the
implementation of match_to_catalog_* or search_around_* as guides for what
to do.  Feel free to contact me if you have any questions about how to do
this.



On Fri, Jul 11, 2014 at 11:28 PM, Guang Yang <yg1991 at mail.ustc.edu.cn>
wrote:

> > As for the "matching mode", the idea is that there are a lot of
> > different "modes" people use, and match_to_catalog_sky (or
> > match_to_catalog_3d) along with the `nthneighbor` argument should be
> > flexible enough to take care of most of them.  Can you be more
> > specific about exactly what sort of mode you think is missing?
>
> Thanks for your response.
>
> In fact, we *often* use one-one match. In the code you give, there might
> be repetitive elements in 'catalogwithmatches'.  For example, for source A
> in 'catalog' there might be source B & C in 'coordstomatch' that both
> satisfy the criterion 'd2d < 3*u.arcmin'.  In this case, we want to pick up
> only the nearest one, say if distance A_B < A_C, we only regard A_B as real
> match.
>
> Though only several lines can carry it out, it's so frequently used that I
> think it should be a part of astropy.
>
> best wishes,
> guang
>
> > -----Original email-----
> > From: "Erik Tollerud" <erik.tollerud at gmail.com>
> > Sent Time: Jul 12, 2014 5:05:07 AM
> > To: "Astronomical Python mailing list" <astropy at scipy.org>
> > Cc: "Guang Yang" <yg1991 at mail.ustc.edu.cn>
> > Subject: Re: [AstroPy] Some Feedbacks about Astropy
> >
> > > 2. Though there's astropy.coordinates.matching.match_coordinates_sky
> to cross-correlate two catalogs, it doesn't allow user to specify matching
> radius and matching mode (e.g., one-one match). I've made a function to do
> so, and hope similar function can be included in astropy (
> https://github.com/Guang91/Astronomers_Tool_Box/blob/master/my_srcor.py).
> >
> > The idea is to use it like this (this is astropy 0.4 syntax - for
> > astropy 0.3 it's similar, but replace SkyCoord with `ICRS` or whatever
> > class makes sense for your coordinates):
> >
> > catalog = SkyCoord(ra_cat*u.deg, dec_cat*u.deg, frame='icrs')
> > coordstomatch = SkyCoord(ra*u.deg, dec*u.deg, frame='icrs')
> >
> > idx, d2d, d3d = coordstomatch.match_to_catalog_sky(catalog)
> >
> > coordinateswithmatches = coordstomatch[d2d < 3*u.arcmin]
> > catalogwithmatches = catalog[idx[d2d < 3*u.arcmin]]
> >
> >
> > As for the "matching mode", the idea is that there are a lot of
> > different "modes" people use, and match_to_catalog_sky (or
> > match_to_catalog_3d) along with the `nthneighbor` argument should be
> > flexible enough to take care of most of them.  Can you be more
> > specific about exactly what sort of mode you think is missing?
> >
> >
> > This was not too thoroughly documented before v0.4 (the version about
> > to be release), but there's a lot more there in v0.4. See
> > http://devdocs.astropy.org/coordinates/matchsep.html#matching-catalogs
> > (that's the developer documentation, but this will become
> >
> http://docs.astropy.org/en/stable/coordinates/matchsep.html#matching-catalogs
> > when 0.4 is released).
> >
> >
> >
> > --
> > Erik T
>
>


-- 
Erik T
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20140924/6e9eb6b6/attachment.html>


More information about the AstroPy mailing list