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

Provide a Python function that returns the names (or at least the enum/numbers) of all the set flags in a given schema

    Details

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

      Description

      Currently, if there is a general failure reported in the flags of a measurement algorithm there is no convenient was to quickly scan all of the flags to determine what is causing the error. This is a request for a python convenience function that returns the names (or at least the enum/numbers) of all the set flags in a given schema.

        Attachments

          Issue Links

            Activity

            Hide
            jbosch Jim Bosch added a comment -

            This isn't exactly what you want, as it doesn't filter on whether a flag is set, but if e.g. base_SdssShape_flag is set, then you can print all the flags that might contribute to it via print record.extract("base_SdssShape_flag*"). That will return a name-value dict of all fields that match the given glob, and by strong convention any flag that could contribute to "base_SdssShape_flag" itself will be have a name that starts with that prefix.

            Show
            jbosch Jim Bosch added a comment - This isn't exactly what you want, as it doesn't filter on whether a flag is set, but if e.g. base_SdssShape_flag is set, then you can print all the flags that might contribute to it via print record.extract("base_SdssShape_flag*") . That will return a name-value dict of all fields that match the given glob, and by strong convention any flag that could contribute to "base_SdssShape_flag" itself will be have a name that starts with that prefix.
            Hide
            price Paul Price added a comment -

            I thought this was a good idea. We have something similar for masks, and I find it extremely useful to reduce a value (or a pixel location) into a list of mask plane names. I think it would be helpful to ask for a source, "tell me everything that went wrong".

            Show
            price Paul Price added a comment - I thought this was a good idea. We have something similar for masks, and I find it extremely useful to reduce a value (or a pixel location) into a list of mask plane names. I think it would be helpful to ask for a source, "tell me everything that went wrong".
            Hide
            swinbank John Swinbank added a comment -

            Assigned to JDS as a placeholder for now. We'll prioritize this on the backlog then see where we can fit it into the schedule.

            Show
            swinbank John Swinbank added a comment - Assigned to JDS as a placeholder for now. We'll prioritize this on the backlog then see where we can fit it into the schedule.
            Hide
            cwalter Chris Walter added a comment -

            Just thinking... I think it is would be nice to have three options for display.

            1) a reduced bit pattern like output. This is how I found the problem in the centroid algorithm. The output looked like this.

            1 0 0 1 0 0 0 0 0 0
            1 0 0 1 0 0 0 0 0 0
            1 0 0 1 0 0 0 0 0 0
            1 0 0 1 0 0 0 0 0 0
            1 0 0 1 0 0 0 0 0 0
            1 0 0 1 0 0 0 0 0 0
            1 0 0 1 0 0 0 0 0 0
            ...

            2) A list of the names of flags turned on from the schema.

            One entry might look like:

            measBase.SdssShapeAlgorithm.SHIFT

            3) A list of the names of the flags turns on with their description

            An entry might look like:

            measBase.SdssShapeAlgorithm.SHIFT - "centroid shifted by more than the maximum allowed amount"

            Show
            cwalter Chris Walter added a comment - Just thinking... I think it is would be nice to have three options for display. 1) a reduced bit pattern like output. This is how I found the problem in the centroid algorithm. The output looked like this. 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 ... 2) A list of the names of flags turned on from the schema. One entry might look like: measBase.SdssShapeAlgorithm.SHIFT 3) A list of the names of the flags turns on with their description An entry might look like: measBase.SdssShapeAlgorithm.SHIFT - "centroid shifted by more than the maximum allowed amount"
            Hide
            swinbank John Swinbank added a comment - - edited

            The DM-CCB discussed this issue on 2019-04-03. We agreed that this remains a feature request that we should maintain on the backlog, but not an immediate priority for implementation.

            Show
            swinbank John Swinbank added a comment - - edited The DM-CCB discussed this issue on 2019-04-03 . We agreed that this remains a feature request that we should maintain on the backlog, but not an immediate priority for implementation.

              People

              • Assignee:
                Unassigned
                Reporter:
                cwalter Chris Walter
                Watchers:
                Chris Walter, Jim Bosch, John Swinbank, Paul Price
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: