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

Enum comparison should use == not is

    Details

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

      Description

      The showVisitSkyMap.py script in the examples sub-directory of the skymap repo uses the comparison:

      ccd.getType() is cameraGeom.SCIENCE
      

      This no longer evaluates to True when appropriate. The condition here should be `==`, not `is` (it is likely the behavior changed along with the pybind11 wrapping and has simply gone unnoticed since).

        Attachments

          Activity

          Hide
          lauren Lauren MacArthur added a comment -

          Pim, would you mind giving this a look? I can confirm that, prior to this fix, running examples/showVisitSkyMap.py would fail with:

          Traceback (most recent call last):
            File "examples/showVisitSkyMap.py", line 157, in <module>
              ccdKey=args.ccdKey, showPatch=args.showPatch, saveFile=args.saveFile, showCcds=args.showCcds)
            File "examples/showVisitSkyMap.py", line 97, in main
              xlim = max(ras)+buff, min(ras)-buff
          ValueError: max() arg is an empty sequence
          

          This is because the ccd.getType() is cameraGeom.SCIENCE comparison was always evaluating to False, so no ccds coords were getting appended to the lists. With this change, running the same command works and the attached plot is produced.

          Show
          lauren Lauren MacArthur added a comment - Pim, would you mind giving this a look? I can confirm that, prior to this fix, running examples/showVisitSkyMap.py would fail with: Traceback (most recent call last): File "examples/showVisitSkyMap.py", line 157, in <module> ccdKey=args.ccdKey, showPatch=args.showPatch, saveFile=args.saveFile, showCcds=args.showCcds) File "examples/showVisitSkyMap.py", line 97, in main xlim = max(ras)+buff, min(ras)-buff ValueError: max() arg is an empty sequence This is because the ccd.getType() is cameraGeom.SCIENCE comparison was always evaluating to False , so no ccds coords were getting appended to the lists. With this change, running the same command works and the attached plot is produced.
          Hide
          pschella Pim Schellart [X] (Inactive) added a comment -

          Upstream issue #1177 reported to fix this.

          Show
          pschella Pim Schellart [X] (Inactive) added a comment - Upstream issue #1177 reported to fix this.

            People

            • Assignee:
              lauren Lauren MacArthur
              Reporter:
              lauren Lauren MacArthur
              Reviewers:
              Pim Schellart [X] (Inactive)
              Watchers:
              John Swinbank, Lauren MacArthur, Pim Schellart [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel