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

astrometry has a bug in retrieving TAN_PIXELS and it exposes the need for a better API

    Details

    • Type: Bug
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: afw, meas_astrom
    • Labels:
      None
    • Templates:
    • Team:
      Alert Production

      Description

      meas_astrom astrometry.py has two errors in how it retrieves the TAN_PIXELS coordinate system:

      pixelsToTanPixels = exposureInfo.getDetector().getTransformMap().get(TAN_PIXELS)
      if pixelsToTanPixels:
          ...

      The first error is using a CameraSysPrefix instead of a CameraSys to specify the transform; the second error is in assuming get will return None if the system is not present. Unfortunately the correct code is ugly and suggests the need for a better API:

      detector = exposureInfo.getDetector()
      tanPixCamSys = detector.getCameraSys(TAN_PIXELS)
      if tanPixCamSys in detector.getTransformMap():
          pixelsToTanPixels = detector.getTransformMap().get(tanPixCamSys)
          ...

      TransformMap can only handle CameraSys and fixing that would be hard, so I propose instead to add two overloaded methods to Detector, both of which can accept a CameraSys or a CameraSysPrefix:

      • getTransform(sys)
      • hasTransform(sys)

      The resulting code will be:

      detector = exposureInfo.getDetector()
      if detector.hasTransform(TAN_PIXELS):
          pixelsToTanPixels = detector.getTransform(TAN_PIXELS)
          ...

        Attachments

          Activity

            People

            • Assignee:
              rowen Russell Owen
              Reporter:
              rowen Russell Owen
              Reviewers:
              Simon Krughoff
              Watchers:
              Dominique Boutigny, Kian-Tat Lim, Russell Owen, Simon Krughoff
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel