@@ -108,7 +108,8 @@ def _check_values(self, values, minValue=None, maxValue=None):
108108 if maxValue is not None :
109109 self .assertTrue (np .all (values <= maxValue ))
110110
111- def _setup_detection (self , doSkySources = True , nSkySources = 5 , doSubtractBackground = False , doSattle = False , ** kwargs ):
111+ def _setup_detection (self , doSkySources = True , nSkySources = 5 ,
112+ doSubtractBackground = False , doSattle = False , ** kwargs ):
112113 """Setup and configure the detection and measurement PipelineTask.
113114
114115 Parameters
@@ -747,7 +748,7 @@ def json(self):
747748 f"Provided visit { data ['visit_id' ]} not present in cache!" )
748749 # All sources are allowed
749750 elif data ['visit_id' ] == 3 :
750- return MockResponse ({"allow_list" : [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 ,
751+ return MockResponse ({"allow_list" : [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 ,
751752 18 , 19 , 20 ]},
752753 200 , "test 3" )
753754 # ALl sources are filtered, bad things happen
@@ -774,13 +775,13 @@ def test_filter_id_not_in_sattle(self, mock_put):
774775 difference = science .clone ()
775776 detectionTask = self ._setup_detection (doDeblend = True ,
776777 badSubtractionRatioThreshold = 1. ,
777- doSkySources = False )
778+ doSkySources = False , doSattle = True )
778779
779- # Run detection and check the results
780- output = detectionTask .run (science , matchedTemplate , difference ,
780+ # Nothing in the visit cache raises
781+ with self .assertRaises (RuntimeError ):
782+ detectionTask .run (science , matchedTemplate , difference ,
781783 sources ,
782784 idFactory = IdFactory .makeSimple ())
783- # The returned soured table should be empty, which raises a warning
784785
785786 @mock .patch ('lsst.ip.diffim.detectAndMeasure.requests.put' , side_effect = mocked_requests_put )
786787 def test_filter_satellites_some_allowed (self , mock_put ):
@@ -855,15 +856,11 @@ def test_filter_satellites_none_allowed(self, mock_put):
855856 badSubtractionRatioThreshold = 1. ,
856857 doSkySources = False , doSattle = True )
857858
858- # Run detection and check the results
859- output = detectionTask .run (science , matchedTemplate , difference ,
860- sources ,
861- idFactory = IdFactory .makeSimple ())
862-
863- # The returned source table should be completely empty, which raises a
864- # warning but not a runtime error.
865-
866- self .assertEqual (len (output .diaSources ), 0 )
859+ # Run detection and confirm it raises for no diasources
860+ with self .assertRaises (detectAndMeasure .NoDiaSourcesError ):
861+ detectionTask .run (science , matchedTemplate , difference ,
862+ sources ,
863+ idFactory = IdFactory .makeSimple ())
867864
868865
869866class DetectAndMeasureScoreTest (DetectAndMeasureTestBase , lsst .utils .tests .TestCase ):
@@ -1313,9 +1310,9 @@ def testMergeFootprints(self):
13131310 self .assertEqual ((~ result .diaSources ["is_negative" ]).sum (), 3 )
13141311
13151312
1316- def makeVisitInfo (id = 1 ):
1313+ def makeVisitInfo (id = 1 ):
13171314 """Return a non-NaN visitInfo."""
1318- return afwImage .VisitInfo (id = id ,
1315+ return afwImage .VisitInfo (id = id ,
13191316 exposureTime = 10.01 ,
13201317 darkTime = 11.02 ,
13211318 date = dafBase .DateTime (65321.1 , dafBase .DateTime .MJD , dafBase .DateTime .TAI ),
0 commit comments