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

EvaluateLocalPhotoCalib runs before photoCal during calibrate

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Erik Dennihy noticed that the local_PhotoCalib columns don't match the calexp.photoCalib. Colin Slater noticed that photoCal runs after measurement.

      Symptom example:

      butler = dafButler.Butler('/repo/main',  collections=['HSC/runs/RC2/w_2022_04/DM-33402'])
       
      calexp =  butler.get('calexp', visit=30504, detector=54)
      src =  butler.get('src', visit=30504, detector=54)
      print(calexp.getPhotoCalib().getLocalCalibration(calexp.getBBox().getCenter()))
      print(np.median(src['base_LocalPhotoCalib']))
      # >>>0.18701489832531293
      # >>>0.04394189128521331
      

      Easy solution (without thinking about it too hard) would be to add a second round of measurement after photocal.

      For DP0.2. we can run the RecalibrateSourceTable task I'm working on right now under DM-33959, with calexp.photoCalib as input, as an afterburner.

        Attachments

          Issue Links

            Activity

            Hide
            Parejkoj John Parejko added a comment -

            I'll note that this is more serious than just the local photoCalib columns being wrong: all calibrated nJy fluxes in our sourceTable and consolidated visit table files are wrong!

            Show
            Parejkoj John Parejko added a comment - I'll note that this is more serious than just the local photoCalib columns being wrong: all calibrated nJy fluxes in our sourceTable and consolidated visit table files are wrong!
            Hide
            Parejkoj John Parejko added a comment -

            IsrTask.roughZeroPoint() sets a photoCalib in the postISR exposure using config.fluxMag0T1. Do we really need a "rough" (and in fact likely entirely wrong!) calibration going into characterize/measurement? If that didn't exist, the local photoCalib plugin would have failed where it was being run, because exposure.photoCalib would be None.

            fluxMag0T1 is only set in obs_subaru, so that postISR calibration is nonsense for every other instrument. I'd like to get rid of it entirely if we can.

            Show
            Parejkoj John Parejko added a comment - IsrTask.roughZeroPoint() sets a photoCalib in the postISR exposure using config.fluxMag0T1 . Do we really need a "rough" (and in fact likely entirely wrong!) calibration going into characterize/measurement? If that didn't exist, the local photoCalib plugin would have failed where it was being run, because exposure.photoCalib would be None. fluxMag0T1 is only set in obs_subaru, so that postISR calibration is nonsense for every other instrument. I'd like to get rid of it entirely if we can.
            Hide
            Parejkoj John Parejko added a comment -

            I'll bet we have the same problem with EvaluateLocalWcsPlugin, and any of those other summary plugins: if they run before CalibrateTask, they'll have junk in them.

            Show
            Parejkoj John Parejko added a comment - I'll bet we have the same problem with EvaluateLocalWcsPlugin, and any of those other summary plugins: if they run before CalibrateTask, they'll have junk in them.
            Hide
            erykoff Eli Rykoff added a comment -

            Wait, what? The local calibration is not even using the single-frame photocal fit? OMG.

            Show
            erykoff Eli Rykoff added a comment - Wait, what? The local calibration is not even using the single-frame photocal fit? OMG.
            Hide
            erykoff Eli Rykoff added a comment -

            Note that a second round of (full) measurement after calibration would be very slow and overkill. Just using the photometric calibration and wcs and doing the computation in calibrate would take no time and be 4 lines of code.

            Show
            erykoff Eli Rykoff added a comment - Note that a second round of (full) measurement after calibration would be very slow and overkill. Just using the photometric calibration and wcs and doing the computation in calibrate would take no time and be 4 lines of code.
            Hide
            yusra Yusra AlSayyad added a comment -

            Thanks Jim Bosch,

            4 PRs: The actual (minimal) change in pipe_tasks, 2 regressions tests, and a bug in ci_builder revealed by adding a second test to ci_imsim. 

            extra Jenkins run for everything here: https://ci.lsst.codes/job/stack-os-matrix/36179/display/redirect

            Show
            yusra Yusra AlSayyad added a comment - Thanks Jim Bosch , 4 PRs: The actual (minimal) change in pipe_tasks, 2 regressions tests, and a bug in ci_builder revealed by adding a second test to ci_imsim.  https://github.com/lsst/ci_hsc_gen3/pull/68 https://github.com/lsst/ci_imsim/pull/17 https://github.com/lsst/pipe_tasks/pull/653 https://github.com/lsst-dm/ci_builder/pull/9 extra Jenkins run for everything here:  https://ci.lsst.codes/job/stack-os-matrix/36179/display/redirect
            Hide
            jbosch Jim Bosch added a comment -

            Looks good! Only comment is about some preexisting functionally dead code that your change reminded me of.

            Show
            jbosch Jim Bosch added a comment - Looks good! Only comment is about some preexisting functionally dead code that your change reminded me of.

              People

              Assignee:
              yusra Yusra AlSayyad
              Reporter:
              yusra Yusra AlSayyad
              Reviewers:
              Jim Bosch
              Watchers:
              Christopher Waters, Eli Rykoff, Erik Dennihy, Ian Sullivan, Jim Bosch, John Parejko, Keith Bechtol, Leanne Guy, Meredith Rawls, Yusra AlSayyad
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.