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

butler parentSearch incorrectly returns '[]' instead of 'None' in one case.

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: obs_base
    • Labels:
      None
    • Story Points:
      0
    • Team:
      SQuaRE

      Description

      The contract for `daf.butlerUtils.CameraMapping.parentSearch` states that `None` will be returned if no matches are found.

      But in one of the options
      ` if os.path.realpath(pathPrefix) != os.path.realpath(root):`
      the code says `return []` instead of `return None`.

      This is then not caught properly by `daf.butlerUtils.mapping.map`, which was checking just for the return value `is not None`.

      The behavior of parentSearch is clearly an error (it's againt the documentation for the function).

      I would also suggest that `daf.butlerUtils.mapping.map` should check more robustly for `if newPath:` rather than `if newPath is not None:`.

      Thus we explicitly set up this if/else to return `None` if `not paths` instead of `[]`.

        Attachments

          Issue Links

            Activity

            Hide
            hchiang2 Hsin-Fang Chiang added a comment -

            Tests to retrieve data in both obs_cfht and obs_decam broke sometime between b1817 and 1825, with errors like the following for b1825

            obs_decam/tests/getRaw.py

              File "/nfs/home/hchiang2/lsst_package1/obs_decam/python/lsst/obs/decam/decamMapper.py", line 213, in _standardizeMasterCal
                mi = afwImage.makeMaskedImage(item.getImage())
            AttributeError: 'list' object has no attribute 'getImage'
            

            obs_cfht/tests/testButler.py

              File "/nfs/home/hchiang2/lsst_package1/obs_cfht/python/lsst/obs/cfht/megacamMapper.py", line 196, in _standardizeDetrend
                md = image.getMetadata()
            AttributeError: 'list' object has no attribute 'getMetadata'
            

            With Michael Wood-Vasey's fix both tests pass.

            Show
            hchiang2 Hsin-Fang Chiang added a comment - Tests to retrieve data in both obs_cfht and obs_decam broke sometime between b1817 and 1825, with errors like the following for b1825 obs_decam/tests/getRaw.py File "/nfs/home/hchiang2/lsst_package1/obs_decam/python/lsst/obs/decam/decamMapper.py" , line 213 , in _standardizeMasterCal mi = afwImage.makeMaskedImage(item.getImage()) AttributeError: 'list' object has no attribute 'getImage' obs_cfht/tests/testButler.py File "/nfs/home/hchiang2/lsst_package1/obs_cfht/python/lsst/obs/cfht/megacamMapper.py" , line 196 , in _standardizeDetrend md = image.getMetadata() AttributeError: 'list' object has no attribute 'getMetadata' With Michael Wood-Vasey 's fix both tests pass.
            Show
            wmwood-vasey Michael Wood-Vasey added a comment - https://github.com/lsst/daf_butlerUtils/pull/7

              People

              • Assignee:
                wmwood-vasey Michael Wood-Vasey
                Reporter:
                wmwood-vasey Michael Wood-Vasey
                Reviewers:
                Nate Pease, Tim Jenness
                Watchers:
                Hsin-Fang Chiang, Michael Wood-Vasey, Nate Pease, Tim Jenness
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Summary Panel