# makecoaddTempexp with skycorrection

**URL:** <https://www.rubin.community/t/makecoaddtempexp-with-skycorrection/4200>\
**Category:** Support\
**Created:** [June 12, 2020, 8:34pm UTC](https://www.rubin.community/t/makecoaddtempexp-with-skycorrection/4200 "2020-06-12T20:34:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mchbib](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/mchbib/32/998_2.png) [@mchbib](https://www.rubin.community/u/mchbib)\
**Post date:** [June 12, 2020, 8:34pm UTC](https://www.rubin.community/t/makecoaddtempexp-with-skycorrection/4200/1 "2020-06-12T20:34:03Z")

</div>

Hello all, I run makecoaddTempexp with and without skycorrection. I got more artifacts in the coadd image which was done after skycorrection.

 ![coadd_9812_14_Z](https://us1.discourse-cdn.com/flex002/uploads/rubin/original/2X/0/09e309ab977f65b96901ef58683a355c04087066.jpeg)  
In the attached figure I show the coadds without (left) and with (right) skycorrection.  
I am wandering if I missed option to use for the skycorrection step: This is what I am using for skycorrection: `skyCorrection.py /sps/lsst/HSC/Manal/hsc_output/ --calib /sps/lsst/HSC/Manal/HSC_Z_R_Band/CALIB/ --rerun rerun --id visit=1164^1166^1168^1172^1174^1180^1182^1188^1176^1184^1178^1170^1186^1190^1192 --batch-type=smp --cores=8`  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![yusra](https://avatars.discourse-cdn.com/v4/letter/y/f4b2a3/32.png) [@yusra](https://www.rubin.community/u/yusra)\
**Post date:** [June 12, 2020, 8:55pm UTC](https://www.rubin.community/t/makecoaddtempexp-with-skycorrection/4200/2 "2020-06-12T20:55:17Z")

</div>

Hi Manal, Your skyCorrection.py call looks fine, assuming your sky frames in `/sps/lsst/HSC/Manal/HSC_Z_R_Band/CALIB` also look fine. We don’t use any special configs.

The images are completely in line with what we see as well and is a known limitation of the skyCorrection algorithm for coaddition which was reported in [dmtn-080.lsst.io](http://dmtn-080.lsst.io).

The coaddition algorithm assumes that the visits have been background subtracted before stacking and have a mean background of zero. This assumption is not true when doApplySkyCorr=True, which doesn’t remove the ripples at the edge of the focal plane (give me a minute while I dig up examples)

We’re working on new ways to mitigate this (both via background matching during coaddition and a replacement full focal plane background model during single frame processing), but in the meantime, I recommend using `doApplySkyCorr=False` if you’re not specifically interested in the wings of bright large galaxies and especially when you’re looking at tracts like 9812 with minimal dithers and patches at the edges of the fov.

---

<div class="post-metadata">

**Author:** ![yusra](https://avatars.discourse-cdn.com/v4/letter/y/f4b2a3/32.png) [@yusra](https://www.rubin.community/u/yusra)\
**Post date:** [June 12, 2020, 9:15pm UTC](https://www.rubin.community/t/makecoaddtempexp-with-skycorrection/4200/3 "2020-06-12T21:15:06Z")

</div>

Promised example: visit 34464 background subtracted, detection pixels removed, median binned 128 pixels, stretch -2.5 to +2.5 counts.

LEFT: without skycorrection  
RIGHT: with skycorrection

 ![Screen Shot 2020-06-12 at 5.24.14 PM](https://us1.discourse-cdn.com/flex002/uploads/rubin/original/2X/6/6770134d973e835fe6494f2bfb5055b6a3c0881b.png)

Sky correction (RIGHT) does somethings better: Less oversubtraction around bright stars and galaxies, some of the instrumental amp offsets removed. But some features are worse: noticeable roll off at the edge of the focal plane and smaller scale ghosts are not removed, all which contribute to what I called “ripples” above, which when stacked with minimal dithers are causing the feature you’re seeing in your coadd.

---

<div class="post-metadata">

**Author:** ![mchbib](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/mchbib/32/998_2.png) [@mchbib](https://www.rubin.community/u/mchbib)\
**Post date:** [June 13, 2020, 7:09pm UTC](https://www.rubin.community/t/makecoaddtempexp-with-skycorrection/4200/4 "2020-06-13T19:09:22Z")

</div>

Hello Yusra, Thank you for all these explanations! I appreciate it! I will better use the option as you suggested. Thank you
