Skip to content

Commit

Permalink
Default to constrained models, and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Aug 23, 2018
1 parent c1a145a commit f16e532
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/lsst/jointcal/jointcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ class JointcalConfig(pexConfig.Config):
astrometryModel = pexConfig.ChoiceField(
doc="Type of model to fit to astrometry",
dtype=str,
default="simple",
default="constrained",
allowed={"simple": "One polynomial per ccd",
"constrained": "One polynomial per ccd, and one polynomial per visit"}
)
photometryModel = pexConfig.ChoiceField(
doc="Type of model to fit to photometry",
dtype=str,
default="simpleFlux",
default="constrainedMagnitude",
allowed={"simpleFlux": "One constant zeropoint per ccd and visit, fitting in flux space.",
"constrainedFlux": "Constrained zeropoint per ccd, and one polynomial per visit,"
" fitting in flux space.",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_jointcal_cfht.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def setUp(self):
def test_jointcalTask_2_visits(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.astrometryModel = "simple"
self.config.photometryModel = "simpleFlux"
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")

Expand Down
4 changes: 4 additions & 0 deletions tests/test_jointcal_cfht_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def setUp(self):

def test_jointcalTask_2_visits_photometry(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.photometryModel = "simpleFlux"
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.doAstrometry = False
self.config.writeInitMatrix = True # write Hessian/gradient files
Expand Down Expand Up @@ -102,6 +103,7 @@ def test_jointcalTask_fails_raise(self):
"""Raise an exception if there is no data to process."""
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.setDefaults()
self.config.photometryModel = "simpleFlux"
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.sourceSelector['astrometry'].minSnr = 10000
self.config.doAstrometry = False
Expand All @@ -123,6 +125,7 @@ def test_jointcalTask_fails_no_raise(self):
"""exitStatus=1 if there is no data to process."""
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.setDefaults()
self.config.photometryModel = "simpleFlux"
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.sourceSelector['astrometry'].minSnr = 10000
self.config.doAstrometry = False
Expand All @@ -144,6 +147,7 @@ def test_jointcalTask_fails_no_raise_no_return_results(self):
"""exitStatus=1 if there is no data to process."""
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.setDefaults()
self.config.photometryModel = "simpleFlux"
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.sourceSelector['astrometry'].minSnr = 10000
self.config.doAstrometry = False
Expand Down
2 changes: 2 additions & 0 deletions tests/test_jointcal_decam.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def setUp(self):

def test_jointcalTask_2_visits(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryModel = "simple"
self.config.photometryModel = "simpleFlux"
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
Expand Down
9 changes: 9 additions & 0 deletions tests/test_jointcal_hsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def setUp(self):

def test_jointcalTask_2_visits(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryModel = "simple"
self.config.photometryModel = "simpleFlux"
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
Expand Down Expand Up @@ -79,6 +81,7 @@ def test_jointcalTask_11_visits_no_photometry(self):
"""

self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryModel = "simple"
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.doPhotometry = False
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
Expand Down Expand Up @@ -147,6 +150,7 @@ def testJointcalTask_2_visits_no_photometry(self):

self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.astrometryModel = "simple"
self.config.doPhotometry = False
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
self.jointcalStatistics.do_photometry = False
Expand All @@ -170,6 +174,8 @@ def testJointcalTask_2_visits_no_photometry(self):

def test_jointcalTask_2_visits_gaia_refcat(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryModel = "simple"
self.config.photometryModel = "simpleFlux"
self.config.astrometryRefObjLoader.retarget(LoadIndexedReferenceObjectsTask)
# use the a.net refcat for photometry.
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
Expand Down Expand Up @@ -206,6 +212,7 @@ def test_jointcalTask_2_visits_gaia_refcat(self):

def test_jointcalTask_2_visits_no_photometry_match_cut_10(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryModel = "simple"
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.matchCut = 10.0 # TODO: once DM-6885 is fixed, we need to put `*lsst.afw.geom.arcseconds`
self.config.doPhotometry = False
Expand All @@ -228,6 +235,7 @@ def test_jointcalTask_2_visits_no_photometry_match_cut_10(self):
def test_jointcalTask_3_visits_no_photometry(self):
"""3 visit, default config to compare with min_measurements_3 test."""
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryModel = "simple"
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.minMeasurements = 2
self.config.doPhotometry = False
Expand All @@ -254,6 +262,7 @@ def test_jointcalTask_3_visits_no_photometry_min_measurements_3(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.minMeasurements = 3
self.config.astrometryModel = "simple"
self.config.doPhotometry = False
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
self.jointcalStatistics.do_photometry = False
Expand Down
4 changes: 4 additions & 0 deletions tests/test_jointcal_lsstSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def testJointcalTask_2_visits(self):
# NOTE: the measured values of the metrics may change with the new fitter.
pa1 = None
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryModel = "simple"
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
Expand Down Expand Up @@ -103,6 +104,7 @@ def testJointcalTask_10_visits(self):
# NOTE: the measured values of the metrics may change with the new fitter.
pa1 = None
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryModel = "simple"
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.doPhotometry = False
Expand Down Expand Up @@ -145,6 +147,7 @@ def testJointcalTask_2_visits_no_astrometry(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.doAstrometry = False
self.config.photometryModel = "simpleFlux"
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
self.jointcalStatistics.do_astrometry = False

Expand Down Expand Up @@ -180,6 +183,7 @@ def testJointcalTask_2_visits_no_photometry(self):

self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
self.config.astrometryModel = "simple"
self.config.doPhotometry = False
self.config.sourceSelector['astrometry'].badFlags.append("base_PixelFlags_flag_interpolated")
self.jointcalStatistics.do_photometry = False
Expand Down

0 comments on commit f16e532

Please sign in to comment.