match (version 2.0)
index
/devel/goods16/ferguson/pygoodsdist/doc/doctmp/match.py

# match.py
# Utilties for matching catalogs by RA & Dec or ID
# H. Ferguson 11/22/05

 
Modules
       
angsep
copy
string
sys

 
Functions
       
matchids(id1, id2)
Match two sets of ids. 
Returns: 
  ibest -- array of indices of i1 that match i2; -1 if no match
matchidsorted(ids, targetid)
Find id matches, return index in i1 that matches targetid; -1 if no match.
matchjoin(si1, si2, ibest, sep=[], dict1={}, dict2={})
Keep only elements that match in both catalogs. 
Arguments:
  si1 -- object with data arrays as attributes (e.g. si1.mag_auto, si1.id)
  si2 -- object with data arrays as attributes 
  ibest -- indices of si1 that match si2 (in order of si2)
Keyword Arguments:
  sep -- array of separations, will be added as an attribute to second object
  dict1 -- dictionary of attributes for si1 (e.g. {'mag_auto':0,'id':1} )
  dict2 -- dictionary of attributes for si2 
The objects si1 and si2 would normally be sextractor objects returned
by sextutils.sextractor(). In that case, the column names are stored in
si1._d and si2._d. If the objects are not sextractor objects, the user can
provide separate dictionaries whose keys are the object attributes 
that correspond to the numpy data arrays. 
 
Returns:
  s1, s2 -- object arrays that include only the matching objects contained
      in both s1 and s2.
matchpos(ra1, dec1, ra2, dec2, tol)
Match two sets of ra,dec within a tolerance.
Longer catalog should go first
Arguments:
  ra1 - Right Ascension decimal degrees (numpy array)
  dec1 - Declination decimal degrees (numpy array)
  ra2 - Right Ascension decimal degrees (numpy array)
  dec2 - Declination decimal degrees (numpy array)
  tol - Matching tolerance in decimal degrees. 
Returns:
  ibest - indices of the best matches within tol; -1 if no match within tol
  sep - separations (defaults to tol if no match within tol)
matchsorted(ra, dec, ra1, dec1, tol)
Find closest ra,dec within tol to a target in an ra-sorted list of ra,dec.
Arguments:
  ra - Right Ascension decimal degrees (numpy sorted in ascending order)
  dec - Declination decimal degrees (numpy array)
  ra1 - RA to match (scalar, decimal degrees)
  ra1 - Dec to match (scalar, decimal degrees)
  tol - Matching tolerance in decimal degrees. 
Returns:
  ibest - index of the best match within tol; -1 if no match within tol
  sep - separation (defaults to tol if no match within tol)

 
Data
        __author__ = 'H. C. Ferguson'
__version__ = 2.0

 
Author
        H. C. Ferguson