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

Provide an easy way to set Coord fields of a source catalog

    XMLWordPrintable

Details

    • Improvement
    • Status: Won't Fix
    • Resolution: Done
    • None
    • afw
    • 2
    • Alert Production

    Description

      We sometimes need to set the coord fields of a source catalog, e.g. when fitting a new WCS or when studying an `icSrc` catalog (whose Coord field is not set). It would be nice to have a central, easily found way to do this. Right now we have the following as a static method of `TanSipWcsTask`, which works fine but is in a poor location:

          def updateSourceCoords(wcs, sourceList):
              """Update coords in a collection of sources, given a WCS
              """
              if len(sourceList) < 1:
                  return
              schema = sourceList[1].schema
              srcCoordKey = afwTable.CoordKey(schema["coord"])
              for src in sourceList:
                  src.set(srcCoordKey, wcs.pixelToSky(src.getCentroid()))
      

      The other direction is also useful for reference catalogs, though from a practical standpoint the only user is probably `meas_astrom`. Even so, I suggest that this be made publicly available in the same way. Again, this is presently a static method of `FitTanSipWcsTask`:

          def updateRefCentroids(wcs, refList):
              """Update centroids in a collection of reference objects, given a WCS
              """
              if len(refList) < 1:
                  return
              schema = refList[0].schema
              coordKey = afwTable.CoordKey(schema["coord"])
              centroidKey = afwTable.Point2DKey(schema["centroid"])
              for refObj in refList:
                  refObj.set(centroidKey, wcs.skyToPixel(refObj.get(coordKey)))
      

      I hope this can remain Python code, but admit that the extra speed of C++ might come in handy in some cases. In any case, once the function is in a central location we can implement it in C++ if we find the need.

      Attachments

        Issue Links

          Activity

            No builds found.
            rowen Russell Owen created issue -
            swinbank John Swinbank made changes -
            Field Original Value New Value
            Watchers Jim Bosch, Russell Owen [ Jim Bosch, Russell Owen ] Jim Bosch, John Swinbank, Russell Owen [ Jim Bosch, John Swinbank, Russell Owen ]
            Assignee John Swinbank [ swinbank ]
            Labels sciencepipelines
            rowen Russell Owen made changes -
            Team Alert Production [ 10300 ]
            Parejkoj John Parejko made changes -
            Link This issue relates to RFC-197 [ RFC-197 ]
            Parejkoj John Parejko made changes -
            Link This issue relates to DM-6566 [ DM-6566 ]
            tjenness Tim Jenness made changes -
            Remote Link This issue links to "Page (Confluence)" [ 31076 ]
            tjenness Tim Jenness added a comment -

            Where do we stand with this old ticket? Is it still useful to keep around?

            tjenness Tim Jenness added a comment - Where do we stand with this old ticket? Is it still useful to keep around?
            jbosch Jim Bosch added a comment -

            I don't think this was actually ever valid; SourceTable.updateCoords dates back to well before this ticket.  Either that or I've missed some subtle reason it couldn't be used for this use case.  In any case, I think this ticket is no longer useful.

            jbosch Jim Bosch added a comment - I don't think this was actually ever valid; SourceTable.updateCoords dates back to well before this ticket.  Either that or I've missed some subtle reason it couldn't be used for this use case.  In any case, I think this ticket is no longer useful.
            jbosch Jim Bosch made changes -
            Resolution Done [ 10000 ]
            Status To Do [ 10001 ] Won't Fix [ 10405 ]

            People

              Unassigned Unassigned
              rowen Russell Owen
              Jim Bosch, John Parejko, John Swinbank, Russell Owen, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Jenkins

                  No builds found.