imageDifference.py breaks when doMatchSources=True

I am using hscPipe v8.4 to perform difference imaging on a HSC dataset. If I supply the configuration option doMatchSources=True to imageDifference.py,

imageDifference.py $DIR --config convolveTemplate=False -C deepDiff_modify.py -c doWriteMatchedExp=True -c doMatchSources=True --calib $DIR/CALIB --rerun surhud --id visit=$visit ccd=$ccd filter=HSC-R2

it fails with an

AttributeError: lsst.meas.astrom.matchPessimisticB.MatchPessimisticBConfig has no attribute maxMatchDistArcSec
Traceback (most recent call last):
  File "/mnt/home/faculty/csurhud/hscpipe/hscpipe/8.4/stack/miniconda3-4.7.10-4d7b902/Linux64/pipe_base/8.0-hsc+1/python/lsst/pipe/base/cmdLineTask.py", line 388, in __call_
_
    result = self.runTask(task, dataRef, kwargs)
  File "/mnt/home/faculty/csurhud/hscpipe/hscpipe/8.4/stack/miniconda3-4.7.10-4d7b902/Linux64/pipe_base/8.0-hsc+1/python/lsst/pipe/base/cmdLineTask.py", line 447, in runTask
    return task.runDataRef(dataRef, **kwargs)
  File "/mnt/home/faculty/csurhud/hscpipe/hscpipe/8.4/stack/miniconda3-4.7.10-4d7b902/Linux64/pipe_base/8.0-hsc+1/python/lsst/pipe/base/timer.py", line 150, in wrapper
    res = func(self, *args, **keyArgs)
  File "/mnt/home/faculty/csurhud/hscpipe/hscpipe/8.4/stack/miniconda3-4.7.10-4d7b902/Linux64/pipe_tasks/8.1-hsc/python/lsst/pipe/tasks/imageDifference.py", line 416, in run
DataRef
    subtractedExposure=subtractedExposure)
  File "/mnt/home/faculty/csurhud/hscpipe/hscpipe/8.4/stack/miniconda3-4.7.10-4d7b902/Linux64/pipe_tasks/8.1-hsc/python/lsst/pipe/tasks/imageDifference.py", line 839, in run
    refAstromConfig.matcher.maxMatchDistArcSec = matchRadAsec

I could not find this attribute in the latest version of the AstrometryConfig meas_astrom/astrometry.py at master · lsst/meas_astrom · GitHub either.

I just looked at the code, and I think you need to regard that functionality as broken in hscPipe 8.4. If you’re desperate, I could attempt to fix it on the HSC fork. But in general I would recommend using a modern LSST stack if you’re going to be playing with image differencing.

Thanks for confirming the issue. I would be happy to play with the modern LSST stack as long as you can confirm that it will be able to perform imageDifference on coadds and calexps produced by HSCPipe. Last time I tried to use the LSST pipeline to process Subaru data I was told to use hscPipe.

Can you also point me to some tutorial for the most updated version of imageDifference.py? I was not able to find a reasonable documentation, and had to figure out a lots of things by experimentation.

@price I can confirm that this functionality is also broken in the lsst version v21_0_0 as I get the same exact error when I pass doMatchSources=True. Perhaps you meant something else when you asked me to take a look at the modern LSST stack. Did you mean that I should not use imageDifference.py and use something like ap_pipe or are you suggesting using gen 3 instead of gen 2 pipeline?

I’m sorry, but I’m not the one to ask about how image differencing works in the LSST pipeline.