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
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.ip.diffim.diaCatalogSourceSelector.DiaCatalogSourceSelector Class Reference
Inheritance diagram for lsst.ip.diffim.diaCatalogSourceSelector.DiaCatalogSourceSelector:

Public Member Functions

def __init__
 
def selectSources
 

Public Attributes

 config
 
 log
 

Static Public Attributes

 ConfigClass = DiaCatalogSourceSelectorConfig
 

Detailed Description

Definition at line 93 of file diaCatalogSourceSelector.py.

Constructor & Destructor Documentation

def lsst.ip.diffim.diaCatalogSourceSelector.DiaCatalogSourceSelector.__init__ (   self,
  config = None 
)
Construct a source selector that uses a reference catalog

@param[in] config: An instance of ConfigClass

Definition at line 96 of file diaCatalogSourceSelector.py.

96 
97  def __init__(self, config=None):
98  """Construct a source selector that uses a reference catalog
99 
100  @param[in] config: An instance of ConfigClass
101  """
102  if not config:
103  config = DiaCatalogSourceSelector.ConfigClass()
104  self.config = config
105  self.log = pexLog.Log(pexLog.Log.getDefaultLog(),
106  'lsst.ip.diffim.DiaCatalogSourceSelector', pexLog.Log.INFO)
a place to record messages and descriptions of the state of processing.
Definition: Log.h:154

Member Function Documentation

def lsst.ip.diffim.diaCatalogSourceSelector.DiaCatalogSourceSelector.selectSources (   self,
  exposure,
  sources,
  matches = None 
)
Return a list of Sources for Kernel candidates 

@param[in] exposure: the exposure containing the sources
@param[in] sources: a source list containing sources that may be candidates
@param[in] matches: a match vector as produced by meas_astrom; not optional
            (passing None just allows us to handle the exception better here
            than in calling code)

@return kernelCandidateSourceList: a list of sources to be used as kernel candidates

Definition at line 107 of file diaCatalogSourceSelector.py.

108  def selectSources(self, exposure, sources, matches=None):
109  """Return a list of Sources for Kernel candidates
110 
111  @param[in] exposure: the exposure containing the sources
112  @param[in] sources: a source list containing sources that may be candidates
113  @param[in] matches: a match vector as produced by meas_astrom; not optional
114  (passing None just allows us to handle the exception better here
115  than in calling code)
116 
117  @return kernelCandidateSourceList: a list of sources to be used as kernel candidates
118 
119  """
120  import lsstDebug
121  display = lsstDebug.Info(__name__).display
122  displayExposure = lsstDebug.Info(__name__).displayExposure
123  pauseAtEnd = lsstDebug.Info(__name__).pauseAtEnd
124 
125  if matches is None:
126  raise RuntimeError(
127  "Cannot use catalog source selector without running astrometry."
128  )
129 
130  mi = exposure.getMaskedImage()
131 
132  if display:
133  if displayExposure:
134  ds9.mtv(mi, title="Kernel candidates", frame=lsstDebug.frame)
135  #
136  # Look for flags in each Source
137  #
138  isGoodSource = CheckSource(sources, self.config.fluxLim, self.config.fluxMax, self.config.badPixelFlags)
139 
140  #
141  # Go through and find all the acceptable candidates in the catalogue
142  #
143  kernelCandidateSourceList = []
144 
145  doColorCut = True
146  with ds9.Buffering():
147  refSchema = matches[0][0].schema
148  rRefFluxField = measAlg.getRefFluxField(refSchema, "r")
149  gRefFluxField = measAlg.getRefFluxField(refSchema, "g")
150  for ref, source, d in matches:
151  if not isGoodSource(source):
152  symb, ctype = "+", ds9.RED
153  else:
154  isStar = not ref.get("resolved")
155  isVar = not ref.get("photometric")
156  gMag = None
157  rMag = None
158  if doColorCut:
159  try:
160  gMag = -2.5 * np.log10(ref.get(gRefFluxField))
161  rMag = -2.5 * np.log10(ref.get(rRefFluxField))
162  except KeyError:
163  self.log.warn("Cannot cut on color info; fields 'g' and 'r' do not exist")
164  doColorCut = False
165  isRightColor = True
166  else:
167  isRightColor = (gMag-rMag) >= self.config.grMin and (gMag-rMag) <= self.config.grMax
168 
169  isRightType = (self.config.selectStar and isStar) or (self.config.selectGalaxy and not isStar)
170  isRightVar = (self.config.includeVariable) or (self.config.includeVariable is isVar)
171  if isRightType and isRightVar and isRightColor:
172  kernelCandidateSourceList.append(source)
173  symb, ctype = "+", ds9.GREEN
174  else:
175  symb, ctype = "o", ds9.BLUE
176 
177  if display and displayExposure:
178  ds9.dot(symb, source.getX() - mi.getX0(), source.getY() - mi.getY0(),
179  size=4, ctype=ctype, frame=lsstDebug.frame)
180 
181  if display:
182  lsstDebug.frame += 1
183  if pauseAtEnd:
184  raw_input("Continue? y[es] p[db] ")
185 
186  return kernelCandidateSourceList
187 
188 measAlg.starSelectorRegistry.register("diacatalog", DiaCatalogSourceSelector)
189 

Member Data Documentation

lsst.ip.diffim.diaCatalogSourceSelector.DiaCatalogSourceSelector.config

Definition at line 103 of file diaCatalogSourceSelector.py.

lsst.ip.diffim.diaCatalogSourceSelector.DiaCatalogSourceSelector.ConfigClass = DiaCatalogSourceSelectorConfig
static

Definition at line 94 of file diaCatalogSourceSelector.py.

lsst.ip.diffim.diaCatalogSourceSelector.DiaCatalogSourceSelector.log

Definition at line 104 of file diaCatalogSourceSelector.py.


The documentation for this class was generated from the following file: