Skip to content

Commit

Permalink
Turn off compatibility mode as the default.
Browse files Browse the repository at this point in the history
Also set the default convolution mode to `convolveTemplate`

Update subtractImages config validation.
  • Loading branch information
isullivan committed Aug 5, 2022
1 parent a4827df commit 83474f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/lsst/ip/diffim/subtractImages.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class AlardLuptonSubtractConfig(lsst.pipe.base.PipelineTaskConfig,
pipelineConnections=AlardLuptonSubtractConnections):
mode = lsst.pex.config.ChoiceField(
dtype=str,
default="auto",
default="convolveTemplate",
allowed={"auto": "Choose which image to convolve at runtime.",
"convolveScience": "Only convolve the science image.",
"convolveTemplate": "Only convolve the template image."},
Expand Down Expand Up @@ -148,7 +148,7 @@ class AlardLuptonSubtractConfig(lsst.pipe.base.PipelineTaskConfig,

forceCompatibility = lsst.pex.config.Field(
dtype=bool,
default=True,
default=False,
doc="Set up and run diffim using settings that ensure the results"
"are compatible with the old version in pipe_tasks.",
deprecated="This option is only for backwards compatibility purposes"
Expand All @@ -162,8 +162,8 @@ def setDefaults(self):
self.makeKernel.kernel.active.spatialBgOrder = 2

def validate(self):
if self.forceCompatibility:
self.mode = "convolveTemplate"
if self.forceCompatibility and not (self.mode == "convolveTemplate"):
raise ValueError("If forceCompatibility=True, then mode='convolveTemplate' must also be set")


class AlardLuptonSubtractTask(lsst.pipe.base.PipelineTask):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_subtractTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def _run_and_check_images(statsCtrl, statsCtrlDetect, scienceNoiseLevel, templat
config = subtractImages.AlardLuptonSubtractTask.ConfigClass()
config.doSubtractBackground = False
config.forceCompatibility = False
config.mode = "convolveScience"
task = subtractImages.AlardLuptonSubtractTask(config=config)
output = task.run(template, science, sources)
self.assertFloatsAlmostEqual(task.metadata["scaleTemplateVarianceFactor"], 1., atol=.05)
Expand Down Expand Up @@ -542,6 +543,7 @@ def _run_and_check_images(science, template, sources, statsCtrl,
"""

config = subtractImages.AlardLuptonSubtractTask.ConfigClass()
config.mode = "convolveScience"
config.doSubtractBackground = False
config.forceCompatibility = False
config.doDecorrelation = doDecorrelation
Expand Down

0 comments on commit 83474f3

Please sign in to comment.