@@ -42,37 +42,61 @@ def setUp(self):
4242 def tearDown (self ):
4343 del self .exposure
4444
45- def check (self , expectFactor ):
45+ def check (self , expectFactor , config ):
4646 schema = SourceTable .makeMinimalSchema ()
47- task = DynamicDetectionTask (config = self . config , schema = schema )
47+ task = DynamicDetectionTask (config = config , schema = schema )
4848 table = SourceTable .make (schema )
4949
5050 results = task .run (table , self .exposure , expId = 12345 )
5151 self .assertFloatsAlmostEqual (results .factor , expectFactor , rtol = self .rtol )
5252
5353 def testVanilla (self ):
5454 """Dynamic detection used as normal detection."""
55- self .check (1.0 )
55+ self .check (1.0 , self . config )
5656
5757 def testDynamic (self ):
5858 """Modify the variance plane, and see if the task is able to determine
5959 what we did.
6060 """
6161 factor = 2.0
6262 self .exposure .maskedImage .variance /= factor
63- self .check (1.0 / np .sqrt (factor ))
63+ self .check (1.0 / np .sqrt (factor ), self . config )
6464
6565 def testNoWcs (self ):
6666 """Check that dynamic detection runs when the exposure wcs is None."""
6767 self .exposure .setWcs (None )
68- self .check (1.0 )
68+ self .check (1.0 , self . config )
6969
7070 def testMinimalSkyObjects (self ):
7171 """Check that dynamic detection runs when there are a relatively small
7272 number of sky objects.
7373 """
74- self .config .skyObjects .nSources = int (0.1 * self .config .skyObjects .nSources )
75- self .check (1.0 )
74+ config = DynamicDetectionTask .ConfigClass ()
75+ config .skyObjects .nSources = int (0.1 * self .config .skyObjects .nSources )
76+ self .check (1.0 , config )
77+
78+ def testNoThresholdScaling (self ):
79+ """Check that dynamic detection runs when doThresholdScaling is False.
80+ """
81+ config = DynamicDetectionTask .ConfigClass ()
82+ config .doThresholdScaling = False
83+ self .check (1.0 , config )
84+
85+ def testNoBackgroundTweak (self ):
86+ """Check that dynamic detection runs when doBackgroundTweak is False.
87+ """
88+ config = DynamicDetectionTask .ConfigClass ()
89+ config .doBackgroundTweak = False
90+ self .check (1.0 , config )
91+
92+ def testThresholdScalingAndNoBackgroundTweak (self ):
93+ """Check that dynamic detection runs when both doThresholdScalin and
94+ doBackgroundTweak are False.
95+ """
96+ config = DynamicDetectionTask .ConfigClass ()
97+ config .doThresholdScaling = False
98+ config .doBackgroundTweak = False
99+ self .check (1.0 , config )
76100
77101 def testNoSkyObjects (self ):
78102 """Check that dynamic detection runs when there are no sky objects.
0 commit comments