Skip to content

Commit

Permalink
Merge branch 'tickets/DM-31355'
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenam committed Aug 11, 2021
2 parents 00a9d74 + 864b2c1 commit 2223694
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion python/lsst/ip/diffim/modelPsfMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def _buildCellSet(self, exposure, referencePsfModel):
# place at center of cell
posX = sizeCellX*col + sizeCellX//2 + scienceX0

log.log("TRACE4." + self.log.getName(), log.DEBUG,
log.log("TRACE4." + self.log.name, log.DEBUG,
"Creating Psf candidate at %.1f %.1f", posX, posY)

# reference kernel image, at location of science subimage
Expand Down
26 changes: 13 additions & 13 deletions python/lsst/ip/diffim/psfMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ def _createPcaBasis(self, kernelCellSet, nStarPerCell, ps):
if eSum == 0.0:
raise RuntimeError("Eigenvalues sum to zero")
for j in range(len(eigenValues)):
log.log("TRACE5." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE5." + self.log.name + "._solve", log.DEBUG,
"Eigenvalue %d : %f (%f)", j, eigenValues[j], eigenValues[j]/eSum)

nToUse = min(nComponents, len(eigenValues))
Expand Down Expand Up @@ -929,11 +929,11 @@ def _solve(self, kernelCellSet, basisList, returnOnExcept=False):
# Make sure there are no uninitialized candidates as active occupants of Cell
nRejectedSkf = -1
while (nRejectedSkf != 0):
log.log("TRACE1." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE1." + self.log.name + "._solve", log.DEBUG,
"Building single kernels...")
kernelCellSet.visitCandidates(singlekv, nStarPerCell)
nRejectedSkf = singlekv.getNRejected()
log.log("TRACE1." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE1." + self.log.name + "._solve", log.DEBUG,
"Iteration %d, rejected %d candidates due to initial kernel fit",
thisIteration, nRejectedSkf)

Expand All @@ -946,7 +946,7 @@ def _solve(self, kernelCellSet, basisList, returnOnExcept=False):
kernelCellSet.visitCandidates(ksv, nStarPerCell)

nRejectedKsum = ksv.getNRejected()
log.log("TRACE1." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE1." + self.log.name + "._solve", log.DEBUG,
"Iteration %d, rejected %d candidates due to kernel sum",
thisIteration, nRejectedKsum)

Expand All @@ -961,11 +961,11 @@ def _solve(self, kernelCellSet, basisList, returnOnExcept=False):
# the spatial fit to these kernels

if (usePcaForSpatialKernel):
log.log("TRACE0." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE0." + self.log.name + "._solve", log.DEBUG,
"Building Pca basis")

nRejectedPca, spatialBasisList = self._createPcaBasis(kernelCellSet, nStarPerCell, ps)
log.log("TRACE1." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE1." + self.log.name + "._solve", log.DEBUG,
"Iteration %d, rejected %d candidates due to Pca kernel fit",
thisIteration, nRejectedPca)

Expand All @@ -989,7 +989,7 @@ def _solve(self, kernelCellSet, basisList, returnOnExcept=False):
spatialkv = diffimLib.BuildSpatialKernelVisitorF(spatialBasisList, regionBBox, ps)
kernelCellSet.visitCandidates(spatialkv, nStarPerCell)
spatialkv.solveLinearEquation()
log.log("TRACE2." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE2." + self.log.name + "._solve", log.DEBUG,
"Spatial kernel built with %d candidates", spatialkv.getNCandidates())
spatialKernel, spatialBackground = spatialkv.getSolutionPair()

Expand All @@ -998,10 +998,10 @@ def _solve(self, kernelCellSet, basisList, returnOnExcept=False):
kernelCellSet.visitCandidates(assesskv, nStarPerCell)
nRejectedSpatial = assesskv.getNRejected()
nGoodSpatial = assesskv.getNGood()
log.log("TRACE1." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE1." + self.log.name + "._solve", log.DEBUG,
"Iteration %d, rejected %d candidates due to spatial kernel fit",
thisIteration, nRejectedSpatial)
log.log("TRACE1." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE1." + self.log.name + "._solve", log.DEBUG,
"%d candidates used in fit", nGoodSpatial)

# If only nGoodSpatial == 0, might be other candidates in the cells
Expand All @@ -1017,14 +1017,14 @@ def _solve(self, kernelCellSet, basisList, returnOnExcept=False):

# Final fit if above did not converge
if (nRejectedSpatial > 0) and (thisIteration == maxSpatialIterations):
log.log("TRACE1." + self.log.getName() + "._solve", log.DEBUG, "Final spatial fit")
log.log("TRACE1." + self.log.name + "._solve", log.DEBUG, "Final spatial fit")
if (usePcaForSpatialKernel):
nRejectedPca, spatialBasisList = self._createPcaBasis(kernelCellSet, nStarPerCell, ps)
regionBBox = kernelCellSet.getBBox()
spatialkv = diffimLib.BuildSpatialKernelVisitorF(spatialBasisList, regionBBox, ps)
kernelCellSet.visitCandidates(spatialkv, nStarPerCell)
spatialkv.solveLinearEquation()
log.log("TRACE2." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE2." + self.log.name + "._solve", log.DEBUG,
"Spatial kernel built with %d candidates", spatialkv.getNCandidates())
spatialKernel, spatialBackground = spatialkv.getSolutionPair()

Expand All @@ -1033,11 +1033,11 @@ def _solve(self, kernelCellSet, basisList, returnOnExcept=False):
except Exception as e:
self.log.error("ERROR: Unable to calculate psf matching kernel")

log.log("TRACE1." + self.log.getName() + "._solve", log.DEBUG, str(e))
log.log("TRACE1." + self.log.name + "._solve", log.DEBUG, "%s", e)
raise e

t1 = time.time()
log.log("TRACE0." + self.log.getName() + "._solve", log.DEBUG,
log.log("TRACE0." + self.log.name + "._solve", log.DEBUG,
"Total time to compute the spatial kernel : %.2f s", (t1 - t0))

if display:
Expand Down

0 comments on commit 2223694

Please sign in to comment.