Skip to content

Commit

Permalink
Add decam and cfht tests of use of flaggedSourceSelector
Browse files Browse the repository at this point in the history
decam tests are skipped due to macOS/Linux mismatch. Sorting out that numeric
mismatch is outside the scope of this ticket, but is part of the scope of
figuring out why the constrainedPhotometryModel is not working, in general.
  • Loading branch information
parejkoj committed May 14, 2018
1 parent 8c17f94 commit 614a1b5
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_jointcal_cfht.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,31 @@ def test_jointcalTask_2_visits_constrainedPhotometry_no_astrometry(self):

self._testJointcalTask(2, None, None, pa1, metrics=metrics)

def test_jointcalTask_2_visits_constrainedPhotometry_flagged(self):
"""Test the use of the FlaggedSourceSelector."""
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.photometryModel = "constrained"
self.config.sourceSelector.name = "flagged"
# Reduce warnings due to flaggedSourceSelector having fewer sources than astrometrySourceSelector.
self.config.minMeasuredStarsPerCcd = 30
self.config.minRefStarsPerCcd = 20
self.config.doAstrometry = False
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
self.jointcalStatistics.do_astrometry = False

pa1 = 0.026
metrics = {'collected_photometry_refStars': 825,
'selected_photometry_refStars': 212,
'associated_photometry_fittedStars': 270,
'selected_photometry_fittedStars': 244,
'selected_photometry_ccdImages': 12,
'photometry_final_chi2': 369.96,
'photometry_final_ndof': 252
}

self._testJointcalTask(2, None, None, pa1, metrics=metrics)


class MemoryTester(lsst.utils.tests.MemoryTestCase):
pass
Expand Down
47 changes: 47 additions & 0 deletions tests/test_jointcal_decam.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,53 @@ def test_jointcalTask_2_visits_constrainedAstrometry_no_photometry(self):

self._testJointcalTask(2, relative_error, self.dist_rms_absolute, pa1, metrics=metrics)

def setup_jointcalTask_2_visits_constrainedPhotometry_no_astrometry(self):
"""Help keep the constrainedPhotometry tests consistent and make
the differences between them more obvious.
"""
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.photometryModel = "constrained"
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
self.config.doAstrometry = False
self.jointcalStatistics.do_astrometry = False

pa1 = 0.11
metrics = {'collected_photometry_refStars': 4865,
'selected_photometry_refStars': 661,
'associated_photometry_fittedStars': 6749,
'selected_photometry_fittedStars': 2044,
'selected_photometry_ccdImages': 14,
'photometry_final_chi2': 3066.22,
'photometry_final_ndof': 1998,
}

return pa1, metrics

@unittest.skip("This test produces different chi2/ndof on Linux and macOS.")
def test_jointcalTask_2_visits_constrainedPhotometry_no_astrometry(self):
pa1, metrics = self.setup_jointcalTask_2_visits_constrainedPhotometry_no_astrometry()
self._testJointcalTask(2, None, None, pa1, metrics=metrics)

@unittest.skip("This test produces different chi2/ndof on Linux and macOS.")
def test_jointcalTask_2_visits_constrainedPhotometry_flagged_selector(self):
pa1, metrics = self.setup_jointcalTask_2_visits_constrainedPhotometry_no_astrometry()
self.config.sourceSelector.name = 'flagged'
# Reduce warnings due to flaggedSourceSelector having fewer sources than astrometrySourceSelector.
self.config.minMeasuredStarsPerCcd = 40

metrics = {'collected_photometry_refStars': 4865,
'selected_photometry_refStars': 551,
'associated_photometry_fittedStars': 860,
'selected_photometry_fittedStars': 593,
'selected_photometry_ccdImages': 14,
'photometry_final_chi2': 817.124,
'photometry_final_ndof': 607,
}

self._testJointcalTask(2, None, None, pa1, metrics=metrics)


class MemoryTester(lsst.utils.tests.MemoryTestCase):
pass
Expand Down

0 comments on commit 614a1b5

Please sign in to comment.