Turn off sky substraction in HSC pipeline

I am re-reducing some archive images from HSC (using pipeline v5.4). Because of the kind of science I am doing, I need to do a different kind of image processing. For that, I need to deactivate the background correction that singleFrameDriver.py does to the individual CCDs.
So far, I changed all the algorithms in the config file to keyword NONE, but I feel like I’m missing something. Is there any other thing I can do to avoid this correction?
Thank you very much.

If you care about sky subtraction, I would encourage you to try the new global background subtraction feature which should be available in recent weekly releases of the LSST pipeline.

If that doesn’t work for you, I suggest greping the configuration for background (e.g., singleFrameDriver.py ... --show config=background), which should identify configuration entries you can modify.

So, the thing is that the entries that state clearly do/not do say:

# Estimate the background again after final source detection?

So I assume there is some background correction going on earlier (before the detection of the sources, right?). I cannot find how to not implement that.

Thanks for the help, it’s my first time dealing with pipelines!


Well, some background subtraction is necessary if we’re going to do photometry (required for zeropoints), so I guess it’s built into the pipeline and can’t be disabled. However, we save the backgrounds we remove, so you can load those (it’s butler dataset "calexpBackground") and add them back in to the calibrated exposure (butler dataset "calexp").

That is in the mosaic step, right? Is there anyway to do that in the singleFrameDriver.py step?


The background is always removed in the singleFrameDriver.py step. If you want to restore it, you would need to write some (short) custom code:

from lsst.daf.persistence import Butler
butler = Butler("/path/to/repo/rerun/rerunName")
dataId = dict(visit=12345, ccd=67)
calexp = butler.get("calexp", dataId)
bg = butler.get("calexpBackground", dataId)
calexp.maskedImage += bg.getImage()

But please do try the new global background subtraction! While I was putting that together, I noticed that there are variable background features on the scale of about 1000 pixels that you’re going to want to subtract one way or another.