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

Fix overload problems in SourceCatalog.append and .extend

    XMLWordPrintable

Details

    • Story
    • Status: Done
    • Resolution: Done
    • None
    • afw
    • None

    Description

      This example fails with an exception:

      import lsst.afw.table as afwTable
      schema = afwTable.SourceTable.makeMinimalSchema()
      st = afwTable.SourceTable.make(schema)
      cat = afwTable.SourceCatalog(st)
      tmp = afwTable.SourceCatalog(cat.getTable())
      cat.extend(tmp)

      Expected behavior is that the last line is equivalent to cat.extend(tmp, deep=False).

      Attachments

        Issue Links

          Activity

            jbosch Jim Bosch added a comment -

            John, tiny review for you: as I'd hoped, this issue was addressed by one of the two related ones we just finished, so I've just added a slightly expanded version of the how-to-reproduce as a unit test.

            All changes on tickets/DM-1083 of afw:

            commit abe8cdba64c110a317f19412cd9f8ef835b3ebe5
            Author: Jim Bosch <jbosch@astro.princeton.edu>
            Date:   Thu Jan 8 15:48:43 2015 -0500
             
                Add test case for DM-1083; looks like the bug has already been solved
                
                The problem reported on DM-1083 looks very similar to DM-1710 and
                DM-1514, and it's likely it was fixed with one of those, so I'm just adding
                the how-to-reproduce from DM-1083 as a unit test.
             
            diff --git a/tests/testSourceTable.py b/tests/testSourceTable.py
            index 09ad892..abb2983 100755
            --- a/tests/testSourceTable.py
            +++ b/tests/testSourceTable.py
            @@ -395,6 +395,18 @@ class SourceTableTestCase(lsst.utils.tests.TestCase):
                     self.assertEqual(cat.getCentroidSlot().getFlagKey(), cat.schema.find("centroid.flags").key)
                     self.assertEqual(cat.getShapeSlot().getFlagKey(), cat.schema.find("shape.flags").key)
             
            +    def testDM1083(self):
            +        schema = lsst.afw.table.SourceTable.makeMinimalSchema()
            +        st = lsst.afw.table.SourceTable.make(schema)
            +        cat = lsst.afw.table.SourceCatalog(st)
            +        tmp = lsst.afw.table.SourceCatalog(cat.getTable())
            +        record = tmp.addNew()
            +        cat.extend(tmp)
            +        self.assertEqual(cat[0].getId(), record.getId())
            +        # check that the same record is in both catalogs (not a copy)
            +        record.setId(15)
            +        self.assertEqual(cat[0].getId(), record.getId())
            +
             #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
             
             def suite():

            jbosch Jim Bosch added a comment - John, tiny review for you: as I'd hoped, this issue was addressed by one of the two related ones we just finished, so I've just added a slightly expanded version of the how-to-reproduce as a unit test. All changes on tickets/ DM-1083 of afw: commit abe8cdba64c110a317f19412cd9f8ef835b3ebe5 Author: Jim Bosch <jbosch@astro.princeton.edu> Date: Thu Jan 8 15:48:43 2015 -0500   Add test case for DM-1083; looks like the bug has already been solved The problem reported on DM-1083 looks very similar to DM-1710 and DM-1514, and it's likely it was fixed with one of those, so I'm just adding the how-to-reproduce from DM-1083 as a unit test.   diff --git a/tests/testSourceTable.py b/tests/testSourceTable.py index 09ad892..abb2983 100755 --- a/tests/testSourceTable.py +++ b/tests/testSourceTable.py @@ -395,6 +395,18 @@ class SourceTableTestCase(lsst.utils.tests.TestCase): self.assertEqual(cat.getCentroidSlot().getFlagKey(), cat.schema.find("centroid.flags").key) self.assertEqual(cat.getShapeSlot().getFlagKey(), cat.schema.find("shape.flags").key) + def testDM1083(self): + schema = lsst.afw.table.SourceTable.makeMinimalSchema() + st = lsst.afw.table.SourceTable.make(schema) + cat = lsst.afw.table.SourceCatalog(st) + tmp = lsst.afw.table.SourceCatalog(cat.getTable()) + record = tmp.addNew() + cat.extend(tmp) + self.assertEqual(cat[0].getId(), record.getId()) + # check that the same record is in both catalogs (not a copy) + record.setId(15) + self.assertEqual(cat[0].getId(), record.getId()) + #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- def suite():

            Looks good.

            swinbank John Swinbank added a comment - Looks good.

            People

              jbosch Jim Bosch
              jbosch Jim Bosch
              John Swinbank
              Andrew Becker [X] (Inactive), Jim Bosch, John Swinbank, Paul Price, Robert Lupton
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Jenkins

                  No builds found.