Skip to content

Commit

Permalink
Adjust unit tests
Browse files Browse the repository at this point in the history
Fix flake8 error
  • Loading branch information
plazas committed Oct 25, 2023
1 parent 622c5cd commit ff957ec
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/test_verifyStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,22 @@ def test_defects(self):
"""
config = cpVerify.CpVerifyDefectsConfig()
config.numSigmaClip = 3.0
# The catalog objects are `lsst.afw.table.SourceCatalog`
# but the task catalog tests only check number of
# detections before and after applying defects, so
# arrays will do in this case.

# With defects applied
inputCatalogMock = np.arange(1, 100)
# Without defects applied
uncorrectedCatalogMock = np.arange(1, 200)

task = cpVerify.CpVerifyDefectsTask(config=config)
results = task.run(self.inputExp, self.camera)

# Also use the inputExp as uncorrectedExposure.
results = task.run(self.inputExp, self.camera,
uncorrectedExp=self.inputExp, inputCatalog=inputCatalogMock,
uncorrectedCatalog=uncorrectedCatalogMock)
defectStats = results.outputStats

self.assertEqual(defectStats['AMP']['C:0,0']['DEFECT_PIXELS'], 53)
Expand All @@ -269,6 +283,11 @@ def test_defects(self):
self.assertEqual(defectStats['AMP']['C:0,0']['UNMASKED_MIN'], -1.0 * self.defectFlux, 4)
self.assertEqual(defectStats['AMP']['C:0,0']['UNMASKED_MAX'], self.defectFlux, 4)

self.assertEqual(defectStats['CATALOG']['NUM_OBJECTS_BEFORE'], 199)
self.assertEqual(defectStats['CATALOG']['NUM_OBJECTS_AFTER'], 99)
self.assertEqual(defectStats['DET']['NUM_COSMICS_BEFORE'], 0)
self.assertEqual(defectStats['DET']['NUM_COSMICS_AFTER'], 0)

self.assertIn(defectStats['SUCCESS'], [True, False])


Expand Down

0 comments on commit ff957ec

Please sign in to comment.