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

Footprints should be pickleable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: To Do
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: afw
    • Labels:
      None
    • Team:
      Data Release Production

      Description

      Footprints are currently not pickleable. For example, using the following code to create, save and load a Footprint:

      import pickle
      import tempfile
       
      from lsst.afw.geom import SpanSet
      from lsst.afw.detection import Footprint
       
      # Create a SpanSet and use it to construct a Footprint
      radius = 5
      ss = SpanSet.fromShape(radius, offset=(10, 10))
      foot = Footprint(ss)
      # Add a few peaks to the PeakCatalog (x, y, intensity)
      foot.addPeak(7, 7, 95)
      foot.addPeak(8, 8, 103)
      foot.addPeak(9, 9, 100)
      # Pickle the footprint
      fd, fname = tempfile.mkstemp()
      pickle.dump(foot, open(fname, 'wb'))
      # Unpickle the footprint
      fp = pickle.load(open(fname, 'rb'))
      

      calling Footprint methods cause the code to segfault, for example:

      fp.getBBox()
      

      or

      fp.getPeaks()
      

        Attachments

          Issue Links

            Activity

            Hide
            fred3m Fred Moolekamp added a comment -

            Note: Serialization also fails when using the dill package in place of pickle.

            Show
            fred3m Fred Moolekamp added a comment - Note: Serialization also fails when using the dill package in place of pickle .
            Hide
            fred3m Fred Moolekamp added a comment -

            Sometimes, instead of a segfault, getSpans and getPeaks work, except that getSpans returns None and getPeaks returns an empty peak catalog, even in the above example where there are both spans and peaks in the Footprint. getBBox appears to consistently segfault.

            Show
            fred3m Fred Moolekamp added a comment - Sometimes, instead of a segfault, getSpans and getPeaks work, except that getSpans returns None and getPeaks returns an empty peak catalog, even in the above example where there are both spans and peaks in the Footprint. getBBox appears to consistently segfault.
            Hide
            jbosch Jim Bosch added a comment -

            Reviewing for CCB: still seems relevant, but probably won't take any action until/unless somebody needs it for something.

            Show
            jbosch Jim Bosch added a comment - Reviewing for CCB: still seems relevant, but probably won't take any action until/unless somebody needs it for something.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              fred3m Fred Moolekamp
              Watchers:
              Fred Moolekamp, Jim Bosch, John Swinbank, Nate Lust
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Jenkins

                  No builds found.