Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-31801: Take into account new lsst log prefix in test #22

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/lsst/meas/extensions/gaap/_gaussianizePsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

__all__ = ("GaussianizePsfTask", "GaussianizePsfConfig")

import logging
import numpy as np
import scipy.signal

Expand All @@ -34,7 +35,6 @@
from lsst.ip.diffim.makeKernelBasisList import makeKernelBasisList
from lsst.ip.diffim.modelPsfMatch import ModelPsfMatchConfig, ModelPsfMatchTask
from lsst.ip.diffim.modelPsfMatch import sigma2fwhm, nextOddInteger
import lsst.log as log
import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase

Expand Down Expand Up @@ -329,7 +329,7 @@ def _solve(self, kernelCellSet, basisList):
spatialSolution = spatialkv.getKernelSolution()
except Exception as e:
self.log.error("ERROR: Unable to calculate psf matching kernel")
log.getLogger(f"TRACE1.{self.log.name}._solve").debug("%s", e)
logging.getLogger(f"TRACE1.{self.log.name}._solve").debug("%s", e)
raise e

self._diagnostic(kernelCellSet, spatialSolution, spatialKernel, spatialBackground)
Expand Down
15 changes: 7 additions & 8 deletions tests/test_gaap.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,22 +260,21 @@ def testFail(self, scalingFactors=[100.], sigmas=[500.]):
self.recordPsfShape(catalog)

# Expected error messages in the logs when running `sfmTask`.
errorMessage = [("ERROR:measurement.ext_gaap_GaapFlux:"
"Failed to solve for PSF matching kernel in GAaP for (100.000000, 670.000000): "
errorMessage = [("Failed to solve for PSF matching kernel in GAaP for (100.000000, 670.000000): "
"Problematic scaling factors = 100.0 "
"Errors: Exception('Unable to determine kernel sum; 0 candidates')"),
("ERROR:measurement.ext_gaap_GaapFlux:"
"Failed to solve for PSF matching kernel in GAaP for (100.000000, 870.000000): "
("Failed to solve for PSF matching kernel in GAaP for (100.000000, 870.000000): "
"Problematic scaling factors = 100.0 "
"Errors: Exception('Unable to determine kernel sum; 0 candidates')"),
("ERROR:measurement.ext_gaap_GaapFlux:"
"Failed to solve for PSF matching kernel in GAaP for (-10.000000, -20.000000): "
("Failed to solve for PSF matching kernel in GAaP for (-10.000000, -20.000000): "
"Problematic scaling factors = 100.0 "
"Errors: Exception('Unable to determine kernel sum; 0 candidates')")]

with self.assertLogs(sfmTask.log.name, "ERROR") as cm:
plugin_logger_name = sfmTask.log.getChild(algName).name
self.assertEqual(plugin_logger_name, "lsst.measurement.ext_gaap_GaapFlux")
with self.assertLogs(plugin_logger_name, "ERROR") as cm:
sfmTask.run(catalog, exposure)
self.assertEqual(cm.output, errorMessage)
self.assertEqual([record.message for record in cm.records], errorMessage)

for record in catalog:
self.assertFalse(record[algName + "_flag"])
Expand Down