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

ExposureCatalog.subset fails when fancy-indexing with a boolean array.

    Details

    • Type: Bug
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Story Points:
      1
    • Sprint:
      DRP S18-5
    • Team:
      Data Release Production

      Description

      Here's a minimal failing example:

       

      import numpy as np
      import lsst.afw.table as afwTable
       
      srcCat = afwTable.SourceCatalog(afwTable.SourceTable.makeMinimalSchema())
      srcCat.addNew()
      srcCat.addNew()
      srcCat.addNew()
       
      srcCat.subset(np.array([True, True, False]))  # works fine
       
      # in contrast
       
      expCat = afwTable.ExposureCatalog(afwTable.ExposureTable.makeMinimalSchema())
      expCat.addNew()
      expCat.addNew()
      expCat.addNew()
       
      expCat.subset(np.array([True, True, False]))  # crashes
      
      

      with error message:

      TypeError: subset(): incompatible function arguments. The following argument types are supported:
          1. (self: lsst.afw.table.exposure.exposure.ExposureCatalog, mask: ndarray::Array<bool const, 1, 0>) -> lsst.afw.table.exposure.exposure.ExposureCatalog
          2. (self: lsst.afw.table.exposure.exposure.ExposureCatalog, startd: int, stopd: int, step: int) -> lsst.afw.table.exposure.exposure.ExposureCatalog
       
      Invoked with: <class 'lsst.afw.table.exposure.exposure.ExposureCatalog'>
       id bbox_min_x bbox_min_y bbox_max_x bbox_max_y
             pix        pix        pix        pix    
      --- ---------- ---------- ---------- ----------
        0          0          0          0          0
        0          0          0          0          0
        0          0          0          0          0, array([ True,  True, False], dtype=bool)
      

        Attachments

          Activity

          Hide
          jbosch Jim Bosch added a comment -

          Looks like this may just be a missing #include in the pybind11 wrappers; I'll give that fix a try.

          Show
          jbosch Jim Bosch added a comment - Looks like this may just be a missing #include in the pybind11 wrappers; I'll give that fix a try.
          Hide
          jbosch Jim Bosch added a comment -

          That seems to have done it: one-line fix, with a five-line test.  Joshua Meyers, back to you for review.

           

          Show
          jbosch Jim Bosch added a comment - That seems to have done it: one-line fix, with a five-line test.  Joshua Meyers , back to you for review.  
          Hide
          jmeyers314 Joshua Meyers added a comment -

          Looks good to me.  Thanks Jim.

          Show
          jmeyers314 Joshua Meyers added a comment - Looks good to me.  Thanks Jim.
          Hide
          jbosch Jim Bosch added a comment -

          Merged to master.

          Show
          jbosch Jim Bosch added a comment - Merged to master.

            People

            • Assignee:
              jbosch Jim Bosch
              Reporter:
              jmeyers314 Joshua Meyers
              Reviewers:
              Joshua Meyers
              Watchers:
              Jim Bosch, Joshua Meyers
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel