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

Support python implementations of pixelizations

    XMLWordPrintable

    Details

    • Team:
      External
    • Urgent?:
      No

      Description

      The support for duck-typed pixelization was lost in w.2021.42 daf_butler with the addition of the type assertion in SkyPixConstructionVisitor's visit method:

      assert issubclass(PixelizationClass, Pixelization)

      Details

      We've been relying on duck-typed Pixelization class for HEALPix pixelization. (This way Pixelization with the tiles approximated by ConvexPolygon can be implemented completely in Python.)

        Attachments

          Activity

          Hide
          tatianag Tatiana Goldina added a comment -
          Show
          tatianag Tatiana Goldina added a comment - Here is what pybind11 docs says on this subject:  https://pybind11-jagerman.readthedocs.io/en/stable/advanced.html#overriding-virtual-functions-in-python
          Hide
          tatianag Tatiana Goldina added a comment -

          If I understood correctly your ABCMeta.register suggestion, I should be able to try it in my code first. If it works, we can add it to sphgeom.

          The assumption is that we do not use Pixelization methods in C++, right?

          Show
          tatianag Tatiana Goldina added a comment - If I understood correctly your ABCMeta.register suggestion, I should be able to try it in my code first. If it works, we can add it to sphgeom. The assumption is that we do not use Pixelization methods in C++, right?
          Hide
          tjenness Tim Jenness added a comment -

          My suggestion is:

          • Define a python PixelizationABC that defines all the methods in Pixelization but as unimplemented abstract methods.
          • In your python class you inherit from this ABC
          • In sphgeom python/lsst/sphgeom/_init_.py add a ABCMeta.register to associate Pixelization with that PixelizationABC.
          • In butler we assert that the pixelization class is a subclass of the PixelizationABC.
          Show
          tjenness Tim Jenness added a comment - My suggestion is: Define a python PixelizationABC that defines all the methods in Pixelization but as unimplemented abstract methods. In your python class you inherit from this ABC In sphgeom python/lsst/sphgeom/_ init _.py add a ABCMeta.register to associate Pixelization with that PixelizationABC. In butler we assert that the pixelization class is a subclass of the PixelizationABC.
          Hide
          tatianag Tatiana Goldina added a comment -

          The issue was resolved by adding PixelizationABC to lsst.sphgeom package following the recommendation of Tim Jenness

          Relevant pull requests:

          https://github.com/lsst/sphgeom/pull/32

          https://github.com/lsst/daf_butler/pull/585

           

          Show
          tatianag Tatiana Goldina added a comment - The issue was resolved by adding PixelizationABC to lsst.sphgeom package following the recommendation of Tim Jenness Relevant pull requests: https://github.com/lsst/sphgeom/pull/32 https://github.com/lsst/daf_butler/pull/585  
          Hide
          ctslater Colin Slater added a comment -

          I've backported and merged this ticket to v23, to support DM-32605.

          Show
          ctslater Colin Slater added a comment - I've backported and merged this ticket to v23, to support DM-32605 .

            People

            Assignee:
            tatianag Tatiana Goldina
            Reporter:
            tatianag Tatiana Goldina
            Watchers:
            Colin Slater, Eli Rykoff, Jim Bosch, Tatiana Goldina, Tim Jenness
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Jenkins

                No builds found.