Skip to content

Commit

Permalink
Merge pull request #175 from lsst/u/jbosch/DM-29936/revert
Browse files Browse the repository at this point in the history
Revert DM-29936
  • Loading branch information
TallJimbo committed May 8, 2021
2 parents 6ebdb75 + 641a914 commit e45d148
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
13 changes: 6 additions & 7 deletions python/lsst/meas/base/forcedMeasurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,26 +353,25 @@ def run(self, measCat, exposure, refCat, refWcs, exposureId=None, beginOrder=Non
# Create parent cat which slices both the refCat and measCat (sources)
# first, get the reference and source records which have no parent
refParentCat, measParentCat = refCat.getChildren(0, measCat)
childrenIter = refCat.getChildren((refParentRecord.getId() for refParentRecord in refCat), measCat)
for parentIdx, records in enumerate(zip(refParentCat, measParentCat, childrenIter)):
# Unpack records
refParentRecord, measParentRecord, (refChildCat, measChildCat) = records
# First process the records which have the current parent as children
for parentIdx, (refParentRecord, measParentRecord) in enumerate(zip(refParentCat, measParentCat)):

# first process the records which have the current parent as children
refChildCat, measChildCat = refCat.getChildren(refParentRecord.getId(), measCat)
# TODO: skip this loop if there are no plugins configured for single-object mode
for refChildRecord, measChildRecord in zip(refChildCat, measChildCat):
noiseReplacer.insertSource(refChildRecord.getId())
self.callMeasure(measChildRecord, exposure, refChildRecord, refWcs,
beginOrder=beginOrder, endOrder=endOrder)
noiseReplacer.removeSource(refChildRecord.getId())

# Then process the parent record
# then process the parent record
noiseReplacer.insertSource(refParentRecord.getId())
self.callMeasure(measParentRecord, exposure, refParentRecord, refWcs,
beginOrder=beginOrder, endOrder=endOrder)
self.callMeasureN(measParentCat[parentIdx:parentIdx+1], exposure,
refParentCat[parentIdx:parentIdx+1],
beginOrder=beginOrder, endOrder=endOrder)
# Measure all the children simultaneously
# measure all the children simultaneously
self.callMeasureN(measChildCat, exposure, refChildCat,
beginOrder=beginOrder, endOrder=endOrder)
noiseReplacer.removeSource(refParentRecord.getId())
Expand Down
10 changes: 5 additions & 5 deletions python/lsst/meas/base/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ def subset(self, sources, bbox, wcs):
parentSources = catalog.getChildren(0)
skyCoordList = [source.getCoord() for source in parentSources]
pixelPosList = wcs.skyToPixel(skyCoordList)
parents = (parent for parent, pixel in zip(parentSources, pixelPosList) if boxD.contains(pixel))
childrenIter = catalog.getChildren((parent.getId() for parent in parentSources))
for parent, children in zip(parents, childrenIter):
yield parent
yield from children
for parent, pixel in zip(parentSources, pixelPosList):
if boxD.contains(pixel):
yield parent
for child in catalog.getChildren(parent.getId()):
yield child


class CoaddSrcReferencesConfig(BaseReferencesTask.ConfigClass):
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/meas/base/sfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ def runPlugins(self, noiseReplacer, measCat, exposure, beginOrder=None, endOrder
nMeasParentCat, ("" if nMeasParentCat == 1 else "s"),
nMeasCat - nMeasParentCat, ("" if nMeasCat - nMeasParentCat == 1 else "ren"))

childrenIter = measCat.getChildren([measParentRecord.getId() for measParentRecord in measParentCat])
for parentIdx, (measParentRecord, measChildCat) in enumerate(zip(measParentCat, childrenIter)):
for parentIdx, measParentRecord in enumerate(measParentCat):
# first get all the children of this parent, insert footprint in
# turn, and measure
measChildCat = measCat.getChildren(measParentRecord.getId())
# TODO: skip this loop if there are no plugins configured for
# single-object mode
for measChildRecord in measChildCat:
Expand Down

0 comments on commit e45d148

Please sign in to comment.