Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-19907

Don't pad numerator with zeros in smoothArray during SkyCorrection

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Story Points:
      1
    • Sprint:
      DRP S19-6b
    • Team:
      Data Release Production

      Description

      In smoothArray multiplying the convolved image by numerator/denominator, was supposed to correct the roll-off produced by padding the input image with zeros.

      See the last comment on https://jira.lsstcorp.org/browse/DM-17426?focusedCommentId=196713&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-196713

      And conversation on #subaru_hsc:

      Sogo Mineo [8:42 PM] These lines https://github.com/lsst/pipe_drivers/blob/master/python/lsst/pipe/drivers/background.py#L869

      should be fixed (naively) as:

      convolved = gaussian_filter(numpy.where(bad, 0.0, array), sigma, mode="constant", cval=0.0)
      -numerator = gaussian_filter(numpy.ones_like(array), sigma, mode="constant", cval=0.0)
      +numerator = gaussian_filter(numpy.ones_like(array), sigma, mode="constant", cval=1.0)
       denominator = gaussian_filter(numpy.where(bad, 0.0, 1.0), sigma, mode="constant", cval=0.0)
       return convolved*numerator/denominator
      

      Let me explain: we set bad pixels to 0 in computing convolved. Doing it wrongly lowers the pixels around the bad pixels in convolved . We compensate this effect with *numerator/denominator. In computing convolved , pixels outside the input image are also set to 0 ( cval=0.0 ). It is that these pixels are regarded as a kind of bad pixels, and their effect should have been compensated together with the effect of the bad pixels inside the input image. This is why the numerator needs the fix above.

      But if we compute numerator according to this fix, all elements of numerator are 1. Therefore, we can drop it altogether, hence Koike-san's proposal:

      convolved = gaussian_filter(numpy.where(bad, 0.0, array), sigma, mode="constant", cval=0.0)
      -numerator = gaussian_filter(numpy.ones_like(array), sigma, mode="constant", cval=0.0)
       denominator = gaussian_filter(numpy.where(bad, 0.0, 1.0), sigma, mode="constant", cval=0.0)
      -return convolved*numerator/denominator
      +return convolved/denominator
      

        Attachments

          Issue Links

            Activity

            yusra Yusra AlSayyad created issue -
            yusra Yusra AlSayyad made changes -
            Field Original Value New Value
            Epic Link DM-16678 [ 235238 ]
            yusra Yusra AlSayyad made changes -
            Link This issue is child task of DM-17426 [ DM-17426 ]
            yusra Yusra AlSayyad made changes -
            Status To Do [ 10001 ] In Progress [ 3 ]
            jbosch Jim Bosch made changes -
            Status In Progress [ 3 ] Reviewed [ 10101 ]
            yusra Yusra AlSayyad made changes -
            Resolution Done [ 10000 ]
            Status Reviewed [ 10101 ] Done [ 10002 ]

              People

              Assignee:
              yusra Yusra AlSayyad
              Reporter:
              yusra Yusra AlSayyad
              Watchers:
              Yusra AlSayyad
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.