[AstroPy] Cross matching two source lists

Erin Sheldon erin.sheldon at gmail.com
Fri May 11 09:08:27 EDT 2012


Excerpts from Thomas Robitaille's message of Fri May 11 04:03:18 -0400 2012:
> Hi everyone,
> 
> I am looking for a Python package that can do arbitrary and efficient
> cross-matching of source lists, i.e. some kind of kd-tree that uses
> spherical rather than euclidean distances. Is anyone aware of such a
> package?

Hi Thomas-

The HTM module in esutil does this.

    http://code.google.com/p/esutil/

    http://code.google.com/p/esutil/source/browse/trunk/esutil/htm/__init__.py

It indexes the sky using a Hierarchical Triangular Mesh, which is a
quaternary tree.

Example to find the closest match between two lists within an arcsecond:

    from esutil import htm

    h = htm.HTM()
    maxrad=1.0/3600.0
    m1,m2,radius = h.match(ra1,dec1,ra2,dec2,maxrad)

m1 and m2 are index arrays for the matched pairs and radius is the
match distance.  You can also allow more than one match.

I hope this helps,
-e
-- 
Erin Scott Sheldon
Brookhaven National Laboratory



More information about the AstroPy mailing list