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

safeClip not respecting Subaru configs

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Story Points:
      1
    • Sprint:
      AP S21-1 (December), AP S21-2 (January)
    • Team:
      Alert Production
    • Urgent?:
      No

      Description

      While working on DM-27255 we noticed that the assemble configs in obs_subaru were not being respected in safeClip. We suspect this was introduced here.

        Attachments

          Issue Links

            Activity

            Hide
            sullivan Ian Sullivan added a comment -

            I don't think this is actually a bug. The issue is that the config settings such as doApplyExternalPhotoCalib=True must also be specified for the subtasks:
            config.assembleMeanCoadd.doApplyExternalPhotoCalib=True and config.assembleMeanClipCoadd.doApplyExternalPhotoCalib=True . An alternative would be to check the configs of the subtasks when they are created and copy over all of the settings from the main Task, though I would expect that to create its own problems.

            Show
            sullivan Ian Sullivan added a comment - I don't think this is actually a bug. The issue is that the config settings such as doApplyExternalPhotoCalib=True must also be specified for the subtasks: config.assembleMeanCoadd.doApplyExternalPhotoCalib=True and config.assembleMeanClipCoadd.doApplyExternalPhotoCalib=True . An alternative would be to check the configs of the subtasks when they are created and copy over all of the settings from the main Task , though I would expect that to create its own problems.
            Hide
            yusra Yusra AlSayyad added a comment -

            The original code ensured that the the coaddMean and coaddClip were generated with the same configs as specified for the final coadd, except for MEAN/MEANCLIP.

                    configIntersection = {k: getattr(self.config, k)	
                                          for k, v in self.config.toDict().items()	
                                          if (k in config.keys() and k != "connections")}	
                    config.update(**configIntersection)
             
             
                    config.statistic = 'MEAN'	
                    task = AssembleCoaddTask(config=config)	
                    coaddMean = task.run(skyInfo, tempExpRefList, imageScalerList, weightList).coaddExposure	
             
                    config.statistic = 'MEANCLIP'	
                    task = AssembleCoaddTask(config=config)	
                    coaddClip = task.run(skyInfo, tempExpRefList, imageScalerList, weightList).coaddExposure
                    
            

            When you replaced these with subtasks, you forgot to load the camera-specific configs for the two subtasks.
            This changed the behavior of safeclip for all cameras that have an obs_camera/config/safeClipAssembleCoadd.py
            We didn't notice until now because we don't regularly run safeClip in CI.

            Please either revert your ticket or add the following:

            config.assembleMeanCoadd.load(os.path.join(os.path.dirname(__file__), "assembleCoadd.py"))
            config.assembleMeanCoadd.statistic = 'MEAN'
            config.assembleMeanClipCoadd.load(os.path.join(os.path.dirname(__file__), "assembleCoadd.py"))
            config.assembleMeanClipCoadd.statistic = 'MEANCLIP'
            

            to every obs_package that has a config/safeClipAssembleCoadd.py

            Show
            yusra Yusra AlSayyad added a comment - The original code ensured that the the coaddMean and coaddClip were generated with the same configs as specified for the final coadd, except for MEAN/MEANCLIP. configIntersection = {k: getattr(self.config, k) for k, v in self.config.toDict().items() if (k in config.keys() and k != "connections")} config.update(**configIntersection)     config.statistic = 'MEAN' task = AssembleCoaddTask(config=config) coaddMean = task.run(skyInfo, tempExpRefList, imageScalerList, weightList).coaddExposure   config.statistic = 'MEANCLIP' task = AssembleCoaddTask(config=config) coaddClip = task.run(skyInfo, tempExpRefList, imageScalerList, weightList).coaddExposure When you replaced these with subtasks, you forgot to load the camera-specific configs for the two subtasks. This changed the behavior of safeclip for all cameras that have an obs_camera/config/safeClipAssembleCoadd.py We didn't notice until now because we don't regularly run safeClip in CI. Please either revert your ticket or add the following: config.assembleMeanCoadd.load(os.path.join(os.path.dirname(__file__), "assembleCoadd.py")) config.assembleMeanCoadd.statistic = 'MEAN' config.assembleMeanClipCoadd.load(os.path.join(os.path.dirname(__file__), "assembleCoadd.py")) config.assembleMeanClipCoadd.statistic = 'MEANCLIP' to every obs_package that has a config/safeClipAssembleCoadd.py
            Hide
            yusra Yusra AlSayyad added a comment -

            I'm happy to do this ticket myself, but I would have just reverted https://github.com/lsst/pipe_tasks/commit/09a6bcfc91ceffd0e07f70b230a29e7cbca81b13#diff-d2c8262f4554a7b63f3ea59d253e64f595e029ac06f1b031eca6cf0ab6d486fd

            I couldn't tell what problem that commit was trying to solve, so I wanted you to take a look and see if there was a solution that solved your problem AND maintained original config behavior.

            Show
            yusra Yusra AlSayyad added a comment - I'm happy to do this ticket myself, but I would have just reverted https://github.com/lsst/pipe_tasks/commit/09a6bcfc91ceffd0e07f70b230a29e7cbca81b13#diff-d2c8262f4554a7b63f3ea59d253e64f595e029ac06f1b031eca6cf0ab6d486fd I couldn't tell what problem that commit was trying to solve, so I wanted you to take a look and see if there was a solution that solved your problem AND maintained original config behavior.
            Hide
            sullivan Ian Sullivan added a comment -

            That change was required in order to create Mock versions of the various AssembleCoadd Tasks for unit tests. I find it valuable to have those tests, so I will follow your suggestion to add the camera-specific configs to the obs packages.

            Show
            sullivan Ian Sullivan added a comment - That change was required in order to create Mock versions of the various AssembleCoadd Tasks for unit tests. I find it valuable to have those tests, so I will follow your suggestion to add the camera-specific configs to the obs packages.
            Hide
            sullivan Ian Sullivan added a comment -

            Note: it looks like only obs_lsst and obs_subaru have camera-specific configs set for SafeClipAssembleCoaddTask.

            Show
            sullivan Ian Sullivan added a comment - Note: it looks like only obs_lsst and obs_subaru have camera-specific configs set for SafeClipAssembleCoaddTask .
            Hide
            sullivan Ian Sullivan added a comment -

            I modified the two obs packages that provide configs for SafeClipAssebleCoaddTask, but I also tested reverting the changes that caused the problem in the first place. The unit tests that I was concerned about pass even with the changes reverted, so I am happy with that solution. For completeness, I made pull requests both for the obs package changes and for reverting pipe_tasks, but the two options are not compatible. Both pass on Jenkins.

            Obs package changes:
            https://github.com/lsst/obs_subaru/pull/332
            https://github.com/lsst/obs_lsst/pull/278

            Reverting pipe_tasks:
            https://github.com/lsst/pipe_tasks/pull/446

            Please choose your preferred solution as part of the review.

            Show
            sullivan Ian Sullivan added a comment - I modified the two obs packages that provide configs for SafeClipAssebleCoaddTask , but I also tested reverting the changes that caused the problem in the first place. The unit tests that I was concerned about pass even with the changes reverted, so I am happy with that solution. For completeness, I made pull requests both for the obs package changes and for reverting pipe_tasks , but the two options are not compatible. Both pass on Jenkins. Obs package changes: https://github.com/lsst/obs_subaru/pull/332 https://github.com/lsst/obs_lsst/pull/278 Reverting pipe_tasks : https://github.com/lsst/pipe_tasks/pull/446 Please choose your preferred solution as part of the review.
            Hide
            sullivan Ian Sullivan added a comment -

            I lost track of this ticket, and am coming back to it now. I believe the correct solution is to just revert the changes to pipe_tasks, so I have rebased that branch and am checking that it passes on Jenkins. Yusra AlSayyad could you verify this is still the desired change?

            Show
            sullivan Ian Sullivan added a comment - I lost track of this ticket, and am coming back to it now. I believe the correct solution is to just revert the changes to pipe_tasks , so I have rebased that branch and am checking that it passes on Jenkins. Yusra AlSayyad could you verify this is still the desired change?

              People

              Assignee:
              sullivan Ian Sullivan
              Reporter:
              lskelvin Lee Kelvin
              Reviewers:
              Yusra AlSayyad
              Watchers:
              Ian Sullivan, Lee Kelvin, Yusra AlSayyad
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.