catalog = [s for s,g in zip(catalog, good) if g] else: catalog = catalog[good] for source in catalog: try: psfCandidate = measAlg.makePsfCandidate(source, exposure) # The setXXX methods are class static, but it's convenient to call them on # an instance as we don't know Exposure's pixel type # (and hence psfCandidate's exact type) if psfCandidate.getWidth() == 0: psfCandidate.setBorderWidth(self.config.borderWidth) psfCandidate.setWidth(self.config.kernelSize + 2*self.config.borderWidth) psfCandidate.setHeight(self.config.kernelSize + 2*self.config.borderWidth) im = psfCandidate.getMaskedImage().getImage() vmax = afwMath.makeStatistics(im, afwMath.MAX).getValue() if not np.isfinite(vmax): continue psfCandidateList.append(psfCandidate) if display and displayExposure: ds9.dot("o", source.getX() - mi.getX0(), source.getY() - mi.getY0(), size=4, frame=frame, ctype=ds9.CYAN) except Exception as err: logger.logdebug("Failed to make a psfCandidate from source %d: %s" % (source.getId(), err)) return psfCandidateList starSelectorRegistry.register("psfex", PsfexStarSelector)
psfCandidateList = [] for isStellar, source in zip(stellar, [s for g, s in zip(good, catalog) if g]): if not isStellar: continue try: psfCandidate = algorithmsLib.makePsfCandidate(source, exposure) # The setXXX methods are class static, but it's convenient to call them on # an instance as we don't know Exposure's pixel type # (and hence psfCandidate's exact type) if psfCandidate.getWidth() == 0: psfCandidate.setBorderWidth(self._borderWidth) psfCandidate.setWidth(self._kernelSize + 2*self._borderWidth) psfCandidate.setHeight(self._kernelSize + 2*self._borderWidth) im = psfCandidate.getMaskedImage().getImage() vmax = afwMath.makeStatistics(im, afwMath.MAX).getValue() if not numpy.isfinite(vmax): continue psfCandidateList.append(psfCandidate) if display and displayExposure: ds9.dot("o", source.getX() - mi.getX0(), source.getY() - mi.getY0(), size=4, frame=frame, ctype=ds9.CYAN) except Exception as err: logger.logdebug("Failed to make a psfCandidate from source %d: %s" % (source.getId(), err)) return psfCandidateList starSelectorRegistry.register("objectSize", ObjectSizeStarSelector)
if psfCandidate.getWidth() == 0: psfCandidate.setBorderWidth(self._borderWidth) psfCandidate.setWidth(self._kernelSize + 2 * self._borderWidth) psfCandidate.setHeight(self._kernelSize + 2 * self._borderWidth) im = psfCandidate.getMaskedImage().getImage() vmax = afwMath.makeStatistics(im, afwMath.MAX).getValue() if not numpy.isfinite(vmax): continue psfCandidateList.append(psfCandidate) if display and displayExposure: ds9.dot("o", source.getX() - mi.getX0(), source.getY() - mi.getY0(), size=4, frame=frame, ctype=ds9.CYAN) except Exception as err: logger.log( pexLogging.Log.INFO, "Failed to make a psfCandidate from source %d: %s" % (source.getId(), err)) return psfCandidateList starSelectorRegistry.register("objectSize", ObjectSizeStarSelector)
default = 21, ) borderWidth = lsst.pex.config.Field( doc = "number of pixels to ignore around the edge of PSF candidate postage stamps", dtype = int, default = 0, ) class S13StarSelector(object): ConfigClass = S13StarSelectorConfig def __init__(self, config): self.config = config def selectStars(self, exposure, catalog, matches=None): psfCandidateList = [] for source in catalog: if source.getApFluxFlag(): continue if source.getApFlux() < self.config.fluxMin: continue psfCandidate = lsst.meas.algorithms.makePsfCandidate(source, exposure) if psfCandidate.getWidth() == 0: psfCandidate.setBorderWidth(self.config.borderWidth) psfCandidate.setWidth(self.config.kernelSize + 2*self.config.borderWidth) psfCandidate.setHeight(self.config.kernelSize + 2*self.config.borderWidth) psfCandidateList.append(psfCandidate) return psfCandidateList starSelectorRegistry.register("s13", S13StarSelector)