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

Make FlagHandler, SafeCentroidExtractor usable from Python

    Details

    • Type: Story
    • Status: Invalid
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: meas_base
    • Labels:
      None
    • Story Points:
      2
    • Team:
      Data Release Production

      Description

      The meas_base framework includes SafeCentroidExtractor, a convenience routine for extracting a centroid from a source record, setting a consistent set of flags if that's not possible or if the centroid is in some way compromised. This consistent flag handling is made possible by the use of the FlagHandler class.

      Unfortunately, FlagHandler is not meaningfully usable from Python, not least because it's impossible to define flags:

      >>> import lsst.meas.base as measBase
      >>> measBase.FlagDefinition("flag", "doc")
      [...]
      TypeError: __init__() takes exactly 1 argument (3 given)
      >>> fd = measBase.FlagDefinition()
      >>> fd.name = "flag"
      [...]
      AttributeError: You cannot add attributes to <lsst.meas.base.baseLib.FlagDefinition; proxy of <Swig Object of type 'lsst::meas::base::FlagDefinition *' at 0x10a82b900> >
      

      Looking further, even were we able to create FlagDefinitions, the FlagHandler is initialized with pointers to the beginning/end of a container of them, which seems like a stretch for Python code.

      Please add Python support for these routines.

        Attachments

          Issue Links

            Activity

            swinbank John Swinbank created issue -
            swinbank John Swinbank made changes -
            Field Original Value New Value
            Description The {{meas_base}} framework includes {{SafeCentroidExtractor}}, a convenience routine for extracting a centroid from a source record, setting a consistent set of flags if that's not possible or if the centroid is in some way compromised. This consistent flag handling is made possible by the use of the {{FlagHandler}} class.

            Unfortunately, {{FlagHandler}} is not meaningfully usable from Python, not least because it's impossible to define flags:
            {code:python}
            >>> import lsst.meas.base as measBase
            >>> measBase.FlagDefinition("flag", "doc")
            [...]
            TypeError: __init__() takes exactly 1 argument (3 given)
            >>> fd = measBase.FlagDefinition()
            >>> fd.name = "flag"
            [...]
            AttributeError: You cannot add attributes to <lsst.meas.base.baseLib.FlagDefinition; proxy of <Swig Object of type 'lsst::meas::base::FlagDefinition *' at 0x10a82b900> >
            {code}

            Looking further, even were we able to create {{FlagDefinitions}}, the {{FlagHandler}} is initialized with pointers to the beginning/end of a container of them, which seems like a stretch for Python code.

            Please add Python support for this routines.
            The {{meas_base}} framework includes {{SafeCentroidExtractor}}, a convenience routine for extracting a centroid from a source record, setting a consistent set of flags if that's not possible or if the centroid is in some way compromised. This consistent flag handling is made possible by the use of the {{FlagHandler}} class.

            Unfortunately, {{FlagHandler}} is not meaningfully usable from Python, not least because it's impossible to define flags:
            {code:python}
            >>> import lsst.meas.base as measBase
            >>> measBase.FlagDefinition("flag", "doc")
            [...]
            TypeError: __init__() takes exactly 1 argument (3 given)
            >>> fd = measBase.FlagDefinition()
            >>> fd.name = "flag"
            [...]
            AttributeError: You cannot add attributes to <lsst.meas.base.baseLib.FlagDefinition; proxy of <Swig Object of type 'lsst::meas::base::FlagDefinition *' at 0x10a82b900> >
            {code}

            Looking further, even were we able to create {{FlagDefinitions}}, the {{FlagHandler}} is initialized with pointers to the beginning/end of a container of them, which seems like a stretch for Python code.

            Please add Python support for these routines.
            swinbank John Swinbank made changes -
            Priority Major [ 3 ] Minor [ 4 ]
            swinbank John Swinbank made changes -
            Assignee Jim Bosch [ jbosch ]
            swinbank John Swinbank made changes -
            Link This issue relates to DM-4882 [ DM-4882 ]
            swinbank John Swinbank made changes -
            Link This issue duplicates DM-4009 [ DM-4009 ]
            swinbank John Swinbank made changes -
            Resolution Done [ 10000 ]
            Status To Do [ 10001 ] Invalid [ 11005 ]
            Hide
            swinbank John Swinbank added a comment -

            Closing as duplicate of DM-4009.

            Show
            swinbank John Swinbank added a comment - Closing as duplicate of DM-4009 .

              People

              • Assignee:
                Unassigned
                Reporter:
                swinbank John Swinbank
                Watchers:
                John Swinbank
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel