# Make FlagHandler, SafeCentroidExtractor usable from Python

XMLWordPrintable

## Details

• Type: Story
• Status: Invalid
• Resolution: Done
• Fix Version/s: None
• Component/s:
• 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 > 

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.

## Activity

John Swinbank created issue -
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.
John Swinbank made changes -
 Priority Major [ 3 ] Minor [ 4 ]
John Swinbank made changes -
 Assignee Jim Bosch [ jbosch ]
John Swinbank made changes -
 Link This issue relates to DM-4882 [ DM-4882 ]
John Swinbank made changes -
 Link This issue duplicates DM-4009 [ DM-4009 ]
John Swinbank made changes -
 Resolution Done [ 10000 ] Status To Do [ 10001 ] Invalid [ 11005 ]
Hide
John Swinbank added a comment -

Closing as duplicate of DM-4009.

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

## People

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

## Dates

• Created:
Updated:
Resolved: