LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Functions
lsst.meas.astrom.sip.sourceMatchStatistics Namespace Reference

Functions

def sourceMatchStatistics
 

Function Documentation

def lsst.meas.astrom.sip.sourceMatchStatistics.sourceMatchStatistics (   matchList,
  log = None 
)
Compute statistics on the accuracy of a wcs solution, using a precomputed list 
of matches between an image and a catalogue

Input:
matchList is a lsst::afw::detection::SourceMatch object

Output:
A dictionary storing the following quanities
meanOfDiffInPixels          Average distance between image and catalogue position (in pixels)
rmsOfDiffInPixels           Root mean square of distribution of distances
quartilesOfDiffInPixels     An array of 5 values giving the boundaries of the quartiles of the 
                            distribution.

Definition at line 26 of file sourceMatchStatistics.py.

26 
27 def sourceMatchStatistics(matchList, log=None):
28  """ Compute statistics on the accuracy of a wcs solution, using a precomputed list
29  of matches between an image and a catalogue
30 
31  Input:
32  matchList is a lsst::afw::detection::SourceMatch object
33 
34  Output:
35  A dictionary storing the following quanities
36  meanOfDiffInPixels Average distance between image and catalogue position (in pixels)
37  rmsOfDiffInPixels Root mean square of distribution of distances
38  quartilesOfDiffInPixels An array of 5 values giving the boundaries of the quartiles of the
39  distribution.
40  """
41 
42  size = len(matchList)
43  if size == 0:
44  raise ValueError("matchList contains no elements")
45 
46  dist = np.zeros(size)
47  i = 0
48  for match in matchList:
49  catObj = match.first
50  srcObj = match.second
51 
52  cx = catObj.getXAstrom()
53  cy = catObj.getYAstrom()
54 
55  sx = srcObj.getXAstrom()
56  sy = srcObj.getYAstrom()
57 
58  dist[i] = np.hypot(cx-sx, cy-sy)
59  i = i+1
60 
61  dist.sort()
62 
63  quartiles = []
64  for f in (0.25, 0.50, 0.75):
65  i = int(f*size + 0.5)
66  if i >= size:
67  i = size - 1
68  quartiles.append(dist[i])
69 
70  values = {}
71  values['diffInPixels_Q25'] = quartiles[0]
72  values['diffInPixels_Q50'] = quartiles[1]
73  values['diffInPixels_Q75'] = quartiles[2]
74  values['diffInPixels_mean'] = dist.mean()
75  values['diffInPixels_std'] = dist.std()
76 
77  return values
78